I'm working with a MEMSIC MMC5983MA magnetometer, using SPI. I can read the WHOAMI and status registers fine, and the Y and Z axes seem to be giving reasonable (near mid-range) results. But for some reason, after one reasonable reading after a reset, the X axis does not update for me. It outputs a reasonable value once, and then every read after that outputs exactly the same value, even though the Y and Z axes that I'm reading in the same multi-byte read are updating as expected.

One other issue is that the data ready interrupt pin is always low for me, despite commanding the INT_meas_done_en bit high in control register 0. Some other context:

  • I perform a software reset during my initialization and wait 15 msec.
  • I'm using the single-shot mode where I command a magnetic measurement 10 msec before each read.
  • I'm using the default 8 msec sample time and it does update the status register at the expected time.
  • The status register shows an available magnetic measurement before every read, both the single time it works and all the subsequent times with no update to the x axis.
  • I do a set, reset, and set in my initialization before trying to read from the part
  • I tried replacing the part, and the 2nd part acts the same.

Is anyone else getting the MMC5983 to work on all 3 axes?

  • \$\begingroup\$ I contacted MEMSIC and they provided some sample code. I haven't had a chance to try it yet. \$\endgroup\$ Commented May 2, 2022 at 15:37

1 Answer 1


MEMSIC technical support responded promptly with some sample code to try, and when I used it, the problem went away. So I'm not sure exactly what I was doing wrong (the sample code seemed to be doing what I was trying to do), but it was somewhere in my code and the part is working fine now.

I would attach the files from MEMSIC if there were an attach feature for this. If I were to paste in the files, it would be many pages of code. As I said, I don't know where the error is, so someone's best bet is to just contact MEMSIC for the example code and use that.

As another update: I found that the SET/RESET hardware feature appears to only be capable of changing the magnetic domain orientation of the X axis, but not the Y and Z axes. I verified this by periodically performing the set/reset command using code and timing from the example code, and then varying the orientation of the sensor in a magnetic field while displaying the offset calculated from the post-set and post-reset measured values. The X-axis worked as expected, having a nearly constant offset as the magnetic field was varied, but the Y and Z axis offset varied with the orientation with the same magnitude as the magnetic field. This confirmed my finding that the set and reset commands are not capable of reversing the magnetic domains for those axes.

I contacted MEMSIC again, and while they responded, their response provided no suggestions to fix the issue.

  • 2
    \$\begingroup\$ Hi, Thanks for coming back with an update. However, without having the working code added here, no-one will be able to really use this as an answer in the future, other than knowing that some code can indeed be made to work correctly. Can you edit this answer and add a working code sample, please? Thanks. \$\endgroup\$
    – SamGibson
    Commented May 10, 2022 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.