Skip to main content
WKhan.2
Associate III
January 3, 2022
Solved

Possibility of enabling and disabling the channels of ADCs during runtime

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

This topic has been closed for replies.
TDK
TDKBest answer
January 3, 2022

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

2 replies

TDK
TDKBest answer
January 3, 2022

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
WKhan.2Author
Associate III
January 12, 2022

Thank you so much for the reply.