2024-12-15 06:43 PM - last edited on 2024-12-15 11:59 PM by SofLit
I want to do ADC with 5 channels using STM32 Nucleo-144 development board with STM32F722ZE MCU.
I can collect data by DMA, but I can only get data from in0~in2.
Finally, I want to get ADC data from 5 channels at 1kHz using timer interrupt.
This is my first time using an MCU and I am not very familiar with it, so I need your help.
Attached is the main.c file.
(I am using a translator)
2024-12-16 08:06 AM
Hello,
here I am sending a similar example for STM32C0, you should find the right settings for your purpose here. This example code periodically (1kHz) read all analog inputs and each values writes to memory by DMA and periodically print read values from memory to usart.
ADC was configured:
- All inputs except IN2, IN3 (pins used by usart), Temperature sensor, Vrefint Channel, VDDA Channel, VSSA Channel
- 8 bit resolution
- DMA Continuous Requests Enabled
- External trigger conversion source as Timer 3 Trigger Out event
- Other configurations stay as defaults
- DMA mode circular, Peripheral to memory, Data Width as Byte
TIM3 is configured as:
- Clock Source as Internal Clock
- Counter Period to 47 999
- Trigger Event Selection TRGO as Update Event
SYSCLK was configured to 48 MHz
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-12-16 06:03 PM
Thanks for the advice ....
My words were insufficient.
When I said I wanted to collect 5 channels of ADC at 1 kHz, I meant I wanted to collect 10,000 pairs of 5 channel data at 1 kHz.
In other words, I want to collect 10 seconds of data by ADCing 5 channels at 1 kHz.
Therefore, even if DMA Continuous Requests are enabled, 10 seconds of data cannot be collected.
I think I can get 10 seconds of data by doing 10000 times of HAL_ADC_Start_DMA() with a buffer of 5 by interrupting with a timer of 1kHz. Am I wrong in my thinking? (Using translator)