cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L0x3 and STM32L0x2 - ADC_SMPR confusion

Andrew Neil
Evangelist III
Posted on December 01, 2017 at 17:55

References:

STM32L0x3 - RM0367, Rev 5

STM32L0x2 - RM0376, Rev 4

In both cases, the description of ADC sampling time register (ADC_SMPR) says,

Bits 2:0 SMP[2:0]: Sampling time selection

These bits are written by software to select the sampling time that applies to all channels.

000: 1.5 ADC clock cycles

001: 3.5 ADC clock cycles

010: 7.5 ADC clock cycles

011: 12.5 ADC clock cycles

100: 19.5 ADC clock cycles

101: 39.5 ADC clock cycles

110: 79.5 ADC clock cycles

111: 160.5 ADC clock cycles

But, in both cases, the code examples say,

(4) Select a sampling mode of

111 i.e. 239.5 ADC

clk

So which is it - 160.5 samples, or

239.5

samples??

https://community.st.com/message/75668

, from March 2015, quotes 

RM0367, v2 :

RM0367, v2, section 14.13.6 lists the following possible sample time:

1.5, 7.5, 13.5, 28.5, 41.5, 55.5, 71.5, 239.5.

https://community.st.com/message/75668

 

I don't see anything mentioned in the Revision Record...

#stm32l0x2 #adc-sample-cycles #adc_smpr #adc #adc-sampling-time #stm32l0x3
4 REPLIES 4
Andrew Neil
Evangelist III
Posted on December 01, 2017 at 18:24

I found an old Rev 2 copy of RM0367 - and it does, indeed, say:

Bits 2:0 SMP[2:0]: Sampling time selection

These bits are written by software to select the sampling time that applies to all channels.

000: 1.5 ADC clock cycles

001: 7.5 ADC clock cycles

010: 13.5 ADC clock cycles

011: 28.5 ADC clock cycles

100: 41.5 ADC clock cycles

101: 55.5 ADC clock cycles

110: 71.5 ADC clock cycles

111: 239.5 ADC clock cycles 

http://www.mouser.com/ds/2/389/DM00095744-337294.pdf

  

So was that a chip revision?

Or an error in the earlier document, that's been partially fixed?

Or an error that's crept into the new document?

Posted on December 04, 2017 at 23:37

Andy,

The first is unlikely; both of the second two have been seen many times.

Did you try, what is the sampling time in reality? (Yes I know I know it needs to come from ST, but that may take quite long).

Jan

Posted on December 05, 2017 at 16:40

No, I haven't tried it. The timing is not critical for me at the moment, so I have just left it at max.

Given nearly 1000 pages of reference manual, one doesn't expect to have to reverse-engineer the product oneself ...

Posted on March 04, 2018 at 19:41

https://community.st.com/0D50X00009XkfspSAB

- somebody who's name is Andrew too :) , and actually tried before it was fixed in the RM.

JW