cancel
Showing results for 
Search instead for 
Did you mean: 

Possibility of enabling and disabling the channels of ADCs during runtime

WKhan.2
Associate II

Hi community members, I have tried to find the answer in the available documentation but could find the exact answer to my query. I have been using STM32-Nucleo-G474RE and I wanted to assign specific channels of ADCs to sensors X and other available channels of the same ADCs to sensors Y. Is it possible to disable and enable the channels from the code during runtime? I was thinking to use an external multiplexer for selecting the channels based on the conditions. Do I really need an external multiplexer or I could enable and disable channels even without it in the software?

Looking forward to the suggestion.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

You can absolutely change the ADC configuration at runtime. When switching, you'll need to stop the current conversion, reconfigure the ADC, then start the new conversions.

If you set up the channels in CubeMX, you can use the code it generates to reconfigure the ADC, although you will need to incorporate this into user code as CubeMX doesn't support dynamic reconfiguration of the ADC.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

You can absolutely change the ADC configuration at runtime. When switching, you'll need to stop the current conversion, reconfigure the ADC, then start the new conversions.

If you set up the channels in CubeMX, you can use the code it generates to reconfigure the ADC, although you will need to incorporate this into user code as CubeMX doesn't support dynamic reconfiguration of the ADC.

If you feel a post has answered your question, please click "Accept as Solution".
WKhan.2
Associate II

Thank you so much for the reply.