2024-09-02 07:17 AM
I am trying to use ADC with DMA on STM32H743XI. I set up ADC1 IN7~IN9 and use three uint16_t to store their converted values. I use DMA2 Stream 0 to transfer data. CPU ICache and DCache as well as MPU are disabled. ADC Clock Mux is set to PLL2P 50MHz. SYSCLK is set to 480MHz. I also set up a USART1 to print results.
Below are some other settings on STM32CubeMX:
ADC settings:
ADC DMA settings:
This is how I define the result array:
uint16_t ADC_Values[ADC_N_CHANNELS] __attribute__((section(".ARM.__at_0x24000000")));
where `ADC_N_CHANNELS` is 3.
After initializing peripherals, I add the code below to the main function above the infinite while loop:
HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED);
HAL_ADC_Start_DMA(&hadc1, (uint32_t *)ADC_Values, ADC_N_CHANNELS);
In the while loop I print the values of `ADC_Values` and delay for a sec. But it seems that the values of the array are always over 10,000, which are obviously abnormal. What's wrong with it? Any help will be highly appreciated.
2024-09-02 07:25 AM
Hello,
I think you need to give more details and more code or if possible to attach your project.
2024-09-02 07:30 AM
> But it seems that the values of the array are always over 10,000, which are obviously abnormal.
Why would that be obvious?
What is connected to the respective pins?
What hardware are you using, a "known good" board like Nucleo/Disco, or your own?
How are those pins set (i.e. read out and check/post relevant GPIO registers content)?
JW