2021-10-30 09:50 AM
I want to run the ADC using DMA and Dual mode.
The sampling rate was set to 80kS / s using TIM3. The board I am using is Nucleo 64 STM32 F446.
In order to confirm whether the ADC is really running at 80kS / s, I described "HAL_GPIO_TogglePin" in "DMA2_Stream0_IRQHandler (void)" and confirmed it by observing the pulse width with an oscilloscope.
As a result, it was found that the ADC is running at about 660us (1.5kHz in frequency). (According to the data sheet, the STM used can have a maximum sampling rate of 2.4 MS / s.)
Why doesn't my program get the sampling rate I set?
My program only runs the ADC and does nothing else.
Our development environment
win10
STM32CubeIDE Ver1.6.1
Board used: Nucleo64 STM32F446
Thank you for your reply.
2021-10-30 10:55 AM
How is printf implemented? It could be blocking execution.
2021-10-30 05:08 PM
Thank you for your answer
printf is implemented as follows.
Also, the buffer setting was missing, so I added it.
Also, when the printf described in stm32f4xx_it.c was deleted, the pulse width became 122us (8.2kHz).
Sorry to trouble you, but thank you for your reply.
2021-10-30 05:24 PM
A blocking call in the IRQ handler will certainly cause issues.
Your post mentions you were expecting 80kS/s, but your timer settings indicate 8kS/s.
90 MHz / 11252 = 8kHz, so all is as expected right?
2021-10-30 06:09 PM
I'm sorry.
Fixed 11252 to 1125.
As a result, the DAM interrupt was generated only once, and then no interrupt was generated. (printf has been deleted.)
This phenomenon was confirmed by setting a breakpoint in HAL_GPIO_TogglePin (GPIOA, GPIO_PIN_5) of the first image "stm32f4xx_it.c". Immediately after the program starts, break only once with HAL_GPIO_TogglePin (GPIOA, GPIO_PIN_5). After that, if you press the resume button, it will not break.
Thank you for your reply.
2021-10-30 06:19 PM
2021-10-30 06:31 PM
Thank you for taking the time.
When I run the program without setting a breakpoint, the pin output toggles only once and there is no change thereafter.
I don't know why it works on 1125 but not on 11252.
I have set the sampling time to 56 cycles, is this too large?