Project

General

Profile

embello-master/explore/1608-forth/flib/stm32f1/adc.fs

Added by earl over 1 year ago

I am checking VREF on an STM32F103C8T6 using this word:

: adc-vcc ( -- mv ) \ return estimated Vcc, based on 1.2V internal bandgap
3300 1200 17 ADC1-SQR3 ! adc-once */ ;

however it does not produce values anywhere close to 3.3 V which it should be?

I am using this instead and it returns 'expected' values:

: adc-vcc ( -- mv) \ return estimated Vcc, based on 1.2V internal bandgap
1200 4096 * 17 ADC1-SQR3 ! adc-once / ;

it is based on the 'C' code from here: http://www.stm32duino.com/viewtopic.php?t=707
which works too.

So it the embello-master/explore/1608-forth/flib/stm32f1/adc.fs adc-vcc code wrong or is there something I am missing?

Thanks
Earl


Replies (1)

RE: embello-master/explore/1608-forth/flib/stm32f1/adc.fs - Added by jcw about 1 year ago

Ah, yes, looks like it's wrong... I think this will give the proper result:

: adc-vcc ( -- mv ) \ return estimated Vcc, based on 1.2V internal bandgap
4096 1200 17 ADC1-SQR3 ! adc-once */ ;

It's the same as your fix, just written differently.
I've updated the embello code, thanks - my apologies for the very late reply!

    (1-1/1)