Meshtastic

Heltec / lora-32 USB power sensing fixed

Hi ya’ll,

I think I’ve probably fixed this one (will be in this weeks build).

If you have one of these boards (I don’t currently - will again have one in June) and battery charge level is still not working after I make this new release (friday?), please reply in this thread with a serial log of the first 100ish lines after the device boots in the following two configurations:

  • A battery is connected
  • A battery is not connected
2 Likes

Will do!
While you’re at it, there’s still a similar issue on T-Beams. As an example, I have one charging up via USB and the display reports 50% battery level, while the app only reports 46% (and that’s the right value).

Cheers

A post was split to a new topic: Heltec board running 1.1.32 rebooting

Hi! That’s grate news. Would you be so kind and point me where i can find (in the code) new power settings for heltec devices? Today i will try to put here serial log but first have to desolder gps module.

1 Like

Ooh that would be a great help (especially if you can debug it a bit if needed).

A little class called AnalogBatteryLevel does all of it. Line 68

1 Like

Ok, desoldered gps and here are the logs. As far as I can see device does not recognize presence of battery.
First log - without battery:

??:??:?? 0 Filesystem files:
??:??:?? 0   /static/index.html
??:??:?? 0   /static/meshtastic.js.gz
??:??:?? 0   /static/basic.js
??:??:?? 0   /prefs/db.proto
??:??:?? 0   /prefs/radio.proto
??:??:?? 0   /prefs/channels.proto
??:??:?? 0 I2C device found at address 0x3c
??:??:?? 0 ssd1306 display found
??:??:?? 0 done
??:??:?? 0 Meshtastic hwvendor=5, swver=1.2.30.80e4bc6-d, hwver=unset
??:??:?? 0 Setting random seed 3278794362
??:??:?? 0 Total heap: 255292
??:??:?? 0 Free heap: 221216
??:??:?? 0 Total PSRAM: 0
??:??:?? 0 Free PSRAM: 0
??:??:?? 0 NVS: UsedEntries 91, FreeEntries 539, AllEntries 630
??:??:?? 0 Setup Preferences in Flash Storage
??:??:?? 0 Number of Device Reboots: 1992
??:??:?? 0 Initial packet id 1040607764, numPacketId 4294967295
??:??:?? 0 Setting default channel and radio preferences!
??:??:?? 0 Expanding short PSK #1
??:??:?? 0 Wanted region 0, using Unset
??:??:?? 0 Loading /prefs/db.proto
??:??:?? 0 Loaded saved preferences version 11
??:??:?? 0 Loading /prefs/radio.proto
??:??:?? 0 Loading /prefs/channels.proto
??:??:?? 0 Number of Device Reboots: 1992
??:??:?? 0 Expanding short PSK #1
??:??:?? 0 Wanted region 2, using EU433
??:??:?? 0 region=2, NODENUM=0xd1dc6dc4, dbsize=3
??:??:?? 0 Read RTC time as 0 (cur millis 195) quality=0
??:??:?? 0 WANT GPS=1
??:??:?? 0 Setting GPS power=1
??:??:?? 2 ERROR: No UBLOX GPS found
??:??:?? 2 Hoping that NMEA might work
??:??:?? 2 WANT GPS=1
??:??:?? 2 External Notification Plugin Disabled
??:??:?? 2 Turning on screen
??:??:?? 2 Starting meshradio init...
??:??:?? 2 (bw=125, sf=12, cr=4/8) packet symLen=32 ms, payloadSize=16, time 2269 ms
??:??:?? 2 Set radio: name=LongSlow, config=3, ch=2, power=0
??:??:?? 2 Radio myRegion->freq: 433.174988
??:??:?? 2 Radio myRegion->spacing: 0.200000
??:??:?? 2 Radio myRegion->numChannels: 8
??:??:?? 2 Radio channel_num: 2
??:??:?? 2 Radio frequency: 433.574982
??:??:?? 2 Short packet time: 2269 msec
??:??:?? 2 Set radio: final power level=17
??:??:?? 2 RF95 init result 0
??:??:?? 2 RF95 Radio init succeeded, using RF95 radio
??:??:?? 2 PowerFSM init, USB power=1
[D][esp32-hal-cpu.c:189] setCpuFrequencyMhz(): PLL: 320 / 4 = 80 Mhz, APB: 80000000 Hz
??:??:?? 2 [Screen] Screen: Started...
??:??:?? 2 [SerialPlugin] Serial Plugin Disabled
??:??:?? 2 [StoreForwardPlugin] Store & Forward Plugin - Disabled
??:??:?? 2 [RangeTestPlugin] Range Test Plugin - Disabled
Transition powerFSM transition=boot timeout, from=BOOT to=POWER
??:??:?? 5 [PowerFSM] Setting bluetooth enable=1
Pre BT: 209864 heap size
??:??:?? 5 [PowerFSM] Starting bluetooth
??:??:?? 5 [Screen] Done with boot screen...
??:??:?? 5 [Screen] Screen: Powered...
??:??:?? 5 [Screen] showing standard frames
??:??:?? 5 [Screen] Showing 0 plugin frames
??:??:?? 5 [Screen] Total frame count: 35
??:??:?? 5 [Screen] Added plugins.  numframes: 0
??:??:?? 5 [Screen] Finished building frames. numframes: 3
??:??:?? 5 [Screen] Setting fast framerate
??:??:?? 6 [Screen] BLE task running
??:??:?? 6 [Screen] registered service 0x1800 with handle=1
??:??:?? 6 [Screen] registered service 0x1801 with handle=6
??:??:?? 6 [Screen] registered service 6ba1b218-15a8-461f-9fa8-5dcae273eafd with handle=10
??:??:?? 6 [Screen] registered service cb0b9a0b-a84c-4c0d-bdbb-442e3144ee30 with handle=18
[D][esp32-hal-i2c.c:1345] i2cProcQueue():  Gross Timeout Dead start=0x180b, end=0x180b, =0, max=50 error=1
[E][esp32-hal-i2c.c:318] i2cDumpI2c(): i2c=0x3ffbe2c8
[I][esp32-hal-i2c.c:319] i2cDumpI2c(): dev=0x60013000 date=0x16042000
[I][esp32-hal-i2c.c:321] i2cDumpI2c(): lock=0x3ffbc16c
[I][esp32-hal-i2c.c:323] i2cDumpI2c(): num=0
[I][esp32-hal-i2c.c:324] i2cDumpI2c(): mode=1
[I][esp32-hal-i2c.c:325] i2cDumpI2c(): stage=3
[I][esp32-hal-i2c.c:326] i2cDumpI2c(): error=1
[I][esp32-hal-i2c.c:327] i2cDumpI2c(): event=0x3ffbc040 bits=10
[I][esp32-hal-i2c.c:328] i2cDumpI2c(): intr_handle=0x3ffbc070
[I][esp32-hal-i2c.c:329] i2cDumpI2c(): dq=0x3ffd9464
[I][esp32-hal-i2c.c:330] i2cDumpI2c(): queueCount=1
[I][esp32-hal-i2c.c:331] i2cDumpI2c(): queuePos=0
[I][esp32-hal-i2c.c:332] i2cDumpI2c(): errorByteCnt=2
[I][esp32-hal-i2c.c:333] i2cDumpI2c(): errorQueue=0
[I][esp32-hal-i2c.c:334] i2cDumpI2c(): debugFlags=0x00000000
[I][esp32-hal-i2c.c:311] i2cDumpDqData(): Debug Buffer not Enabled
[I][esp32-hal-i2c.c:354] i2cDumpInts(): Debug Buffer not Enabled
??:??:?? 6 [Screen] BLE advertisting type=0, Private=0, Device Address: 
??:??:?? 6 [Screen] Setting idle framerate
??:??:?? 11 [RadioIf] (bw=125, sf=12, cr=4/8) packet symLen=32 ms, payloadSize=42, time 3645 ms
??:??:?? 11 [RadioIf] Lora RX (id=0x6d692521 Fr0xc8 To0xff, WantAck0, HopLim3 Ch0xb1 encrypted rxSNR=14.25)
??:??:?? 11 [RadioIf] AirTime - Packet received : 3645ms
??:??:?? 11 [Router] Adding packet record (id=0x6d692521 Fr0xc8 To0xff, WantAck0, HopLim3 Ch0xb1 encrypted rxSNR=14.25)
??:??:?? 11 [Router] Using channel 0 (hash 0xb1)
??:??:?? 11 [Router] Expanding short PSK #1
??:??:?? 11 [Router] Installing AES128 key!
??:??:?? 11 [Router] decoded message (id=0x6d692521 Fr0xc8 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=3 WANTRESP rxSNR=14.25)
??:??:?? 11 [Router] handleReceived (id=0x6d692521 Fr0xc8 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=3 WANTRESP rxSNR=14.25)
??:??:?? 11 [Router] Plugin position wantsPacket=1
??:??:?? 11 [Router] Received position from=0xc4f7d9c8, id=0x6d692521, portnum=3, payloadlen=20
00:00:11 11 [Router] Upgrading time to RTC 1620161436 secs (quality 1)
20:50:36 11 [Router] Read RTC time as 1620161436 (cur millis 11590) quality=1
20:50:36 11 [Router] DB update position node=0xc4f7d9c8 time=1620161436, latI=497533672, lonI=186362008
20:50:36 11 [Router] Node status update: 0 online, 3 total
20:50:36 11 [Router] showing standard frames
20:50:36 11 [Router] Showing 0 plugin frames
20:50:36 11 [Router] Total frame count: 35
20:50:36 11 [Router] Added plugins.  numframes: 0
20:50:36 11 [Router] Finished building frames. numframes: 5
20:50:36 11 [Router] Setting fast framerate
20:50:36 11 [Router] Stripping time 0 from position send
20:50:36 11 [Router] Plugin position sent a response
20:50:36 11 [Router] Plugin routing wantsPacket=1
20:50:36 11 [Router] Received routing from=0xc4f7d9c8, id=0x6d692521, portnum=3, payloadlen=20
20:50:36 11 [Router] Routing sniffing (id=0x6d692521 Fr0xc8 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=3 WANTRESP rxSNR=14.25)
20:50:36 11 [Router] Rebroadcasting received floodmsg to neighbors (id=0x6d692521 Fr0xc8 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=3 WANTRESP rxSNR=14.25)
20:50:36 11 [Router] Expanding short PSK #1
20:50:36 11 [Router] Installing AES128 key!
20:50:36 11 [Router] enqueuing for send (id=0x6d692521 Fr0xc8 To0xff, WantAck0, HopLim2 Ch0xb1 encrypted rxSNR=14.25)
20:50:36 11 [Router] (bw=125, sf=12, cr=4/8) packet symLen=32 ms, payloadSize=42, time 3645 ms
20:50:36 11 [Router] txGood=0,rxGood=1,rxBad=0
20:50:36 11 [Router] AirTime - Packet transmitted : 3645ms
20:50:36 11 [Router] FIXME-update-db Sniffing packet
20:50:36 11 [Router] Delivering rx packet (id=0x6d692521 Fr0xc8 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=3 WANTRESP rxSNR=14.25)
20:50:36 11 [Router] Forwarding to phone (id=0x6d692521 Fr0xc8 To0xff, WantAck0, HopLim3 Ch0x0 
Portnum=3 WANTRESP rxSNR=14.25)

Second log - with battery:

??:??:?? 0 Filesystem files:
??:??:?? 0   /static/index.html
??:??:?? 0   /static/meshtastic.js.gz
??:??:?? 0   /static/basic.js
??:??:?? 0   /prefs/db.proto
??:??:?? 0   /prefs/radio.proto
??:??:?? 0   /prefs/channels.proto
??:??:?? 0 I2C device found at address 0x3c
??:??:?? 0 ssd1306 display found
??:??:?? 0 done
??:??:?? 0 Meshtastic hwvendor=5, swver=1.2.30.80e4bc6-d, hwver=unset
??:??:?? 0 Setting random seed 2376246251
??:??:?? 0 Total heap: 255292
??:??:?? 0 Free heap: 221216
??:??:?? 0 Total PSRAM: 0
??:??:?? 0 Free PSRAM: 0
??:??:?? 0 NVS: UsedEntries 91, FreeEntries 539, AllEntries 630
??:??:?? 0 Setup Preferences in Flash Storage
??:??:?? 0 Number of Device Reboots: 1994
??:??:?? 0 Initial packet id 475361840, numPacketId 4294967295
??:??:?? 0 Setting default channel and radio preferences!
??:??:?? 0 Expanding short PSK #1
??:??:?? 0 Wanted region 0, using Unset
??:??:?? 0 Loading /prefs/db.proto
??:??:?? 0 Loaded saved preferences version 11
??:??:?? 0 Loading /prefs/radio.proto
??:??:?? 0 Loading /prefs/channels.proto
??:??:?? 0 Number of Device Reboots: 1994
??:??:?? 0 Expanding short PSK #1
??:??:?? 0 Wanted region 2, using EU433
??:??:?? 0 region=2, NODENUM=0xd1dc6dc4, dbsize=3
??:??:?? 0 Read RTC time as 0 (cur millis 195) quality=0
??:??:?? 0 WANT GPS=1
??:??:?? 0 Setting GPS power=1
??:??:?? 2 ERROR: No UBLOX GPS found
??:??:?? 2 Hoping that NMEA might work
??:??:?? 2 WANT GPS=1
??:??:?? 2 External Notification Plugin Disabled
??:??:?? 2 Turning on screen
??:??:?? 2 Starting meshradio init...
??:??:?? 2 (bw=125, sf=12, cr=4/8) packet symLen=32 ms, payloadSize=16, time 2269 ms
??:??:?? 2 Set radio: name=LongSlow, config=3, ch=2, power=0
??:??:?? 2 Radio myRegion->freq: 433.174988
??:??:?? 2 Radio myRegion->spacing: 0.200000
??:??:?? 2 Radio myRegion->numChannels: 8
??:??:?? 2 Radio channel_num: 2
??:??:?? 2 Radio frequency: 433.574982
??:??:?? 2 Short packet time: 2269 msec
??:??:?? 2 Set radio: final power level=17
??:??:?? 2 RF95 init result 0
??:??:?? 2 RF95 Radio init succeeded, using RF95 radio
??:??:?? 2 PowerFSM init, USB power=1
[D][esp32-hal-cpu.c:189] setCpuFrequencyMhz(): PLL: 320 / 4 = 80 Mhz, APB: 80000000 Hz
??:??:?? 2 [Screen] Screen: Started...
??:??:?? 2 [SerialPlugin] Serial Plugin Disabled
??:??:?? 2 [StoreForwardPlugin] Store & Forward Plugin - Disabled
??:??:?? 2 [RangeTestPlugin] Range Test Plugin - Disabled
Transition powerFSM transition=boot timeout, from=BOOT to=POWER
??:??:?? 5 [PowerFSM] Setting bluetooth enable=1
Pre BT: 209864 heap size
??:??:?? 5 [PowerFSM] Starting bluetooth
??:??:?? 5 [Screen] Done with boot screen...
??:??:?? 5 [Screen] Screen: Powered...
??:??:?? 5 [Screen] showing standard frames
??:??:?? 5 [Screen] Showing 0 plugin frames
??:??:?? 5 [Screen] Total frame count: 35
??:??:?? 5 [Screen] Added plugins.  numframes: 0
??:??:?? 5 [Screen] Finished building frames. numframes: 3
??:??:?? 5 [Screen] Setting fast framerate
??:??:?? 6 [Screen] BLE task running
??:??:?? 6 [Screen] registered service 0x1800 with handle=1
??:??:?? 6 [Screen] registered service 0x1801 with handle=6
??:??:?? 6 [Screen] registered service 6ba1b218-15a8-461f-9fa8-5dcae273eafd with handle=10
??:??:?? 6 [Screen] registered service cb0b9a0b-a84c-4c0d-bdbb-442e3144ee30 with handle=18
[D][esp32-hal-i2c.c:1345] i2cProcQueue():  Gross Timeout Dead start=0x181d, end=0x181d, =0, max=50 error=1
[E][esp32-hal-i2c.c:318] i2cDumpI2c(): i2c=0x3ffbe2c8
[I][esp32-hal-i2c.c:319] i2cDumpI2c(): dev=0x60013000 date=0x16042000
[I][esp32-hal-i2c.c:321] i2cDumpI2c(): lock=0x3ffbc16c
[I][esp32-hal-i2c.c:323] i2cDumpI2c(): num=0
[I][esp32-hal-i2c.c:324] i2cDumpI2c(): mode=1
[I][esp32-hal-i2c.c:325] i2cDumpI2c(): stage=3
[I][esp32-hal-i2c.c:326] i2cDumpI2c(): error=1
[I][esp32-hal-i2c.c:327] i2cDumpI2c(): event=0x3ffbc040 bits=10
[I][esp32-hal-i2c.c:328] i2cDumpI2c(): intr_handle=0x3ffbc070
[I][esp32-hal-i2c.c:329] i2cDumpI2c(): dq=0x3ffd9464
[I][esp32-hal-i2c.c:330] i2cDumpI2c(): queueCount=1
[I][esp32-hal-i2c.c:331] i2cDumpI2c(): queuePos=0
[I][esp32-hal-i2c.c:332] i2cDumpI2c(): errorByteCnt=2
[I][esp32-hal-i2c.c:333] i2cDumpI2c(): errorQueue=0
[I][esp32-hal-i2c.c:334] i2cDumpI2c(): debugFlags=0x00000000
[I][esp32-hal-i2c.c:311] i2cDumpDqData(): Debug Buffer not Enabled
[I][esp32-hal-i2c.c:354] i2cDumpInts(): Debug Buffer not Enabled
??:??:?? 6 [Screen] BLE advertisting type=0, Private=0, Device Address: 
??:??:?? 6 [Screen] Setting idle framerate
??:??:?? 32 [NodeInfoPlugin] Sending our nodeinfo to mesh (wantReplies=1)
??:??:?? 32 [NodeInfoPlugin] sending owner !d1dc6dc4/Ewelina/Ewl
??:??:?? 32 [NodeInfoPlugin] Update DB node 0xd1dc6dc4, rx_time=0
??:??:?? 32 [NodeInfoPlugin] handleReceived (id=0x1c557233 Fr0xc4 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=4 WANTRESP priority=10)
??:??:?? 32 [NodeInfoPlugin] Plugin nodeinfo wantsPacket=1
??:??:?? 32 [NodeInfoPlugin] Received nodeinfo from=0xd1dc6dc4, id=0x1c557233, portnum=4, payloadlen=35
??:??:?? 32 [NodeInfoPlugin] old user !d1dc6dc4/Ewelina/Ewl
??:??:?? 32 [NodeInfoPlugin] updating changed=0 user !d1dc6dc4/Ewelina/Ewl
??:??:?? 32 [NodeInfoPlugin] Plugin nodeinfo considered
??:??:?? 32 [NodeInfoPlugin] Plugin routing wantsPacket=1
??:??:?? 32 [NodeInfoPlugin] Received routing from=0xd1dc6dc4, id=0x1c557233, portnum=4, payloadlen=35
??:??:?? 32 [NodeInfoPlugin] Routing sniffing (id=0x1c557233 Fr0xc4 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=4 WANTRESP priority=10)
??:??:?? 32 [NodeInfoPlugin] FIXME-update-db Sniffing packet
??:??:?? 32 [NodeInfoPlugin] Delivering rx packet (id=0x1c557233 Fr0xc4 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=4 WANTRESP priority=10)
??:??:?? 32 [NodeInfoPlugin] Forwarding to phone (id=0x1c557233 Fr0xc4 To0xff, WantAck0, HopLim3 Ch0x0 Portnum=4 WANTRESP priority=10)

Device behaviour: on-board led recognize battery installed/charging (turns color to orange) on the phone no sign of battery presence and on the screen only USB letters (no animation/cabel/battery)
If you need any further informations, just let me know. Take care!

Ok, noticed that in file configuration.h i did not define BATTERY_PIN 37. I will try to do this and recompile software.

1 Like