2020-04-14 06:57 AM
So I wanted to use a single DMA with the Dual regular simultaneous ADC mode on a NUCLEO-L476RG. However I noticed that just the master ADC value was present in the buffer of the DMA, even though the Data width of the DMA is set to Word.
After some investigation, I found that in the file stm32l4xx_hal_msp.c in the function HAL_ADC_MspInit, automatically generated by STMCubeMX:
hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
Changing manually DMA_PDATAALIGN_HALFWORD to DMA_PDATAALIGN_WORD is working, but I wanted to know if there is an option in STMCubeMX to configure that ?
FYI here is the parameters I set in STMCubeMX v5.6.0-RC6:
2020-04-14 08:43 AM
Hello @GDuc.1 ,
You just need to change the Data width to Word,
Best Regards,
Khouloud
2020-04-14 08:46 AM
Hi @GDuc.1
PeriphDataAlignment generated in the code is none other than data width for peripferal.
MemDataAlignment data width for memory , configured from DMA table and not ADC
So, the answer is Yes, you can do the configuration from DMA table.
Best regards,
Nesrine