/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Incorrect battery voltage for Primer1

Username:     
Password:     
             

Forum

# 1   2010-01-24 11:58:22 Incorrect battery voltage for Primer1

neogir
New member
Registered: 2009-12-08
Posts: 9

Incorrect battery voltage for Primer1

Primer1. OS 3.8
In Config/Test BAT=1.24V.  When R35 is shortened, BAT=2.47, so I may guess you have forgot  about  R35:R14 in OS code (sorry if it is documented anywhere but I missed).

Also, it seems the charging level is always shown as 100%. Regardless to the real bat state.

Offline

 

# 2   2010-01-25 08:01:47 Incorrect battery voltage for Primer1

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: Incorrect battery voltage for Primer1

What is the real voltage (measured) of your battery ?

Offline

 

# 3   2010-01-25 08:24:53 Incorrect battery voltage for Primer1

neogir
New member
Registered: 2009-12-08
Posts: 9

Re: Incorrect battery voltage for Primer1

About 2.5V when Primer is on. Some dozen mV more when off.  Internal Test shows half of the real voltage. In correspondence with the ADC pin27 input voltage from R35:R14.

Offline

 

# 4   2010-01-26 10:12:27 Incorrect battery voltage for Primer1

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: Incorrect battery voltage for Primer1

Hi,

What is the version of your pcb Primer, and what resitor values do you have (R35 and R4) ?

Offline

 

# 5   2010-01-26 11:16:53 Incorrect battery voltage for Primer1

neogir
New member
Registered: 2009-12-08
Posts: 9

Re: Incorrect battery voltage for Primer1

Sorry, i misprinted, of course, R35:R4.
PCB v1.2. Both resistors are 1M (as printed on them 10^5). But in this case it is not matter though.
While meausuring by multimeter (ground at J3.1, ADC voltage at common point of  R35:R4 or  pin U1.27 ), voltage is 0.86V (due to multimeter resistance of some MOhms), both multimeter and Primer show the correct value of 0.86V. If R35 is shortened, ADC starts to display the correct battery voltage smile.

Offline

 

# 6   2010-01-26 12:56:39 Incorrect battery voltage for Primer1

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: Incorrect battery voltage for Primer1

You're right.
It's seems that there is a display bug from the beginning, but not present on Primer2 !
Sorry.

Offline

 

# 7   2010-01-26 17:26:59 Incorrect battery voltage for Primer1

neogir
New member
Registered: 2009-12-08
Posts: 9

Re: Incorrect battery voltage for Primer1

I am not so interested in Circle OS, but just  have had a look into the OS source code.

...

    vbat = 0;
    for ( i = 0; i < ADC_NB_SAMPLES; i++)
        {
        vbat += ADC_ConvertedValue[0 + i*ADC_NB_CHANNELS];
        }
    vbat = vbat / ADC_NB_SAMPLES;

    vbat = vbat & 0xFFF;
    vbat = ( vbat * VDD_VOLTAGE_MV ) / 0x1000;

#ifdef PRIMER2
    vbat *= 2; //Divider bridge  Vbat <-> 1M -<--|-->- 1M <-> Gnd,
#endif

...

So, I may guess some previous versions of  Primer1 do not have the R35:R4 divider, and for my Primer1  code line

vbat *= 2;

should be free of any #ifdef condition at compile time.

Offline

 

# 8   2010-01-27 08:09:44 Incorrect battery voltage for Primer1

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: Incorrect battery voltage for Primer1

Be careful, the vbat data is used at several places (main page display, battery presence detection...).

Offline

 

# 9   2010-01-27 09:35:49 Incorrect battery voltage for Primer1

neogir
New member
Registered: 2009-12-08
Posts: 9

Re: Incorrect battery voltage for Primer1

I'll do my best smile
Have bought Primer1 just to investigate Cortex-M3 and peripherals, f.e. 3D accelerometer. Personally I'm interested in ARMv7 assembler language, so do know what  does "be carefull" mean.  Very soon your nice device will be modified, upsoldered, and so on. May be it ends up too soon, in my hands.

Offline

 

Board footer