2020-08-20 08:39 AM
I am prototyping some code on a Nucleo-144 board with a STM32H745 on it. I had a project that was working at a slow speed using the HAL driver for everything, but when I tried to run it faster, it could not keep up. So I decided to pursue using the LL driver for the Timers, ADC, and DMA in an effort to streamline the code. After working out changing the HAL code needed for starting things up over to LL code (which was not as trivial as I was hoping), I was not getting the ADC data from ADC3 that I was expecting, just all half-scale. I thought maybe I had missed something in the start up code and spent time directly converting the HAL code I was using that worked to LL code with as few changes as I could. But that still did not work.
I finally started looking through the generated code to see if there was any initialization that was missing. Then I noticed this in MX_ADC3_Init:
/* Disable ADC deep power down (enabled by default after reset state) */
LL_ADC_DisableDeepPowerDown(ADC1);
/* Enable ADC internal voltage regulator */
LL_ADC_EnableInternalRegulator(ADC1);
So for ADC3 initialization it was turning on ADC1 instead. I only have ADC3 enabled in the project. Changing the 1s to 3s got it to work correctly. But I have to change this any time I regenerate the code in CubeMX.
I am using STM32CubeIDE 1.4.1, CubeMX 6.0.0, STM32H7 Firmware Package 1.8.0
Looks like there is a 1.4.2/6.0.1 update available now. Will check if this is still an issue there.
Edit: No difference in 1.4.2/6.0.1
2020-08-26 02:11 AM
Hello JBerry,
Thanks for your post. The point you raised will be internally reviewed and fixed, we will give you an update asap.
BR,
Khouloud.
2020-08-27 06:33 PM
This bug is also present in all STM32G4 MCUs, in that the code generated using the LL ADC driver enables ADC1 instead of the desired ADC.