STM32L011 serial, analog and low power examples

Here are some further examples for the STM32L011 Nucleo board. The first is a simple interrupt driven serial communications demonstration. It makes use of the built in serial interface in the Nucleo board and so no additional hardware is required for your host PC to exchange data with the MCU.
The second example builds on the first. It reads ADC channel 0 and outputs the result to the host PC over the serial port.
The third example is a little more elaborate and is aimed at those wishing to develop a very long life battery application. It uses the built-in real-time-clock (RTC) to wake the MCU up about once every second. While awake, the MCU reads the ADC, outputs data to the host PC over the serial port and blinks the LED on the Nucleo board. Current consumption is minimized during sleep by turning off
peripherals, reducing AHB clock speed and putting the Cortex M0+ into a deep sleep. I found it difficult to measure the current flow during this time but it seems to be around 3 to 4 microamps. One thing I did notice is that the CPU will not go to sleep with interrupts disabled – a good way of preventing you from shooting yourself in the foot.

Links to code.

Serial communications over the nucleo serial interface to the host PC
Read the ADC and output the result over the serial port to the host PC
Minimize power consumption and wake using the internal RTC every second

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s