back to menue

back to CForth Low Power STM32G431/441, STM32F042

CForth Low Power for STM32L031

Here the latest result of my CForth Low Power project is presented separately. The intention for this project is to get a tool for control dynamic art installations powered by small solar panels or other "weak" power sources using the Forth programming language.

LowPower Hardware with STM32L031 processor:

Because the STM32L031K6 (LQFP32) version does not include pinout for a crystal oscillator, the built-in MSI RC osciallator is used for system clock. This provides a CPU clock speed (STM32 SYSCLK, AHB and APB bus) of 1.048MHz (default, switchable by Forth command to 4.194MHz).
During tests here, stability was good for RS-232 baudrates up to 57600 Baud with default frequency calibration of the MSI clock. The RS-232 interface does not draw current except during data transfer. The RS-232 transmitter is extremely simplified, but has been tested with several standard RS-232 receivers.

Another critical aspect of supply current is the quality of the 3.3V regulator. For this reason, on the Veroboard compatible PCB design, a layout for MCP1702 (ca. 0.01mA ground pin current) is provided. LP2950 or LE33 regulators fit into the PCB layout: mounted ca.135 degrees counter clockwise with respect to the MCP1702 position. The middle pin of LP2059/LE33 is Ground instead of Vin at MCP1702.
The LED should be a very efficient blue or white type. To save current, a special CForth kernel operator "LED" is introduced to switch the LED off when not needed. With 10kOhm serial resistor, a blue LED uses about 0.1mA.

Below the line: the STM32L031 prototype uses only ca. 0.2mA with LED OFF at 1.048 MHz clock (0.8mA at 4.194MHz clock). But it has to be noted, that supply current rises remarkable with ADC on (ca. +0.4mA), power via pull-up or pull-down (ca. +0,08mA) and fast pulse out via I/O pin (ca. +0.2mA at 1 kHz PWM, no load).

F042 TSSOP Veroboard photo Veroboard assembly for STM32L031, STM32F042, STM32F030 (32pin LQFP on DIL32 breakout board. Pinheads instead of IC socket).

Typical features of CForth LowPower Firmware for STM32L031:

The set of CForth Low Power Kernel Operators and their features is almost the same as the standard CForth version, with lower execution speed of course - and with up to 1/50 lower supply current.
The User Thread code storage for STM32L031 is derived from the compact code for STM32F042 processors. In contrast to the straight 32bit code for STM32G431, it is compacted to 8bit format, which increases the maximum User Forth code volume up to 3 times at the price of slightly slower code runtime (details see CForth Operating Manual, p1,2).

The most essential differences against standard CForth:

A detailled CForth Operating Manual Standard version (PDF file), and
a DIY Construction Manual Low Power version (HTML file) is provided here.

A good tool for Forth source code upload is my DTerm Windows terminal software. It is surely not the best terminal emulator, but has been developed over the years for best fitness with my actual projects.

Downloads:
The subsequently downloadable material is copyrighted (c)2023-24 by Wolfgang Schemmert.
Assembly of the devices, programming and use of the software is permitted for free by everybody for any purpose ("freeware"). For commercial use, restrictions of third-party software contributors (Segger GmbH, STM) must be respected.
All information is based on best knowledge, but "as is" and without any warranty. Any responsibility is excluded. Use for dangerous, life-threatening and medical applications is forbidden.

Firmware "CForth-LP-L031-pwm2.hex" for 32pin LQFP Veroboard compatible PCB.
CPU Clock = 1.048Hz/4.194MHz switchable. Code for PWM2.
(09 April 2024 - bugfix and minor improvements)

Firmware "CForth-LP-L031-motor.hex" for 32pin LQFP Veroboard compatible PCB.
CPU Clock = 1.048Hz/4.194MHz switchable. Code for stepper motor.
(09 April 2024 - bugfix and minor improvements)

Source code "CForth-LP-L031-v4.zip"
(state 09 April 2024). This source code is provided as complete "Segger Embedded Studio" project (ZIP file, 406kB).
Parts published by Segger GmbH are under license of Segger&|Rowley, parts published by STM are under license of STM, parts programmed by me are provided under GNU GPL3 license.

These projects are programmed directly on register level, no external libraries (except "cmsis", startup code and Segger system code), no external drivers or HAL are used.


back to CForth Low Power STM32G431/441, STM32F042

back to menue


* State of information April 2024.
* Right of technical modifications reserved. Provided 'as is' - without any warranty. Any responsibility is excluded.
* This description is for information only. No product specifications are assured in juridical sense.
* Trademarks and product names cited in this text are property of their respective owners.