cancel
Showing results for 
Search instead for 
Did you mean: 

Changing of ADC control and configuration bits of STM32L475

Harish1
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions
  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.)

View solution in original post

12 REPLIES 12
TDK
Guru

> 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
Associate III

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

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

This file is generated from the CubeMx generated code only for STM32L475.

I am also confused, and my changes are as per the existing manual description and facing issues then I found it.

CubeMX generated code, especially with LL libraries, is generally much worse quality than HAL/LL itself.

If you feel a post has answered your question, please click "Accept as Solution".

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?

MasterT
Lead

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.

So, you are also confusing about it.

Can you tell whether the document is wrong?