2024-02-27 06:13 AM
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?
Solved! Go to Solution.
2024-04-16 06:23 AM
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
2024-04-16 06:23 AM
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
2024-06-17 08:22 AM
Thanks my friend.