cancel
Showing results for 
Search instead for 
Did you mean: 

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

SMisi
Associate II

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.

6 REPLIES 6
Javier1
Principal

are you using CubeMX?

Maybe there is something wrong about your DMA+ADC initialization

we dont need to firmware by ourselves, lets talk
SMisi
Associate II

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.

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

That is an interesting idea. Thanks.

>>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).

we dont need to firmware by ourselves, lets talk

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.