Hello Fredt,
I have the same problem as you have before in QSPI reading and writing method.
I cannot get the reading as i wrote the data in QSPI ram. I donot know what i have done wrong at the moment. Iam using the M52233 Demo board for the test. I hope by now you have already solved the QSPI problem. Could you help me on this, thanks.
Here is the code below
void init_serial_flash( void )
{
MCF_QSPI_QDLYR = (MCF_QSPI_QDLYR_DTL(2) | MCF_QSPI_QDLYR_QCD(2)) ;
// QSPI interrupt disabled
MCF_QSPI_QIR = 0;
MCF_GPIO_DDRQS = 0;
MCF_GPIO_PQSPAR |= 0x0015;
MCF_QSPI_QMR = (
0
| MCF_QSPI_QMR_MSTR
| MCF_QSPI_QMR_BITS(8)
/| MCF_QSPI_QMR_CPHA
| MCF_QSPI_QMR_CPOL
| MCF_QSPI_QMR_BAUD(2)
);
}
void write_to_qspi_ram( uint8 address, uint16 data )
{
MCF_QSPI_QAR = address;
MCF_QSPI_QDR = data;
}
uint16 read_from_qspi_ram( uint8 address )
{
MCF_QSPI_QAR = address;
return( MCF_QSPI_QDR );
}
void Test_QSPI()
{
write_to_qspi_ram(QSPI_COMMAND_RAM, (SPI_COM_BITSE | SPI_COM_CS3 | SPI_COM_CS2 | SPI_COM_CS1 | SPI_COM_CS0));
write_to_qspi_ram(QSPI_TX_RAM, 0x55);
MCF_QSPI_QIR = MCF_QSPI_QIR_SPIF;
MCF_QSPI_QWR = MCF_QSPI_QWR_NEWQP(1);
MCF_QSPI_QDLYR = MCF_QSPI_QDLYR_SPE;
while( !(MCF_QSPI_QIR & MCF_QSPI_QIR_SPIF ))
{
// Spin here waiting for completion
};
ReadData12[0] = read_from_qspi_ram(QSPI_RX_RAM);
ReadData12[0] = read_from_qspi_ram(QSPI_RX_RAM+1);
ReadData12[0] = read_from_qspi_ram(QSPI_RX_RAM+2);
ReadData12[0] = read_from_qspi_ram(QSPI_RX_RAM+3);
}