cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G4XX ADC: for LL driver, part of initialization hardcoded to ADC1

GLi.3
Associate

To reproduce: generate a project using ADC3 with the LL driver on STM32CubeMX 6.0.1.

Issue: regardless of which ADC is used, this shows up in MX_ADCx_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);

The issue appears to stem from db/mcu/config/llConfig/ADC-STM32G4xx_LLConfigs.xml:

         <CallLibMethod Name="" Type="HardCode">
		<HardCode Text="
  #n#t/* Disable ADC deep power down (enabled by default after reset state) */
  #n#tLL_ADC_DisableDeepPowerDown(ADC1);
    
  #n#t/* Enable ADC internal voltage regulator */
  #n#tLL_ADC_EnableInternalRegulator(ADC1);
    
  #n#t/* Delay for ADC internal voltage regulator stabilization.                */
  #n#t/* Compute number of CPU cycles to wait for, from delay in us.            */
  #n#t/* Note: Variable divided by 2 to compensate partially                    */
  #n#t/*       CPU processing cycles (depends on compilation optimization).     */
  #n#t/* Note: If system core clock frequency is below 200kHz, wait time        */
  #n#t/*       is only a few CPU processing cycles.                             */
  #n#tuint32_t wait_loop_index;                  
  #n#twait_loop_index = ((LL_ADC_DELAY_INTERNAL_REGUL_STAB_US * (SystemCoreClock / (100000 * 2))) / 10);
  #n#twhile(wait_loop_index != 0)
  #n#t{
  #n#t#twait_loop_index--;
  #n#t}"
                />
	</CallLibMethod>

It appears that ADC1 is hard-coded into the config XML file. I have to manually edit the code to ADC3 after generation to fix this issue.

2 REPLIES 2
Amel NASRI
ST Employee

Hi @GLi.3​ ,

Unfortunately your post was missed simply because it was misplaced under Bug-report topic. There are more opportunities to review it if you used topics STM32CubeMX and STM32G4.

Any way, for this one: I report it to our development team in order to take relevant corrective actions.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello GLi.3,

Sorry for the inconvenience, it is a known issue and it has been already reported to STM32CubeMX development team to be fixed. The fix will be available in the future release. Thanks for your patience.

Regards,

Khouloud.