Skip to main content
Harish1
Associate III
July 22, 2021
Solved

Changing of ADC control and configuration bits of STM32L475

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,0693W00000D0LHeQAN.png 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?

This topic has been closed for replies.
MasterT
MasterTBest answer
Lead II
July 23, 2021
  1. Yes, doc is highly likely wrong. There is still a chance, that comments and logic how LL_ / HAL_ drivers were written, could be erroneous.
  2. The issue is not only with stm32L47x series, but much wider, potentially ALL stm32 series of uCPU.
  3. Strange things, nobody notice this mistake in Ref. Manual for a years.
  4. 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.)

12 replies

TDK
July 22, 2021

> 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.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Harish1
Harish1Author
Associate III
July 22, 2021

Please find the attached image. The sampling time is updating after checking whether ADC disabled or not.0693W00000D0LljQAF.png

TDK
July 22, 2021

Seems like a bug. Is this in the HAL/LL driver (if so, which file) or CubeMX generated code? I could not locate it.

"If you feel a post has answered your question, please click ""Accept as Solution""."
MasterT
Lead II
July 22, 2021

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.

Harish1
Harish1Author
Associate III
July 23, 2021

So, you are also confusing about it.

Can you tell whether the document is wrong?

MasterT
MasterTBest answer
Lead II
July 23, 2021
  1. Yes, doc is highly likely wrong. There is still a chance, that comments and logic how LL_ / HAL_ drivers were written, could be erroneous.
  2. The issue is not only with stm32L47x series, but much wider, potentially ALL stm32 series of uCPU.
  3. Strange things, nobody notice this mistake in Ref. Manual for a years.
  4. 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.)
ST Technical Moderator
July 30, 2021

​Hello Harish,

Thanks for your reported issue.

It seems there is a typo with the docs and the LL/HAL libraries should be correct.

Your feedback is raised internally for correction.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks