cancel
Showing results for 
Search instead for 
Did you mean: 

SPI frame size more than 4 bytes

DNewm.1
Associate III

Hello

I working with spc560p and I send or receive with SPI very good and had no problem, but if I want to send or receive more than 4 bytes (32bits) in one message (one chip select), what should I do? 

I used this format for send and receive:

 

spi_lld_start(&SPID2, &spi_config_Achip);

spi_lld_exchange(&SPID2, 4, txbuf, rxbuf);

spi_lld_stop(&SPID2);

 

Is there any sample in spc5studio wizard?

1 ACCEPTED SOLUTION

Accepted Solutions
Giuseppe DI-GIORE
ST Employee

Hello,

the second parameter of the spi_lld_exchange() defines the number bytes to be transferred in a single exchange operation.

In your example is the to 4 (that i: 4 bytes =  32 bits), just increase it to the number of bytes to be transferred in a single exchange.

For example, to transfer 64 bytes:

spi_lld_start(&SPID2, &spi_config_Achip);

spi_lld_exchange(&SPID2, 64, txbuf, rxbuf);

spi_lld_stop(&SPID2);

 

Best Regards

View solution in original post

2 REPLIES 2
Giuseppe DI-GIORE
ST Employee

Hello,

the second parameter of the spi_lld_exchange() defines the number bytes to be transferred in a single exchange operation.

In your example is the to 4 (that i: 4 bytes =  32 bits), just increase it to the number of bytes to be transferred in a single exchange.

For example, to transfer 64 bytes:

spi_lld_start(&SPID2, &spi_config_Achip);

spi_lld_exchange(&SPID2, 64, txbuf, rxbuf);

spi_lld_stop(&SPID2);

 

Best Regards

DNewm.1
Associate III

Thanks my friend.