nxp-mcuxpresso / mcux-sdk

MCUXpresso SDK
BSD 3-Clause "New" or "Revised" License
323 stars 142 forks source link

fsl_lpspi.c: TransferBlocking fails to send single byte messages in a row. #79

Closed robert-hh closed 2 years ago

robert-hh commented 2 years ago

The driver fsl_lpspi.c fails to send a series of single byte TX/RX transfers in a row. The first transfer happens, the following ones are not sent. The attached example uses the transfer b2b polling file as template, so don't be confused by the name. It attempts to send a single byte TX only , then two bytes TX/RX, then again a single byte TX only so four bytes in total. It sends two bytes. If after each TX/RX transfer a short delay is added, like 20µs, all works well. Analyzing the flags in the Status register shows, that the transfer is not yet completed when TransferBlocking returns.

Tested with a MIMXRT1020_EVK board, but it fails with other boards as well.

lpspi_polling_b2b_transfer_master.zip

robert-hh commented 2 years ago

The test code ignored the status code kStatus_LPSPI_Busy returned by the call.