2021-06-30 01:12 AM
Hello, I am trying to set registers of L6470
But some of them can't be changed and WRONG_CMD is returned when I use GetStatus command.
But When I read AN4290, WRONG_CMD bit is set when I target read-only register, but these problems have happened when I target the below registers:
I am totally sure that those register's addresses are correct and L6470 is under HiZ, Stopped status.
I can't understand why it happened. Please help me.
Solved! Go to Solution.
2021-07-06 12:31 AM
I solved the problem. Upon to the AN4290, writable registers can be grouped into 3 groups - Writable when HiZ only, Writable when stopped only, and another-.
I modified my firmware to check registers' values when I tried to change them. And if they were not changed, try to write them repeatedly until the value is changed. By this, I could change HiZ group and another group successfully.
And "Writable when stopped only" group's values are changed when I send "STOP" command before changing them.
2021-06-30 02:06 AM
Hello @Jhan.1 ,
what you describe is something unexpected.
If you are in high impedance state, you can write those registers with no problem and no CMD_ERROR is raised.
You sent a GetStatus command and received an answer from the device: so I would exclude a problem on the SPI interface.
Maybe one possible reason is that you send are sending more VALUE bytes than required by the specific register.
For Example: ALARM_EN register is 8 bit long (VALUE is 1 byte).
If you send the “SetParam�? command and then 3 bytes are sent as VALUE, the second byte is interpreted as a new command, and this could raise a CMD_ERROR depending on the byte content.
Let me know if this can help you...
2021-06-30 04:20 PM
Thank you Dari CUCCHI for your answer.
Yesterday I tried almost all registers to write, except the STATUS register, and I could change all the registers but I wrote there.
e.g) I could change KVAL_ACC, KVAL_DEC but could not change KVAL_HOLD, KVAL_RUN. And I used the same code and I successively tried to change these registers.
But I think there would be an erroneous situation as you said.
I will try more and update the results.
2021-07-06 12:31 AM
I solved the problem. Upon to the AN4290, writable registers can be grouped into 3 groups - Writable when HiZ only, Writable when stopped only, and another-.
I modified my firmware to check registers' values when I tried to change them. And if they were not changed, try to write them repeatedly until the value is changed. By this, I could change HiZ group and another group successfully.
And "Writable when stopped only" group's values are changed when I send "STOP" command before changing them.