2021-07-22 05:21 AM
I have found that from the ref. manual, certain bits of ADC control and configuration bits when ADC enabled but in the drivers provided by the ST showing that they are changing only when the ADC is disabled. For reference, I have attached the screenshot. Please help me understand this topic.
Are the above are bugs in the manual?
Solved! Go to Solution.
2021-07-23 05:55 AM
2021-07-22 06:10 AM
> but in the drivers provided by the ST showing that they are changing only when the ADC is disabled
Can you show an example code that does this? Dont confuse started/stopped with enabled/disabled.
> There is no register with the name ADC_OFCHRy, but here mentioned
Clearly a documentation mistake.
2021-07-22 06:16 AM
Please find the attached image. The sampling time is updating after checking whether ADC disabled or not.
2021-07-22 06:35 AM
Seems like a bug. Is this in the HAL/LL driver (if so, which file) or CubeMX generated code? I could not locate it.
2021-07-22 06:50 AM
This file is generated from the CubeMx generated code only for STM32L475.
2021-07-22 07:10 AM
I am also confused, and my changes are as per the existing manual description and facing issues then I found it.
2021-07-22 07:20 AM
CubeMX generated code, especially with LL libraries, is generally much worse quality than HAL/LL itself.
2021-07-22 07:26 AM
I have not depended on CubeMX generated code and referred from the ref. manual only and there also this mistake is there. Are you believing the highlighted description in the ref. manual is the mistake?
2021-07-22 11:23 AM
Here is from stm32H7-adc driver (don't have stm32L47X installed, should be the same):
/* Parameters update conditioned to ADC state: */
/* Parameters that can be updated when ADC is disabled or enabled without */
/* conversion on going on regular group: */
/* - Channel sampling time */
/* - Channel offset */
Reference manual says:
For all the other control bits of the ADC_CFGR, ADC_SMPRy, ADC_TRy, ADC_SQRy,
ADC_JDRy, ADC_OFRy and ADC_IER registers:
• For control bits related to configuration of regular conversions, the software is allowed
to write them only if the ADC is enabled (ADEN=1) and if there is no regular conversion
ongoing (ADSTART must be equal to 0).
Confusing, SMPRy registers is among "don't care if it's enabled or disabled, as long as no ongoing conversion" ->on sampling time part, but there is one more bit SMPPLUS .
Regarding code snippet attached above, check for ADC_disabled is done because
function LL_ADC_SetChannelSingleDiff is called, and sampling_time just follows even it doesn't matter enabled or disabled.
Not big deal, since setting sampling time w/o SE or DIFF setting doesn't make sense anyway.
2021-07-22 09:01 PM
So, you are also confusing about it.
Can you tell whether the document is wrong?