2021-03-10 08:51 AM
The first one is a minor typo I guess. The init code for the ADC has these lines in it:
/* Enable ADC internal voltage regulator */
LL_ADC_EnableInternalRegulator(ADC);
/* Delay for ADC internal voltage regulator stabilization. */
/* Compute number of CPU cycles to wait for, from delay in us. */
/* Note: Variable divided by 2 to compensate partially */
/* CPU processing cycles (depends on compilation optimization). */
/* Note: If system core clock frequency is below 200kHz, wait time */
/* is only a few CPU processing cycles. */
uint32_t wait_loop_index;
wait_loop_index = ((LL_ADC_DELAY_INTERNAL_REGUL_STAB_US * (SystemCoreClock / (100000 * 2))) / 10);
while(wait_loop_index != 0)
{
wait_loop_index--;
}
The first line should be:
LL_ADC_EnableInternalRegulator(ADC1);
And the other bug happens when you select both the internal temperature sensor AND the vrefint on the ADC.
This does not work:
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_TEMPSENSOR);
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_PATH_INTERNAL_TEMPSENSOR);
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_VREFINT);
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_PATH_INTERNAL_VREFINT);
but this does:
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_TEMPSENSOR);
LL_ADC_REG_SetSequencerChAdd(ADC1, LL_ADC_CHANNEL_VREFINT);
LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(ADC1), LL_ADC_PATH_INTERNAL_TEMPSENSOR | LL_ADC_PATH_INTERNAL_VREFINT);
This bug was already mentioned two years ago by kurta999 in this question:
2021-03-10 10:03 AM
Hello @Community member ,
Thanks for your reported issues.
I added the right topic "STM32CubeMX" in your post to be reviewed by our CubeMX experts @Khouloud OTHMAN , @Khouloud ZEMMELI.
Imen
2021-03-11 01:10 AM
Hi @Community member ,
Thanks for your feedback.
For the first issue you have reported, I can't reproduce it from my side, LL_ADC_EnableInternalRegulator(ADC1) is correctly generated in CubeMX generated code.
Could you please share your .ioc file to investigate the problem ?
For the second point you have raised:
> And the other bug happens when you select both the internal temperature sensor AND the vrefint on the ADC
The problem is already detected and reported to our development team to be reviewed. I will come back to you as soon as possible with updates.
Thank you for your patience.
Khouloud.
2021-03-11 02:22 AM
Hello Khouloud,
Thanks for your reply. The problem with the line LL_ADC_EnableInternalRegulator(ADC1) is solved in the latest firmware FW_L0 V1.12.0 .
I noticed that after re-opening the .ioc file STM32CubeMX wanted to upgrade. After letting it do that, it now produces the correct code.
Odd though, is that I do not see that it does upgrade the firmware, see picture.
Wilko
2021-03-11 03:24 AM
Hi @Community member ,
First let me thank you for the correction of the first problem confirmation :smiling_face_with_smiling_eyes:
To explain briefly the message behind this warning popup: On project load, STM32CubeMX detects if the project was created with an older version of the tool and if this is the case, it proposes the user to either migrate to use the latest STM32CubeMX database and STM32Cube firmware version, or to continue.
You can select continue to use original firmware used at project creation and in this case it will downloaded into your repository as well as the MCU and IPs database, or you can select migrate, and in this case your project will be modified to fit the current database definition.
>Odd though, is that I do not see that it does upgrade the firmware, see picture.
It is a bit odd that this warning window is displayed while working with latest version of firmware. The expected behavior is as in the picture attached below (two different versions of firmware):
Could please describe how did you reproduce to get this pop up? It will be really helpful for us to track the root cause of this misbehavior.
Thanks in advance,
Khouloud.
2021-03-11 03:47 AM
Hello Khouloud,
To reproduce the pop-up I just have to double-click the .ioc file, after having upgraded STM32CubeMX to the latest firmware.
Maybe a little background on how I use STM32CubeMX and STM32CubeIDE might help...
I'll add the not migrated .ioc file to this message, you will no doubt have the FW-L0 V1.12.0 loaded, so just doubleclick the .ioc file and the pop-up (hopefully) will appear.
Thanks for your support,
Wilko