3
\$\begingroup\$

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:

  1. [FreeRTOS task] Perform write operation, set volatile flag indicating flash operations are busy
  2. [MDMA transfer complete interrupt] Disable MDMA
  3. [SPI transfer complete interrupt] Start polling flash status with QUADSPI
  4. [Polling match interrupt] set flag indicating flash operations are ready
  5. [FreeRTOS task] Perform read operation, set volatile flag indicating flash operations are busy
  6. [MDMA Transfer Error Interrupt]

These are the MDMA registers when I enable the MDMA at step 5: enter image description here

These are the MDMA registers when I get the error interrupt at step 6: enter image description here

These are the QUADSPI registers when I enable the MDMA at step 5: enter image description here

These are the QUADSPI registers when I get the error interrupt at step 6: enter image description here

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.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

The issue that caused the error was

MDMA_CxTBR_SBUS

Changing that from 1 to 0, and it no longer crashed. The other issue I faced which is why I though this was RTOS related was that the FreeRTOS variables shared the same memory in RAM as my local variables.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.