AnsweredAssumed Answered

LPSPI Peripheral Driver Polling Mode Returns Busy

Question asked by Jeff Thompson on Sep 4, 2019
Latest reply on Oct 27, 2019 by Daniel Chen

I'm using the MIMXRT1062 to talk to a device using SPI Master mode. I need to control the PCS line myself, as the device requires me to send it a 24-bit bit starting address for each data transfer, with PCS asserted continually during the address and data phase of each transfer. For simplicity, I've elected to use LPSPI_MasterTransferBlocking(). This technique worked quite well for me when I was using the K64F12 in a previous incarnation of the project.


Since this project needs to use the USB ports in Host CDC mode, I started with the host_cdc_bm example, added FreeRTOS, verified that worked, then added my SPI device code.


I'm working with the MIMRXT1060-EVK as a starting point, and using MCUXpresso 11 to configure LPSPI1 signals to go to the Arduino shield interface, where my SPI device attaches. I've supplied 0-ohm resistors for R278 – R281, to bring the signals I need to the Arduino shield.The LPSPI1 pins are set up with default values, except that I'm using GPIO1_IO24 as my software-controlled chip select.


Initially, the baud rate is set ro 10 MHz, but all the other peripheral settings are at their default values, as are the clocks. After I've successfully configured the SPI device, I'll increase the baud rate to 30 MHz. Again, this worked nicely for my K64F12 version.


I've verified that LPSPI_MasterInit is called with the correct peripheral base address, config, and clock frequency, and that my chip select asserts and de-#asserts.


The problem is that my first few calls to LPSPI_MasterTransferBlocking, but then it returns kStatus_LPSPI_Busy, which I've never had happen before. What is the best way to handle this? The SDK API Reference Manual does not give any guidance on this.

Outcomes