I have a STM32U5G9 based board. I use 2 ADCs, ADC1 and ADC2 in independent mode.
I need to measure changing voltages with a lot digital noise filtering. I achieve this by setting ADC to sample the signal to a memory buffer via DMA, then averaging the noise, and if the average shows significant difference from the previous run - a notification is sent to the program to react.
The basic idea is simple - read data from ADC continuously, so - I used circular buffer.
After fixing the last HAL package issue with removed `HAL_PWREx_EnableVddA()` call (I added the call, it's necessary for the ADC to work), I managed to have my setup up and running.
However, the problem starts when I stop the conversion, and then want to start it up again. So:
`HAL_ADC_Start_DMA` call - passes with `HAL_OK`.
`HAL_ADC_Stop_DMA` call - passes with `HAL_OK`.
But then again `HAL_ADC_Start_DMA` call - fails with `HAL_ERROR`, and as I figured out, internally `ADC_Enable` function fails with a time out. That just tells me nothing. I read STM32 forum thread about very similar issue that turned out to be VddA missing. The problem I get is identical behavior, but the VddA is OK, and the problem is triggered not at the first ADC start, but after the ADC is restarted. BTW, I start, stop, then start again it manually. There is plenty of time between those operations.
What I already tried was completely deinitializing the ADC1 with `HAL_ADC_DeInit` after stopping and reinitializing it with `HAL_ADC_Init` before starting again. It didn't help. I tried to use `HAL_ADCEx_RegularStop_DMA` instead of `HAL_ADC_Stop_DMA`, I even tried to use both. Nothing helps. When I try to stop continuous conversion, the ADC cannot be enabled again, the only way to make it work ever again is to power-cycle the MCU or use the reset button.
That is a very serious problem to me, because my device's new version uses only one ADC with changing regular conversion group to measure 2 different voltages. The point is - I don't need to have it done simultaneously, I use one at a time, so I really need only one ADC with 2 inputs. However, I have different sampling rates, filtering and buffer sizes for the signals, so in order to switch my measurements I need to stop ADC, change regular conversion group setup, switch the buffer and start the ADC circular DMA again. However, currently I see I can only start my ADC only once in the application life time, it doesn't start after being stopped.
Please help me. I don't know what to do next with this issue.