Skip to main content
SMisi
Associate II
October 24, 2022
Question

Is there a way to tell whether ADC is busy? (STM32F303ve)

  • October 24, 2022
  • 6 replies
  • 1860 views

I am trying to reconfigure DMA without losing samples and without stopping the ADC, which is triggered using timer (relatively rarely), so my plan was to look whether both the ADC and DMA are idle and quickly reconfigure DMA before ADC even starts to convert anything. There should be enough time, since I have quite long sampling time. However, going through reference manual it seems that no ADC status bit will help me with that. ADRDY seems to be set only once, after the ADC finishes enabling and EOC/EOS are set as a response to an event of finishing the action, so none seems to tell me the current status of the ADC. Am I missing something? Thank you.

This topic has been closed for replies.

6 replies

Javier1
Principal
October 24, 2022

are you using CubeMX?

Maybe there is something wrong about your DMA+ADC initialization

hit me up in https://www.linkedin.com/in/javiermuñoz/
SMisi
SMisiAuthor
Associate II
October 24, 2022

Oh I did not express my intent correctly, perhaps. There is nothing wrong with the setup, it works fine, I just needed to reconfigure DMA from time to time (not even necessarily at exact point in time) as part of my application. Thanks for the answer.

Javier1
Principal
October 24, 2022

>>so my plan was to look whether both the ADC and DMA are idle and quickly reconfigure DMA before ADC even starts to convert anything

What about triggering the DMA reconfiguration with the Conversion complete interrption handler (after handling everything else).

hit me up in https://www.linkedin.com/in/javiermuñoz/
SMisi
SMisiAuthor
Associate II
October 24, 2022

That is a good Idea, especially with end-of-sequence interrupt. However If I were to handle these interrupts, that would negate almost all benefits of using DMA.

waclawek.jan
Super User
October 24, 2022

I don't think there is some straightforward way to find out the current ADC conversion state if triggered from timer. So you have to go for indirect methods. How about reading the timer's CNT and judge from it whether ADC conversion is under way?

JW

SMisi
SMisiAuthor
Associate II
October 24, 2022

That is an interesting idea. Thanks.