I have a problem with S32K116 SPI read operation. In LPSPI driver, I find there is an API LPSPI_DRV_MasterTransferBlocking() for SPI transfer.
Both send and receive buffer sizes are controlled by uint16 TransferByteCount.
This means, I can only send n bytes and read back n bytes in each SPI operation.
This confuses me: the amounts sent and received are the same. I can't read more data than I can write.
For example, the device has an SPI protocol as fellow. If I want to communicate via S32K116 LPSPI, read 2 bytes after writing 1 byte. How do I do this via the LPSPI driver?
This problem has troubled me for a long time.
If you have a solution, please tell me. Thank you.
解決済! 解決策の投稿を見る。
Hi @basicios,
With the driver, and with the CS asserted between the write and the read operations, you need to call the API only once.
Set the TransferByteCount to 3 and fill the sendBuffer with 0x05, 0xFF, 0xFF (as per the format you posted).
You will receive 3 bytes, but the first byte should be ignored.
Regards,
Daniel
It work now. Thanks a lot!
Hi @basicios,
With the driver, and with the CS asserted between the write and the read operations, you need to call the API only once.
Set the TransferByteCount to 3 and fill the sendBuffer with 0x05, 0xFF, 0xFF (as per the format you posted).
You will receive 3 bytes, but the first byte should be ignored.
Regards,
Daniel