2022-11-28 04:22 AM
As indicated in community.st.com/s/question/0D53W00000zoHteSAE/h7cubemx-critical-bugs-with-ll-and-adc3 there seems to have been a bug where the resolution wasn't correctly set when working with ADC3.
As of today, the conversion seems to instead be made twice, both in the calling code (generated by CubeMX)
ADC_InitStruct.Resolution = __LL_ADC12_RESOLUTION_TO_ADC3(LL_ADC_RESOLUTION_10B);
ADC_InitStruct.LowPowerMode = LL_ADC_LP_MODE_NONE;
LL_ADC_Init(ADC3, &ADC_InitStruct);
and in the library code
ErrorStatus LL_ADC_Init(ADC_TypeDef *ADCx, LL_ADC_InitTypeDef *ADC_InitStruct)
{
...
#if defined(ADC_VER_V5_V90)
if(ADCx==ADC3)
{
MODIFY_REG(ADCx->CFGR,
ADC3_CFGR_RES
| ADC_CFGR_AUTDLY
,
((__LL_ADC12_RESOLUTION_TO_ADC3(ADC_InitStruct->Resolution) & (ADC_CFGR_RES_1 | ADC_CFGR_RES_0)) << 1UL)
| ADC_InitStruct->LowPowerMode
);
}
else
...
Running the code, ADC3->CFGR is indeed 0x80000000 both before and after LL_ADC_Init() as the incorrectly calculated resolution bits are masked by MODIFY_REG().
(CubeMX v6.6.1 generating code for STM32H723)
EDIT: The problem with the variable for the while-loop not being volatile seems to remain.
2022-11-29 03:46 AM
Hello @Magnus Kristiansen-Modéer
First, let me welcome you to the STM32 Community :) and thank you for having reported this issue.
I will escalate this issue along to our development team for fix.
Thanks
Imen
2022-11-29 05:49 AM
Hi @Magnus Kristiansen-Modéer ,
Can you please confirm that you are using latest release of STM32CubH7 MCU package?
Imen
2022-11-30 07:49 AM
I wasn't then but have now upgraded to STM32Cube_FW_H7_V1.11.0 and CubeMX 6.7.0 and it's still the same.
2022-12-01 12:31 AM
Hi @Magnus Kristiansen-Modéer,
I recommend you update the latest release of STM32CubeH7 and STM32CubeMx.
This issue is fixed since STM32CubeMX-6.4.0 and CubeH7 version V1.9.1
As mentioned in the release note of STM32CubeH7:
HAL/LL ADC:
When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.
Imen
2022-12-01 02:15 AM
But I just told you that it still happens with CubeMX 6.7.0 and CubeH7 1.11.0 (and I said in my inital post that I used CubeMX 6.6.1 then).
2022-12-01 02:34 AM
Sorry, I haven't seen your last comment.
I will check this internally and come back to you soon.
Thanks for your understanding.
Imen
2022-12-02 12:27 AM
> I haven't seen your last comment.
But you pressed "Reply" on that specific comment...
2023-04-17 01:11 AM
Any updates on this?