Quad Serial Peripheral Interface (QuadSPI)MPC5606S Microcontroller Reference Manual, Rev. 7Freescale Semiconductor 104930.5.3.2 Flash ProgrammingIn all cases the memory sector to be written needs to be erased first. The programming sequence itself isthen initiated in the following way:1. Check that the TX Buffer is empty. If the QSPI_SFMSR[TXNE] bit is set the TX Buffer must becleared by writing 1 into the QSPI_MCR[CLR_TXF] bit.2. Program the address related to the command in the QSPI_SFAR register. Optionally one can clearthe QSPI_TBSR[TRCTR] field by writing 1 into QSPI_MCR[CLR_TXF].3. Provide initial data for the program command into the circular buffer via register TX Buffer DataRegister (QSPI_TBDR). At least one word of data must be written into the TX Buffer.4. Program the required instruction code options (i.e. size of data) into the QSPI_ICR[ICO] register.5. Trigger the IP Command to program the serial flash device by writing the instruction code into theQSPI_ICR[IC] register.6. Depending from the amount of data required step 3 must be repeated until all the required data havebeen written into the QSPI_TBDR register. At any time the QSPI_TBDR[TRCTR] field can beread to check how many words have been written actually into the TX Buffer.Steps 4 and 5 may be executed together.Upon writing the QSPI_ICR[IC] field (refer to step 5) the QuadSPI module will start to execute thecommand by transferring instruction code, address and then data to the external device. The data arefetched from the TX Buffer. It consists of 15 entries with 32-bit and is organized as a circular FIFO, whoseread pointer is incremented after each fetch. When all data are transmitted, the QuadSPI module will returnfrom ‘busy’ to ‘idle’. However, this is not true for the external device since the internal programming isstill ongoing. It is up to the user to monitor the relevant status information available from the serial flashdevice and to ensure that the programming is finished properly.30.5.3.3 Flash ReadHost access to the data stored in the external serial flash device is done in two steps: First the data must beread into the internal buffers and in the second step these internal buffers can be read by the host.30.5.3.3.1 Reading Serial Flash Data into the QuadSPI ModuleRead access to the external serial flash device can be triggered in two different ways:• IP Command Read: For flash read via the register interface the user must provide the requiredcomponents of a SFM command to the QSPI_SFAR and the QSPI_ICR registers. All available readcommands supported by the external serial flash are possible.Optionally it is possible to clear the RX Buffer pointer prior to triggering the IP Command bywriting a 1 into the QSPI_MCR[CLR_RXF] bit.From these inputs the complete transaction is built when the QSPI_ICR[IC] field is written. Thetransaction related to the read access starts and the requested number of bytes is fetched from theexternal serial flash device into the RX Buffer. Since the read access is triggered via the registerinterface the IP_ACC status bit is set driving in turn the BUSY bit (both are located in theQSPI_SFMSR register).