AnsweredAssumed Answered

Can't get the STM32H753 ADC to work with DMA in cubemx

Question asked by Martin Sigrand on Apr 19, 2018
Latest reply on Apr 20, 2018 by Clive One

I try to configure ADC + DMA continues cicrcular mode for a H753eval board with CubeMX but with no success.

 

The example en.stm32cubeh7\STM32Cube_FW_H7_V1.2.0\Projects\STM32H743I_EVAL\Examples\ADC\ADC_DMA_Transfer works perfect but as I have started using cubemx for my other peripherals I would like to stay with cubemx, but I don't get it to work with the ADC+DMA.

Now I have backed to a completely clean project for a 753XI, only configured ADC1_IN0 and RCC(25MHz->400MHz sysclk and 18.75MHz ADC clk).

When I run it as ADC con't mode without DMA

and add the following to my main.c, everything works.

 

#include "main.h"
#include "stm32h7xx_hal.h"

ADC_HandleTypeDef hadc1;

uint16_t adcData;
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_ADC1_Init(void);

int main(void)
{
HAL_Init();

SystemClock_Config();

MX_GPIO_Init();
MX_ADC1_Init();
HAL_ADC_Start(&hadc1);
while (1)
{
adcData = HAL_ADC_GetValue(&hadc1);

 

But when I change ADC1 config in cubemx to:

 

added a DMA1 stream0, with circular mode and changed the rows in my code to:

 

ALIGN_32BYTES (static uint16_t adcData[32] );

HAL_ADC_Start_DMA(&hadc1,(uint32_t*)adcData,32)

and no code in main()

 

Nothing works! If a check adc.dr register with the debugger it only takes one value at start-up and nothing more.

I've also fiddled with the Conversion Data Management mode as that parameter is a little unclear to me, circular mode is set in the DMA tab as well and the youtube clips I have seen is using older parts/version which doesn't have that setting.

 

I've also tried for hours to compare the code generated with the one in the Project/__ /Example to find the problem but without success.

 

using cubemx 4.25.0

 

Some ideas anyone??

Thx / Martin

Outcomes