How to read two adc channels in stm32 g071?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-07-30 9:17 AM - edited 2023-07-31 12:55 AM
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.
- Labels:
-
STM32G0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-07-31 3:19 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-07-31 3:27 AM - edited 2023-07-31 4:19 AM
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. :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-08-01 2:16 AM
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é

- « Previous
-
- 1
- 2
- Next »