2022-10-23 11:35 PM
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.
2022-10-23 11:47 PM
are you using CubeMX?
Maybe there is something wrong about your DMA+ADC initialization
2022-10-23 11:53 PM
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.
2022-10-24 12:50 AM
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
2022-10-24 12:52 AM
That is an interesting idea. Thanks.
2022-10-24 02:02 AM
>>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).
2022-10-24 02:08 AM
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.