Changing of ADC control and configuration bits of STM32L475
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-22 5: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.
- There is no register with the name ADC_OFCHRy, but here mentioned.
Are the above are bugs in the manual?
Solved! Go to Solution.
- Labels:
-
ADC
-
STM32L4 series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-23 5:55 AM
- Yes, doc is highly likely wrong. There is still a chance, that comments and logic how LL_ / HAL_ drivers were written, could be erroneous.
- The issue is not only with stm32L47x series, but much wider, potentially ALL stm32 series of uCPU.
- Strange things, nobody notice this mistake in Ref. Manual for a years.
- I'm sure, there are more errors in doc. , as well as in software, no points to wait when RM gonna be corrected. (I'm not affiliated with ST, have no idea how long this could take.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-22 6: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-22 6:16 AM
Please find the attached image. The sampling time is updating after checking whether ADC disabled or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-22 6: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-22 6:50 AM
This file is generated from the CubeMx generated code only for STM32L475.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-22 7:10 AM
I am also confused, and my changes are as per the existing manual description and facing issues then I found it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-22 7:20 AM
CubeMX generated code, especially with LL libraries, is generally much worse quality than HAL/LL itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-22 7: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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-22 9:01 PM
So, you are also confusing about it.
Can you tell whether the document is wrong?
