MA782 REF register writes

I have found that the MA782 does not echo back the value written to the REF (#10) register the very first time I write the REF register. Subsequent writes to REF (using the exact same values) always succeed. Because I don’t have an endless supply of brand new never programmed chips, I tried writing REF back to zero to see if it would cause the write error to happen again the next time I write a non-zero REF value, and it does reproduce the write error. My solution is to verify the value returned in the write operation, if it is not what I wrote then I repeat the exact same REF write command, and it always succeeds on the write retry. Can you verify this behavior I am seeing?

Hi Rob,

Thank you for posting on the MPS Technical Forum.

This is odd behavior. I have a few questions:

  • Is this the only register value that exhibits this behavior?
  • Are you using a GUI to write to the MA782? If so, which one?
  • Is there an error message you receive when attempting to write?

Thanks,

Allison

Yes, this is the only register that does not return the value written in the low byte of the U16.

I am using an MCU to communicate with the device.

A read of REG #26 returns zero just before and just after the failed write to REF. I am using a very mature SPI code module that has been used in many products to talk to a lot of different devices.

I unfortunately do not have full debug capabilities for this project. However, I can build and load new MCU firmware images, and I have been putting in logging entries and other MA782 code changes to help figure out what is happening.

When writing REF to non-zero value fails, immediately (the next code line) trying again still fails, but if I set it back to RUN ASC mode and then return to IDLE ASC mode via writing the ASC_CTRL_REG, then the write to REF will succeed.

For your reference, I do wait for DV to become set and then I immediately issue the command to enter IDLE ASC state. I do a number of register writes that all return the written value as expected, it is only when writing the REF value where it fails to return the written value. I have also tried on different units to be sure it is not one bad MA782 chip.

Just to be clear, the REF write only fails when REF is presently at a value of zero (factory default) and is being changed to some non-zero value. Once the chip powers up with REF at a non-zero value, writes to other non-zero values work just fine.

OK, I have had time to do some further research, and this is what I have found.

Here is the exact sequence to produce the error:

Clear DataValid flag.
Wait for DataValid to become set again.
Immediately Write ASC_CTRL_REG_ADDR (11) to ASC_REG_IDLE (128) in between conversions.
Read ZERO_REG_ADDR_L (0) and ZERO_REG_ADDR_H (1) - Needed to compute new zero offset
Write ZERO_REG_ADDR low and high with values necessary to read correct angle degrees
If ZERO register writes succeed, ZERO regs are written using CMD_STORE_SINGLE_REG_TO_NVM.
Note: NVM write function sets a timer to prevent further register writes (RAM or NVM) for 30ms.
Write WAKE_REF_REG_ADDR (10) with desired OFF angle.

The above REF write fails whenever the new value is different from the current value.
Retrying a second time also fails, it returns current value instead of the attempted write value.
I tried reading out the error register 26, and it returns zero following the failed REF write.

I found what appears to be a reliable workaround fix. Following the first failed write of the REF register, if I put the chip back into ASC RUN and then back to ACS IDLE (using same procedure listed above). Then a second retry of writing the REF register always succeeds. Despite finding a workaround, I need some clarification on what I am seeing so I can rule out any possible bug in my code, and to have confidence in the MA782 configuration and operation.

I will add that I am near your Kirkland, WA building and I could probably arrange for an FAE to visit our facility if necessary.

Hi Rob,

Thank you for providing this information.

I would suggest trying to use the MagAlpha GUI you can download off our website. This way, we can narrow down if the issue is in your code, and we can debug from there.

Thanks,

Allison