We have an application running in decoupled parallel mode (DPM) on a MPC5675K.
A Samsung K9F1G08 Flash is connected via GPIOs where GPIO.. are connected to I/O0..7 of the flash module.
If we read a huge amount of data from the flash device we get a lot of ECC errors and sometimes at least one byte is completely wrong.
While reading the data we use a gpio to toggle RE line of the flash device and read in the data via the parallel GPIO Pad Data In Register 0 (SIUL.PGPDI).
We tried to read PGPDI twice and the errors are gone like:
void psp_nand_gpio_read ( uint8_t * dest, uint32_t length )
while ( length-- )
/* Wait some time. */
wait_nand( PULSE_WIDTH );
/* Read data. */
*dest = ( *(volatile uint8_t *)( SIUL_BASE + 0x0C40u ) );
*dest++ = ( *(volatile uint8_t *)( SIUL_BASE + 0x0C40u ) );
} /* psp_nand_gpio_read */
If we do that we are able to read all bytes without error. If we read only once we will get errors.
The question is what can cause that behaviour?
Seems there could be timing issue when accessing the external memory. Unless that code is interrupted or other core accesses/modifies “dest” area. If the latter one is not a case, check if there is always enough time between RE assertion and data read (to follow memory specification) and also the time between RE negation and assertion again.
Have you checked the reading with the scope or some analyzer? Try to compare the values in buffer for single reading and for repeated one (use 2 buffers here, do not write to single one). Is the result somehow comparable?