Parallel transmission using GPIO and DMA (like AN4666)
Hi,
I would like to send parallel byte data from STM32H743 using DMA, e. g. using Port G0...G7, using a timer to define the cycling (e. g. TIM3.CH2).
For STM32L and STM32F4 this is described in AN4666 I think. I did this already on STM32F4, there it seemed to be quite straight forward.
I used the following code:
DMA1_Stream7->CR= (0 << DMA_SxCR_MBURST_Pos) |
(0 << DMA_SxCR_PBURST_Pos) |
(0 << DMA_SxCR_DBM_Pos) |
(2 << DMA_SxCR_PL_Pos) |
(2 << DMA_SxCR_MSIZE_Pos) |
(2 << DMA_SxCR_PSIZE_Pos) |
(1 << DMA_SxCR_MINC_Pos) |
(0 << DMA_SxCR_PINC_Pos) |
(0 << DMA_SxCR_CIRC_Pos) |
(1 << DMA_SxCR_DIR_Pos) |
(0 << DMA_SxCR_PFCTRL_Pos);
// 24= TIM3_CCR2
// 27= TIM3_UP
DMAMUX1_Channel7->CCR= (24 << DMAMUX_CxCR_DMAREQ_ID_Pos);
DMA1_Stream7->M0AR=(DWORD)&adwDmaDebug;
DMA1_Stream7->PAR= (DWORD)&GPIOG->ODR;
DMA1_Stream7->FCR= 0;To start the DMA sequence with 32 words, I use the following:
DMA1_Stream7->NDTR= 32;
DMA1_Stream7->CR |=(1 << DMA_SxCR_EN_Pos);
TIM3 Ch2 is configured in a basic PWM mode to give out 1Hz (I tried also with 1MHz - later I want to use 1MHz, but I thought I start with a slow frequency).
If I do this, NDTR will decreas to 31, and then DMA1->HISR register shows always 0x00400000 (DMA-Fifo error for Stream7), and nothing more happening (NDTR NOT decreasing further... but Timer ch2 pin running nicely with 1Hz, and DMA-Fifo is not used in my code, as I use direct mode... so NO Fifo ... I tried also with other FCR_FCH settings, also with other MSIZE/PSIZE values, but NO success ... ).
Just one thing IS happening: The ODR will switch from my Init value 0xFF to zero. But this "zero" does NOT depend on my memory location value ... If I put 0x03030303 in the memeory, anyway I get zero in the GPIOG->ODR.
I put the adwDmaDebug to "32-Byte-aligned" address in the range 0x24000000 ... . This should be fine for DMA?