AnsweredAssumed Answered

MCF52259 SPI driver very slow

Question asked by David Rodgers on Nov 9, 2010
Latest reply on Dec 6, 2010 by Trevor Kavanaugh

I'm currently writing a device driver for a SPI peripheral, utilizing the MQX-provided QSPI driver (currently running in polled mode).  I've noticed that while running the CPU at 40MHz and the QSPI clock at 1MHz, there's always a ~270us delay between the conclusion of an operation (_io_read, _io_write, fflush) and the next operation or raising of chip select.  Looking on my scope, if I perform the following actions on an open fd handle:


_io_write(spi_fp, &cmd, 1);

_io_read(spi_fp, &recv_data, 1);



there is zero delay from assertion of chip select to the start of the SPI write, but 270 us from the end of the write to the start of the read, and another 270us from the end of the read to the deassertion of chip select.  If I do a two-byte write, the two bytes go out very quickly, but there's still a 270us delay from the end of the write to chip deselect.  Given that my SPI peripheral is a UART, this is seriously killing performance.


What could possibly be taking so long?


(CW 7.2, MQX 3.6.1, running on M52259EVB w/ SPI device daughterboard)