Serial-Port Printf statements battery usage

Hi everyone
This might be a stupid question but I was wondering if printf statements in my code use any kind of battery if there isn´t a USB-Cable connected.

Kind Regards

Yes. No.

The real answer is that depends on your controller and software stack. So without providing that basic information no one will be able to provide a correct answer.

I´m using the Wistrio Rak5205 Board.
I don´t know what you mean by “software Stack” im sorry.

The RAK5205 has a built in CP2012 USB UART bridge, so (absent very clever software) the processor will actually generate the serial messages at the configured baud rate regardless if there is anything present to read them out of the CP2102 via USB, or not.

So the processor is likely going to be awake for however long that takes. But if you’re using an appropriate CPU clock, just being awake a little longer in each place where you would necessarily need to be awake to do something may not cost all that much power.

In a well designed end node, your major power sinks are running the radio during transmit and during the receive windows, plus any power-hungry sensors you might periodically activate long enough to poll.

In a badly designed node, you lose power to all sorts of mistakes, like failing to enter CPU sleep mode, running the CPU at a higher than necessary clock, asserting I/Os against pulling resistors, or raising I/Os to powered-off peripherals and thereby partially re-powering them through the I/O.

Good use of serial messages can often help you debug those kinds of issues. But having a plan to eventually ramp down the quantity of messages could be useful too. Also keep in mind that those which end up in the build (even if rarely or never printed at runtime) cost code space, which is an issue both if your chip has limited flash and a cost if you ever want to do OTA firmware updates.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.