kucu's notes

Attila Zseller

Tech notes and thoughts on entrepreneurship.

The Helium Network is Surprisingly Awesome

18 May 2022

The Helium Network is a LoRaWAN (~IoT) network provider — similar to TheThingsNetwork — which incentivize people by giving away its own cryptocurrency for creating network coverage. So far only a handful of us were trying to create LoRaWAN coverage in Hungary. Nowadays hordes of clueless fucks climb their roof to install their €500-1000 “miners” (most of them facing 5+ years of ROI).

The results are awesome. This is one of those rare occasions where stupid people can make a great service for the majority.

Helium Coverage

read the full article >>

Dynamic CPU clock frequency scaling with FreeRTOS and STM32

04 May 2021

In this post I’ll show a relatively easy way to scale the MCU clock dynamically.

There is a section in the STM32L4 MCU’s datasheet called “Supply current characteristics”, and it has an interesting table detailing power consumption for various payloads as µA/MHz.

STM32L433 power consumption per MHz

Such a table suggest to clock the MCU to a reasonably high frequency, and go to SLEEP mode as soon as CPU is not used. Unfortunately, having the CPU in SLEEP mode at 8 MHz consumes ~250 µA (range 2, 25 °C), while SLEEP mode at 48 Mhz sets you back by ~1.34 mA (range 1). There is more than 1 mA difference for the same task (doing nothing), and it increases significantly at higher ambient temperatures.

In general, the way to long battery life are the STOPx and STANDBY modes. However, if your project needs fast clocks only for a short period of time, and works fine at lower speeds in the rest of the time, this trick will come handy.

read the full article >>

STM32 deepsleep modes (STOP, STOP2, STANDBY) with FreeRTOS

19 Mar 2021

STOP2 and STANDBY modes are great way to achieve uA and sub-uA consumption. When using an RTOS, the tasks must synchronize when to go to deepsleep, especially to STANDBY mode, which requires most hardware modules to be re-initialized.

  • You must either create complex synchronization between tasks, and possibly create a “managing” task that puts the system into deepsleep,
  • or you can use FreeRTOS hooks to achieve the same, but in a somewhat cleaner way.

I’ll show here the latter one.

read the full article >>