Problem with the QSPI module.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with the QSPI module.

1,936 Views
J_karlsson
Contributor I
Hi, I'm trying to use the QSPI-module on the MCF52235, be i can't get more than one byte transferred even though i put four bytes in the queue. If i put a oscilloscope to the data out, chip select and the clock-pin i see that the first byte gets transmitted, but the chip select is low (active low) for a 4 bit transfer. This is the code that i wrote:

MCF_QSPI_QMR = 0x51C4;

//Select the Command ram position and set up the command queue.
MCF_QSPI_QAR = 0x0020;

MCF_QSPI_QDR = 0x8200;
MCF_QSPI_QDR = 0x8200;
MCF_QSPI_QDR = 0x8200;
MCF_QSPI_QDR = 0x8200;

//Select the TRANSMT RAM and write the byte to transfer
MCF_QSPI_QAR = 0x0000;

MCF_QSPI_QDR = 0xAAAA;
MCF_QSPI_QDR = 0xBBBB;
MCF_QSPI_QDR = 0xCCCC;
MCF_QSPI_QDR = 0xDDDD;

//Set up the write queue pointers
MCF_QSPI_QWR = MCF_QSPI_QWR_ENDQP(4) | MCF_QSPI_QWR_NEWQP(0x00);
//Set the command to start the spi transfer;
MCF_QSPI_QDLYR |= MCF_QSPI_QDLYR_SPE;

//Wait until the operation has been completed
while (!(MCF_QSPI_QIR & MCF_QSPI_QIR_SPIF));

//Select the Receive RAM and get the result
MCF_QSPI_QAR = 0x0010;

*result++ = MCF_QSPI_QDR;
*result++ = MCF_QSPI_QDR;
*result++ = MCF_QSPI_QDR;
*result++ = MCF_QSPI_QDR;


This code shuld work i think, but like i said, i only get one byte transferred. Doe's anyone know what's wrong?

Best Wishes

Johnny Karlsson
Labels (1)
0 Kudos
2 Replies

471 Views
stzari
Contributor III
Hi,

one possible problem:
see Reference Manual Ch. 25.3.1 Table 25-3 bit 15:
MSTR : 1 The QSPI is in master mode. Must be set for the QSPI module to operate correctly.

HTH
stzari
0 Kudos

471 Views
J_karlsson
Contributor I
Hi, thanks for the suggestion but i found the problem be myself just after
posting this question :smileyhappy:. The problem was that i hadn't cleared the
MCF_QSPI_QIR_SPIF bit in the QIR register. So when the code starts checking
for the MCF_QSPI_QIR_SPIF bit it would have immediately returned true.
0 Kudos