Showing results for 
Search instead for 
Did you mean: 

MDMA write error writing to DMA registers

Associate II


 I have a DMA stream working in Normal mode (Mem to Peripheral). This by itself is working properly (without MDMA).

 I want to configure MDMA to set the next parameters for the DMA to handle.

 I configure 4 words (4 uint_32) in memory for writing them to the DMA registers when transfer is complete:

 struct  {

  uint32_t nextCR;

  uint32_t nextSize;

  uint32_t nextPAR;

  uint32_t nextBuff;

} NextRegisters;

I configure MDMA with:

 DMA transfer complete event to trigger 4X4 bytes transfer from my NextRegisters to the DMA registers (they are at 0x40020000) using HAL_MDMA_Init()

 Then I start the MDMA using HAL_MDMA_Start(&hmdma, (uint32_t)&NextRegister, (uint32_t) dma_generator->Instance, 4* sizeof(uint32_t));

When I poll for execution using HAL_MDMA_PollForTransfer(&mdma,HAL_MDMA_FULL_TRANSFER,1000) inside the interrupt handler of the DMA transfer complete I get a WRITE TRANSFER ERROR, and the DMA registers are scrambled.

What am I doing wrong?