cancel
Showing results for 
Search instead for 
Did you mean: 

How to read two adc channels in stm32 g071?

RShre.2
Associate III

I saw a similar post here that is related to my problem. But unlike in this post, I want to read to adc channel inside a timer interrupt which has a sampling rate of 50KHz. How do I do it? I tried following this post and but adding start and stop adc insider the timer didn't work. The timer interrupt stopped working. So, is there any other way around or what is it that I am doing wrong? I don't have a code sample for this particular problem at the moment but if anyone could help me get started, I'd appreciate your help. 

12 REPLIES 12

In fact, in order to obtain greater performance, it is necessary to opt for baremetal code, the HAL code can serve as a basis for knowing which registers are used, but since it is a generic code to meet several options, it usually has many forks, which makes the code very slow.

Thanks for the suggestion. For now, somehow, I got the result. Hopefully, this won't change. I just changed the adc channel. @RhSilicon  @GwenoleB 

 

Edit: Seems like it's reading the opposite way. Will try to update here if I fix the problem. 🙂

Hello @RShre.2 ,
Keep me in touch!
From my test yesterday, I just noticed a delay from 3.8µs to 5.4µs between the trigger of TIMER (50kHz) and the end DMA transfer.
As @RhSilicon mentioned, this delay can be shrink using LL or baremetal. However the acquisition data (meaning DMA transfer) has a 50kHz frequency. Just a delta between TIM and DMA transfer.

Best Regards,

Gwénolé