How to pack data in a SPI frame in a L6470 daisy chain configuration.
Hi,
I have a project, based on a STM32L071CB MCU, where I use two L6470
stepper motor drivers attached together in a daisy chain configuration:
a pin of MCU configured as general purpose output is connected to both
the Chip Select of the two L6470 devices; the SCLK output of SPI1 is
connected to both the CK inputs; the SPI1's MOSI from MCU goes into
SDI of the first L6470 device and the SDO of the second L6470 chip is
attached to the SPI1's MISO of MCU.
I'm here to ask help on how to pack data to proper form a valid SPI frame,
that send on the SPI bus, allow me to put L6470's commands.
At the moment I cannot receive any kind of data from one or more L6470
devices when I issue a GETSTATUS or a GETPARAM command to them.
Here I depict the SPI frame I sent on the SPI daisy chain bus when I want
to ask to the second L6470 device (the one whose SDO pin is connected to
the MISO) its STATUS register value, by means of a GETSTATUS command:
CS\ ---\ /---
\_____________________________________________/
----------> t
MOSI pin |CMD| NOP | NOP | NOP | NOP | NOP |
MISO pin |NOP| NOP | MSB | NOP | LSB | NOP |
Where: CMD = 0xD0
NOP = 0x00
STATUS = MSB << 8 | LSB
Sending the buffer [0xD0, 0x00, 0x00, 0x00, 0x00, 0x00] on the SPI bus
I am telling to the second device to give me its 16-bit status word that
I think to retrieve in the third received byte and in the 5th received byte.
Am I wrong?