2024-02-19 11:42 AM
Hi,
I'm trying to understand SPI communication for your L9963E.
In the data sheet for your L9963E IC is missing the definition of how SPI shall be configured. It doesn't say anything about MSB/LSB bit send configuration for SPI. In the picture below we can see that you have defined the order for IC frame which seems to mismatch with the actual code. From the picture below we can see that CRC should be sent the first in the frame, but in your source code in AutoDevKit Studio, CRC is packed the last spiWord[4]. Probably I misinterpreted your IC frame definition or example code.
Can you please explain the right order for both receiving and sending SPI frame, as well as, how should SPI be configured?
Solved! Go to Solution.
2024-02-20 12:59 AM
Hello,
The correct order is the one you find in the AutoDevKit library, therefore the first bit is P.A. and the CRC is sent last.
Regarding SPI configuration, you can refer to the one present in the dedicated AutoDevKit component to verify all electrical characteristics.
Best Regards,
AutoDevKit Team
2024-02-19 12:48 PM - edited 2024-02-19 12:51 PM
Hi,
Time in such a diagram is "going" ( time passes) from left to right, as you see it on scope, when watching the signal:
So in your diagram the crc is on right end, end of transmission, and "CRC is packed the last spiWord" is exactly this.
+
The "numbers" of the bits are independent of time sequence , here they give "0" to the last bit to transfer.
Could be other way also , but is just a decision, where you begin the numbering : first bit or last bit, both is ok.
2024-02-19 01:10 PM - edited 2024-02-19 01:13 PM
Hi,
Thank you for your reply.
Maybe I didn't define my question well.
I'm interested in bit send/read sequence on SPI, so for example if I want to send the broadcast frame: 0xC0040C1040, where the byte interpretation is following:
spiWrite C0 04 0C 10 40
Byte 4 3 2 1 0
shall these bytes be sent in this order: first spiWrite[4] byte or first spiWrite[0]?
I the sequence is wrong, can you please explain the right byte send ordering?
2024-02-19 01:29 PM
As you write it : Byte 4 3 2 1 0
send : 4 3 2 1 0
2024-02-19 08:24 PM
> 0xC0040C1040, where the byte interpretation is following:
> spiWrite C0 04 0C 10 40
> Byte 4 3 2 1 0
Feels like you are making more work for yourself by defining them backwards like this. The typical method would be to define them in order in an array of uint8_t and send those bytes in order as they appear in memory.
uint8_t frame[5] = {0xC0, 0x04, 0x0C, 0x10, 0x40};
HAL_SPI_Transmit(..., frame, sizeof(frame), HAL_MAX_DELAY);
2024-02-20 12:59 AM
Hello,
The correct order is the one you find in the AutoDevKit library, therefore the first bit is P.A. and the CRC is sent last.
Regarding SPI configuration, you can refer to the one present in the dedicated AutoDevKit component to verify all electrical characteristics.
Best Regards,
AutoDevKit Team