MCF52259 QSPI / Chip select issue

Discussion created by FridgeFreezer on Mar 31, 2010
Latest reply on Apr 6, 2010 by FridgeFreezer

I'm currently trying to get the QSPI module on the MCF52259 (EVB52259 eval board) working. While the data transfer part of it seems to work OK, the chip select lines (CS0, CS2, CS3) are not behaving as they should.


I'm using CodeWarrior 7.2 and the QSPI init & example code from the Freescale examples (QSPIinit, qspi_spif, etc.).


There are two problems I'm seeing:


The first is that between every byte transfered, the CS line goes back to its idle state - due to the chip we're trying to talk to, this resets the chip's Rx buffer and hence the transer fails. I have MCF_QSPI_QDR_CONT set in the command data of every command (again, using a copy of the example routine qspi_spif() but with different data in the packet) and have tried the full range of delays in MCF_QSPI_QDLYR for QCD and DTL. If I set the module for 16-bit transfers the CS line seems to still blip every 8 bytes.


The second problem is that no matter what I set in the command data, the chip select lines do not work as they should:

If I set MCF_QSPI_QWR_CSIV to 0 in QWR, the lines are low all the time even if I write different values to MCF_QSPI_QDR_CS - I have tried everything from 0x00 to 0x0F and none of them make the CS line move.

If I set MCF_QSPI_QWR_CSIV to 1 in QWR, the lines toggle to active low when a transfer is in progress, but they do so regardless of what is in MCF_QSPI_QDR_CS - I have tried everything from 0x00 to 0x0F and whatever I write, all of the CS lines go low during a transfer and then return high. They also blip high between bytes as mentioned above, which corrupts the transfer.


The changes I've made to the original example code are minimal:

I call QSPIInit(QSPI_BAUD, QSPI_CLKATTRIB, QSPI_BITS, QSPI_CLKDLY, QSPI_DLYAFT, QSPI_CSPOL) with my own values, typically QSPIInit(200, 0, 8, 1, 1, 1);

I have modified the qspi_spif() routine from qspi_example.c to populate the test data with my own data by removing the incremental write (MyBuf->pu16TxData[j] = j) and writing directly in to locations MyBuf->pu16TxData[0]...[16]. The rest of the routine, and the ISR which runs the transfer, are completely unchanged.


I don't know if this is a problem with the way I'm programming this (as I said, I'm using the example QSPI routines with minimal mods) or if there is some bug in the example code that means my mods can never work.


Loading M52259EVB_qspi.mcp from the 52259EVB example code pack will show you all the routines I'm using.