2019-06-11 08:10 AM
I'm trying to move an array from DTCM to SRAM1.
So I use MDMA in as memery to memory config. It isn't my first time I got it running, but never used it to transfer data from/to TCM region.
I want to copy array at 0x20000018 starting address (DTCM region) and put it into array at 0x30000000 (SRAM1).
After configuring it and triggering i just got TEIFx flag raised in C0ISR register. The C0ESR register just gives me "0x18" on TEA (source address nibble) and zeros on rest of error status bits, so no alignment or sth failure. No idea.
Although there are some TCM related registers in PM, but they don't seem to be useful here.
BUT when I just put the source array in the SRAM1, alongside the destination array, it works flawlessly, as it should.
Mdma just refuses to read/write from TCM region.
Yes, i got all the memories regions enabled, arrays mapped.
Code, without tables initialization:
RCC->AHB3ENR |= RCC_AHB3ENR_MDMAEN;
MDMA_Channel0->CCR = 0x00000000;
MDMA_Channel0->CTCR = 0x00000000;
MDMA_Channel0->CTCR |= MDMA_CTCR_DSIZE_1; /*destination data size = 32 bit*/
MDMA_Channel0->CTCR |= MDMA_CTCR_SSIZE_1; /*source data size = 32 bit*/
MDMA_Channel0->CTCR |= MDMA_CTCR_SINCOS_1; /*offset src - 4 bytes*/
MDMA_Channel0->CTCR |= MDMA_CTCR_DINCOS_1; /*offset dst - 4 bytes*/
MDMA_Channel0->CTCR |= MDMA_CTCR_SINC_1; /*inc src by SINCOS*/
MDMA_Channel0->CTCR |= MDMA_CTCR_DINC_1; /*inc dst by DINCOS*/
MDMA_Channel0->CTCR |= MDMA_CTCR_SWRM; /*soft trigger mode*/
MDMA_Channel0->CSAR = 0x20000018; /*src*/
MDMA_Channel0->CDAR = 0x30000000; /*dst*/
MDMA_Channel0->CTCR |= (0x0000000B<<18); /*B+1 bytes*/
MDMA_Channel0->CBNDTR = (0x0000000C)|(0x00000001<<20); /*1 block test*/
MDMA_Channel0->CCR |= MDMA_CCR_EN;
MDMA_Channel0->CCR |= MDMA_CCR_SWRQ; /*transfer trigger*/
Any ideas?...