Hi all,
I use the QSPI of the MCF5282 and I've a problem to generate the clock.
I'm need to communicate with 4 CAN, and they need a low state for start a convertion on the Chip select
I was inspired of a source code of different solution on your forum.
Thanks for your help in advance.
/* Enable QSPI Pins Primary Functions */
MCF5282_GPIO_PQSPAR = 0x7F;
/* set up delay from chip select to first edge of QSPI clock */
MCF5282_QSPI_QMR=0xB302;
MCF5282_QSPI_QDLYR=0x0000;
MCF5282_QSPI_QIR=0xD00F;
MCF5282_QSPI_QIR |= MCF5282_QSPI_QIR_SPIF; /* Make sure SPIF is cleared */
/* set queue pointer to the first command RAM entry */
MCF5282_QSPI_QAR=0x0020;
/* command entry for transfer to QSPI_CS0 */
MCF5282_QSPI_QDR=0x7E00;
MCF5282_QSPI_QDR=0x7E00;
MCF5282_QSPI_QDR=0x7D00;
MCF5282_QSPI_QDR=0x7D00;
MCF5282_QSPI_QDR=0x7B00;
MCF5282_QSPI_QDR=0x7B00;
MCF5282_QSPI_QDR=0x7700;
MCF5282_QSPI_QDR=0x7700;
/* set queue pointer to the first data RAM entry */
MCF5282_QSPI_QAR = 0x0000;
/* data RAM entry for transfer to QSPI_CS0 */
MCF5282_QSPI_QDR=0xFFF;
MCF5282_QSPI_QDR=0xFFF;
MCF5282_QSPI_QDR=0xFFF;
MCF5282_QSPI_QDR=0xFFF;
MCF5282_QSPI_QDR=0xFFF;
MCF5282_QSPI_QDR=0xFFF;
MCF5282_QSPI_QDR=0xFFF;
MCF5282_QSPI_QDR=0xFFF;
/* set up wrap register for 8 12-bit transfers */
MCF5282_QSPI_QWR=0x0F00;
/*start the transfer */
MCF5282_QSPI_QDLYR |= MCF5282_QSPI_QDLYR_SPE;
while(!(MCF5282_QSPI_QIR & MCF5282_QSPI_QIR_SPIF)){} // Wait till transfers are complete
MCF5282_QSPI_QAR=0x0010; //Receive RAM selected
DATA = MCF5282_QSPI_QDR;