2026-11-26 ·14 min read ·IoT ·Hardware ·Tinkering

Devil in the detail: the footnote that kept a BG96 modem awake

The data logger is a vehicle board I designed a few years ago: an ESP32, a Quectel BG96 LTE-M modem on a Mini PCIe card, CAN, GNSS, and a small LiPo so it keeps working when the vehicle supply goes away. I have new old stock of the boards, and I am writing open-source firmware so they can be put to use. This is what I ran into while writing it.

Resources: GX5 board · GX5 Kit · Board documentation on GitHub

I was not looking for a power problem. The board was on a test bench, wired to a current sensor on its 12 V harness, running soak tests for stability: does it stay connected, does it wake when it should, does it survive days unattended. Sleep was supposed to be the routine part.

The soak runs showed two things I had not expected. Power consumption was not dropping to anything like the level it should when the board slept, and the LiPo was draining much faster than it should. In one run it was flat in about ten hours.

The numbers: with the MCU in deep sleep and the modem told to sleep, the board drew about 20 mA at 12 V. Measured on the LiPo side with the vehicle feed off, it was 37.7 mA at 4.05 V.

The obvious answer was to turn the modem off. It would not stay off:

> AT+QPOWD=1
OK
POWERED DOWN
            ... 6.5 s ...
APP RDY

Every command I sent was accepted and answered OK. The problem was in what the documents leave out, and it came down to two gotchas, both on the modem's carrier card:

  1. The Mini PCIe version of the BG96 boots itself whenever it has power. There is no off state. The card's document does not raise the subject; I could only establish it by measurement.
  2. USB is always enabled. The module is told a USB host is attached for as long as the card is powered. This one is in the card's document, as a footnote that states the fact and stops short of its consequence.

Underneath that was an assumption I never wrote down, so never tested: nothing is plugged into the card's USB, therefore USB is not active. It was wrong. The module does not decide that from a cable. It decides it from a pin, and on this card the pin is wired high.

What found it was going back to basics. I stopped measuring a whole board with firmware, a network and a buck converter in the loop, and measured one thing at a time until only the card was left.

This post follows the investigation in the order it happened, dead ends included. The modem excerpts are condensed from my bench notes; times are seconds from the start of each test. The second gotcha is fixed by removing a single resistor. The first is not fixable from the host side at all.

Why I could not just cut the power

On the data logger the modem sits on the always-on 3.3 V rail, with the IMU, the I/O expander and the RTC. That was deliberate: the board was designed to always have a connection, or to be woken remotely by SMS, and a modem with no power can do neither. The two power-control pins the MCU has do other things: one enables the 36 V to 5 V buck from the vehicle supply, the other is the power-save pin of the 3.3 V buck-boost. Neither is a modem rail switch.

So the modem can only be stopped by asking it: AT+QPOWD, the module's power key, or a sleep mode. The Mini PCIe connector has no power-key pin, which left AT+QPOWD and sleep.

Before any testing I wrote down five ranked hypotheses: power-down sent while an MQTT operation was pending, a glitch on a control line as the ESP32 entered deep sleep, back-powering through UART pins, a hung module, and brown-out. None of them was the cause.

Dead end 1: something the host is doing

A modem that restarts 6.5 s after POWERED DOWN looks like something is waking it. I wrote a standalone test firmware that keeps the MCU awake and prints every modem line, then repeated AT+QPOWD=1 with each host line in each state:

Line States tried
UART TX (to modem) high, high-impedance, low
UART RX (from modem) pull-up, none, pull-down
PERST# high, high-impedance, low
DTR low, high

The baseline restarted after 6.5 s. In every other variant no RDY line appeared, and for a moment that looked like progress.

It was not. The harness current stayed at about 39 mA with radio spikes, and when I restored the UART, without resetting anything, the modem answered AT within 4 ms. It had restarted every time. With its receive line held low or floating it simply did not print the boot messages.

Nothing the ESP32 drives causes or prevents the restart.

Dead end 2: PSM

LTE-M has Power Saving Mode: the module agrees a timer with the network and shuts almost everything down between check-ins. The module accepted the request and the network granted it (2 s active time, 1 h update timer). About 20 s later the modem stopped answering, and 3 s after that it sent APP RDY. A full restart.

To rule out my own AT traffic waking it, I repeated the test and then sent nothing at all:

 20.2 s   AT+CPSMS=1,,,"00000011","00000101"  -> OK
          (no further bytes sent)
 38.1 s   PSM POWER DOWN
 44.5 s   APP RDY

Granted, entered, and back about 6.5 s later: the same signature as AT+QPOWD. It did not enter PSM again in the following two and a half minutes. Harness current stayed at about 40 mA throughout.

The module's hardware design lists two PSM wake sources: timer expiry and the power key going low. The card's document does not mention PSM at all. I noted the first and had not yet looked for the second.

Dead end 3: USB settings and sleep clock

The module has a firmware switch to disable its USB interface, AT+QCFGEXT="disusb",1. I measured each sleep-related state with it off and on. Harness current at 12.2 V, MCU awake:

Modem state disusb 0 disusb 1
CFUN=1, idle 39.9 mA 41.7 mA
CFUN=0, QSCLK=0 35.7 mA 36.7 mA
CFUN=0, QSCLK=1, DTR low 35.7 mA 36.7 mA
CFUN=0, QSCLK=1, DTR high 34.2 mA 35.2 mA

With QSCLK=1 and DTR high the modem stops answering AT, so by its own account it is asleep. That saves about 1.5 mA at 12 V. Disabling USB in firmware saves nothing; if anything it costs 1 mA. A second USB option, "usb/psm", changed nothing either.

This was the result I least expected. A command whose name says "disable USB" ought to turn the USB interface off, and an interface that is off ought to stop drawing current. The command is accepted and the current does not move. The AT commands manual I was working from (v2.5) does not document disusb or "usb/psm" at all, so there is nothing to say what the option is meant to switch off.

Nothing was connected to the USB pins and the firmware switch made no difference, so I moved on. "USB detect tied high with no host" went onto my list of candidates and stayed there, untested, because the assumption said USB was idle.

Turning the radio off (CFUN=0) before sleeping made no difference to the sleep figure: registered sleep and radio-off sleep cost the same.

Reference rig 1: a RAK2013 hat on a Pi

Three dead ends had one thing in common: each test changed one setting on a system with many other things going on. The board, my firmware, the network, the SIM, the regulators and the card were all in every measurement. I stopped trying things on the data logger and went back to basics: take parts away until one question has one variable.

The first question was only "what makes a BG96 restart after power-down?", and for that I needed a BG96 where I controlled every pin. I had an old RAK2013 cellular hat, which carries the same module and brings the power key out to a Pi GPIO. With a short Python script driving the UART and GPIOs:

Power key Command Result
released AT+QPOWD=1 POWERED DOWN, status off 0.5 s later, stays off (watched 120 s)
held low AT+QPOWD=1 POWERED DOWN, status off, then RDY 5.3 s later
held low AT+QPOWD=0 same, RDY 5.5 s later
released again AT+QPOWD=1 stays off

A BG96 whose power key is held low restarts about five seconds after every power-down. That is the data logger's symptom, reproduced on different hardware with different module firmware.

This is also where the PSM note from earlier fits: power key low is a documented PSM wake source. A card that holds the key low wakes the module out of PSM as soon as it gets there.

Reference rig 2: the bare card and a current sensor

The hat explained the restart but not the sleep current, and it is not the card I ship. The second question was only "what does the card draw, by itself?". So I wired a spare Mini PCIe card straight to the Pi: 3.3 V, ground, UART and PERST#, with an INA219 and a 0.1 ohm shunt in the 3.3 V feed. No SIM, no antenna, no data logger, none of my firmware.

To make it usable I wrote a small web console in standard-library Python: an AT terminal, live current and voltage, and buttons for DTR and reset. A command and its effect on the current are then visible in the same window.

Card current at 3.32 V:

State Current
GNSS on, radio off 70 to 72 mA
GNSS off, radio off, awake 36.4 mA
plus AT+QSCLK=1, DTR high (asleep) 31.5 mA
same, with disusb 1 39.0 awake / 34.7 asleep
after AT+QPOWD=1 71 to 72 mA for about 5 s, then RDY

Two things were now measured rather than suspected.

There is no off state. After POWERED DOWN the current never drops. It goes from idle straight to boot current and RDY follows 5.6 s later, with nothing attached but power, UART and reset.

Sleep is 31.5 mA. That lines up with the 37.7 mA I had measured from the LiPo on the data logger. The problem was the card, on its own, on the bench.

One trap along the way: the spare card had GNSS auto-start stored in its settings and drew 70 mA until I noticed. Check AT+QGPS? before trusting a current figure from a card with unknown history.

The cause: two gotchas

I had been working from the BG96 module's hardware design document. The Mini PCIe card has its own (I used v1.2), and this time I read it for what it does not say.

USB is always enabled. The card document gives three preconditions for sleep mode: AT+QSCLK=1, DTR high or open, and the host's USB bus in suspend. Its current table has rows for sleep and idle with USB suspended (2.7 mA asleep with the radio off) and for idle with USB active (about 43 mA). There is no row for a card with no USB host at all, which is how the data logger and many embedded designs use it: UART only.

The missing piece is footnote 6 under the key features table, repeated as a note in the USB section: "USB_VBUS on BG96 has been internally connected to VCC_3V3".

USB_VBUS is the module's USB-detect input. With it tied to the supply, the module believes a USB host is attached for as long as it has power. My assumption, that no USB connected meant USB not active, was about the connector. The module only knows about the pin.

Sleep needs that host to suspend the bus. With no host, nothing ever suspends it, so the third precondition can never be met. The document states both facts, a section apart, and never joins them: on a UART-only design the 2.7 mA row is unreachable, and the current you get instead (31.5 mA on my card) is not listed anywhere.

This also accounts for disusb. The same footnote says the consequence in passing: because of that link, the USB interface stays powered whenever the card is. So USB can be turned off by AT command and still be powered: the command acts in firmware, and the pin is hardware. That the module keeps its USB circuitry up for as long as the pin is high, whatever the firmware setting, is my inference from the current readings; the measured part is that disusb saved nothing and removing the link saved about 30 mA asleep.

The card boots itself whenever it has power. Here the card document says nothing. The text of v1.2 contains no mention of the power key, of AT+QPOWD, of powering down, or of PSM. The connector has no power-key pin, and the module starts when 3.3 V is applied, so something on the card operates the key. What that circuit does after a power-down is not described.

The two gotchas have different standing:

  1. Auto-boot, so no power-down. That the card boots whenever it has power, including straight after POWERED DOWN, is measured. The mechanism, that the card holds the module's power key low, is inferred: the behaviour matches the RAK2013 with its key held low (restart after 5.3 s there, 5.6 to 6.5 s here). I have not seen it on a schematic or probed it on the card.
  2. USB always enabled, so no sleep. USB detect is tied to 3.3 V on the card. Stated in the card's document, consequence not stated, confirmed by measurement below.

On the underside of the card, beside the SIM holder and directly under the module's USB pins (pins 8 to 10: USB_VBUS, USB_DP, USB_DM), there is a small cluster of parts. One of them is the resistor that links USB_VBUS to 3.3 V. I removed it from the spare card (hardware revision 1.2). I identified the part by its position and by the result; I did not record its reference designator.

Underside of a Quectel BG96 Mini PCIe card showing the SIM holder, with a red box around one small surface-mount resistor in the cluster of parts to the right of the holder.
Underside of the card. The red box marks the resistor I removed, to the right of the SIM holder.

Same rig, same card, 3.33 V:

State Before After
Awake, GNSS off 34 to 36 mA 13.7 to 13.9 mA
AT+QSCLK=1, DTR high (asleep) 29.5 to 31.5 mA under 1 mA

The "after" sleep reading was -0.5 mA, which is below what this sensor can resolve (about 1 mA of resolution and offset), so "under 1 mA" is as precise as I can honestly be. Asleep, the card does not answer AT, and a PERST# pulse brings it back with RDY and APP RDY, so it is asleep and not dead.

Then the same modification on the card in the data logger on the bench. Board asleep at 12.2 to 12.4 V, vehicle feed on, LiPo unplugged, radio off, QSCLK=1, DTR high:

Condition Harness current
Unmodified card 20.5 mA
Resistor removed 8.5 mA (8.1 to 9.0)
No card fitted 6.4 mA

Wake still works: an ignition wake had MQTT connected 9 s after boot, and the board went back to 8.8 mA.

The card now costs about 2 mA at 12 V asleep, down from 14. Most of the remaining 6.4 mA is not the modem. The 5 V buck is a TPS5430, whose datasheet gives 2 mA typical (4.4 mA maximum) quiescent current and describes no light-load mode; that it accounts for a large share of the 6.4 mA is my reading of the datasheet, not a separate measurement. With the feed switched off and the board on its LiPo, the harness draws 0.15 mA.

One small extra: in its default LED mode the card's network LED flashes every 2 s through a radio-off sleep. AT+QCFG="ledmode",1 turns it off when the radio is off. The saving, 8.5 to 8.4 mA, is within run-to-run noise, but a dark LED on a sleeping board is the right behaviour anyway.

What it does not fix

Removing the USB link deals with the second gotcha. The first is untouched: the card still boots itself whenever it has power.

So the firmware's method is sleep, not power-down: GNSS off, radio off or registered, AT+QSCLK=1, DTR high. It never sends QPOWD.

What was not in the documents

What the documents say What they leave out What I measured
Card: sleep needs the host's USB bus suspended. Footnote: USB detect is tied to 3.3 V. With no USB host, USB is still active and sleep is unreachable. No current figure for that case. 31.5 mA "asleep" at 3.3 V; under 1 mA with the link removed
Card: nothing on power key, AT+QPOWD or power-down. Whether the card has an off state. None. Boot current straight after POWERED DOWN, RDY about 6 s later
Card: nothing on PSM. Module: power key low is a PSM wake source. That PSM on this card is a restart. Restart 6.5 s after PSM POWER DOWN
Module firmware accepts disusb; my AT manual (v2.5) does not list it. That USB turned off by AT command is still powered while USB detect is high. No saving; about 1 mA worse

None of these is an error in a document. Each document is accurate about the part it describes. The gaps sit between them: between the module and the card it is mounted on, and between the card and a host that has no USB.

Lessons

Write down the assumption, then test it. "No USB connected means USB is not active" seemed too obvious to state, so it never became a test. It was the whole sleep problem. The assumptions worth checking are the ones that feel like facts.

"Off" by command is not "unpowered". disusb was accepted and changed nothing I could measure. A setting tells you what the firmware will do. Only the current tells you what the hardware is doing.

Go back to basics: one thing at a time. Progress started when I stopped changing settings on the full system and removed parts instead: first the board (a hat on a Pi, one pin under test), then everything but the card (power, UART, reset, one current sensor). Each rig could answer one question and nothing else, which is why its answer could be trusted.

Read the carrier card's document, and read the footnotes. The module's document describes a part with a power key, a USB-detect pin and PSM. The card's document describes what I actually bought, and the sentence that explained the sleep current is a footnote under the key features table.

Ask which configuration a figure was measured in. Every sleep figure in the card's table is labelled "USB Suspend". That label is a test condition, and my design could not meet it. A headline number with a condition you cannot reproduce is not your number.

Treat silence as an open question. A document that never mentions power-down has not told you power-down works. The absence of a power-key pin reads as "handled for you". It was handled, in the one way that removes the off state.

Measure at the rail. Harness-side readings at 12 V, through a buck converter and with an MCU in the way, told me something was wrong. One INA219 in the card's own 3.3 V feed told me what: 31.5 mA asleep, on its own, with nothing of mine attached.

"No RDY seen" is not proof the modem is off. Half of the host-line experiments appeared to work because the boot messages stopped. The modem had restarted every time. Confirm off with current, or with an AT probe after restoring the lines.

Build the reference rig early. An old hat with the same module reproduced the restart, with a pin I could release to make it go away. The documents could not answer the power-down question; a rig with the key under my control answered it in four rows.

Stored modem settings outlive your test. A spare card with GNSS auto-start stored in it cost me a wrong baseline: 70 mA that had nothing to do with the problem. Reset what you changed, and have the firmware assert the settings it depends on at every start.

Summary

Two gotchas: the card boots itself whenever it has power, and its USB is always enabled. The second has a one-resistor fix.

Before After
Card awake at 3.3 V 36 mA 13.8 mA
Card asleep at 3.3 V 31 mA under 1 mA
Board asleep at 12 V 20.5 mA 8.5 mA
Board asleep, no card 6.4 mA 6.4 mA
AT+QPOWD stays off no no

One resistor, on a card I did not design, explained by a footnote and by a subject the document never raises.