cancel
Showing results for 
Search instead for 
Did you mean: 

L6470 SPI operation

Joe Lichatowich
Associate II

I am confused with the SPI operation particularly the raising CS after each byte (which isn't shown in the data sheet figures). I can get the motor to work, but as an example this is what I have to do to send a simple move command. The data is (in hex) 40 00 00 01.

If all these bytes are sent at once, no CS raised between, it doesn't work.

If these bytes are sent individually with CS raised between each, it doesn't work.

To work I have to send the 40 byte alone. Then send 00 00 01 together, not raising CS between each. Then it will not turn the motor until I send two more transmissions with CS raised between. Doesn't matter what is in the transmission, seems it can be anything.

What do I not understand about what the SPI interface wants?

6 REPLIES 6
raptorhal2
Lead

Is the clock high at the start and end of each byte ?

Yes. The clock goes to its high idle state between bytes. What I need to verify is the proper sequence. It looks like sending each byte separately with CS going high in between should work. Correct? If that is the case then there is probably something screwed up in my setup.

To clarify, when sending the bytes separately the clock goes to its high idle state between bytes.

Cristiana SCARAMEL
ST Employee

Hello @Joe Lichatowich 

as reported in the L6470 datasheet the CS input must be raised after each byte transmission.

Remember that the Move command makes N_STEP (micro)steps in the selected direction, so it is possible that you cannot see the motor moves.
To verify if the device properly you could read the ABS_POS register before and after sending the MOVE command to check if the motor makes the proper steps.

In any case you can find more details on the communication protocol in the dedicated application notes AN4290

Yes, I got it to work. I was using the L6470 eval board and an SPI host adapter to test out the operation. I changed from sending the bytes one at a time to sending in the adapter batch mode and it worked. Not sure what the difference was. Knowing that the proper sequence was raising the CS between bytes and the AN4290 explanation helped. The datasheet does say to raise CS with each byte transmission, but the datasheet SPI transmission diagrams do show the CS staying high between transmissions, so at first I didn't know which was correct.

Correction: the datasheet diagrams (fig 17 and 18) show the CS staying low between transmissions.