Skip to main content
Jhan.1
Associate II
June 30, 2021
Solved

Can't set some registers of L6470

  • June 30, 2021
  • 2 replies
  • 1123 views

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.

This topic has been closed for replies.
Best answer by Jhan.1

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.

2 replies

Dario CUCCHI
ST Employee
June 30, 2021

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
Jhan.1Author
Associate II
June 30, 2021

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.

Jhan.1
Jhan.1AuthorBest answer
Associate II
July 6, 2021

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.