cancel
Showing results for 
Search instead for 
Did you mean: 

Can't set some registers of L6470

Jhan.1
Associate II

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:

  • ALARM_EN, ST_SLP, FN_SLP_ACC, FN_SLP_DEC, KVAL_HOLD, KVAL_RUN, MINSPEED

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

3 REPLIES 3
Dario CUCCHI
ST Employee

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...

Jhan.1
Associate II

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.

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.