cancel
Showing results for 
Search instead for 
Did you mean: 

L9963E SPI message definition

MaraLo
Associate II

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.

MaraLo_0-1708370925442.png

Can you please explain the right order for both receiving and sending SPI frame, as well as, how should SPI be configured?

1 ACCEPTED SOLUTION

Accepted Solutions
Max VIZZINI
ST Employee

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

 

 

View solution in original post

5 REPLIES 5
AScha.3
Chief II

Hi,

Time in such a diagram is "going" ( time passes) from left to right, as you see it on scope, when watching the signal:

AScha3_0-1708375401781.png

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.

If you feel a post has answered your question, please click "Accept as Solution".
MaraLo
Associate II

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?

As you write it :  Byte            4    3    2   1   0 

send :   4    3    2   1   0

 

If you feel a post has answered your question, please click "Accept as Solution".

> 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);

 

If you feel a post has answered your question, please click "Accept as Solution".
Max VIZZINI
ST Employee

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