I'm using the MDMA to communicate with an external flash over QUADSPI.
I have an implementation which works great without FreeRTOS, but when I implement it using FreeRTOS I get Transfer Error Address. I have verified that the RAM address exists in AXI memory so it seems like there is something about FreeRTOS that is not allowing the MDMA to read the memory?
// Write operation
MDMA_Channel0->CDAR = &QUADSPI->DR;
MDMA_Channel0->CSAR = pData; // pData is a uint8_t*
// Read operation
MDMA_Channel0->CDAR = pData;
MDMA_Channel0->CSAR = &QUADSPI->DR;
I've seen the issue with both read and write operations. For both read and write the MDMA_CESR_TED = 0, meaning that the error is related to a read access.
This is the flow of the program:
- [FreeRTOS task] Perform write operation, set volatile flag indicating flash operations are busy
- [MDMA transfer complete interrupt] Disable MDMA
- [SPI transfer complete interrupt] Start polling flash status with QUADSPI
- [Polling match interrupt] set flag indicating flash operations are ready
- [FreeRTOS task] Perform read operation, set volatile flag indicating flash operations are busy
- [MDMA Transfer Error Interrupt]
These are the MDMA registers when I enable the MDMA at step 5:
These are the MDMA registers when I get the error interrupt at step 6:
These are the QUADSPI registers when I enable the MDMA at step 5:
These are the QUADSPI registers when I get the error interrupt at step 6:
I have tried adding various delays in case it is a timing issue but to no avail. I don't understand why I get the error.