px-lib  0.9.3
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers
3.3 Piconomix STM32L072RB PX-HER0 Board
From Zer0 to 32-bit HER0™
~ STM32 edition ~

1. Introduction

PX-HER0 is a low-power ARM Cortex development board that's been carefully crafted with embedded education in mind - hardware, software, and documentation. Discover and free your inner embedded hero!

hero_board_isometric.jpg

Extensive ecosystem included:

The flagship application is the CLI Explorer (Command Line Interpreter) that creates a "Un*x Shell"-like environment running on the PX-HER0 board so that you can easily experiment with GPIO, PWM, ADC, DAC, I2C, SPI and 1-Wire using only ANSI/VT100 terminal software:

hero_board_cli.gif

The Hero Board is shipped preprogrammed with a USB UF2 Bootloader and CLI Explorer (Command Line Interpreter).

2. Board layout - top view

hero_board_top_annotated.png


PX-HER0 Board (Top)
A. 128 x 64 Graphic LCD with backlight F. microSD Card Slot
B. Charger LED G. User Buttons
C. User/Power Button H. User LED
D. USB2: USB-Serial Bridge I. Peripheral Connector
E. USB1: STM32

3. Board layout - bottom view

hero_board_bot_annotated.png


PX-HER0 Board (Bottom)
A. +3V3 Step-down DC-DC Regulator H. Seeed GROVE I2C
B. Serial Flash I. Sparkfun Qwiic / STEMMA QT I2C
C. BOOT selection J. Piezo Buzzer
D. Prog & Debug Connector K. microSD Card Slot
E. Reset Button L. USB1: STM32
F. ARM Cortex Debug Connector M. USB2: USB-Serial Bridge
G. Peripheral Connector N. Li-Po Battery Connector

4. Features & Specifications

  • Microcontroller: STM32L072RB ultra low-power ARM Cortex-M0+
    • 128k FLASH
    • 20k SRAM
    • 6k EEPROM
  • Memory: Adesto AT25SF041 4 Mbit serial flash memory
  • Storage: Spring-loaded push-push microSD card slot
  • Serial communication: Rock-solid FTDI FT230XS USB-Serial bridge
  • Rich user interface:
    • Low-power 128 x 64 monochrome graphic LCD with LED backlight
    • User LED and battery charger LED
    • Piezo buzzer
    • 6 LARGE finger-friendly user buttons
    • Reset button
  • Peripheral connectors:
    • PWR (+3.6 V to +5 V power bus)
    • ADC x 4
    • DAC x 1
    • GPIO x 8 / PWM x 4
    • UART x 2
    • I2C x 3 (single I2C bus)
    • SPI x 1
  • Power:
    • Li-Po battery charger
    • Zero-burden voltage monitoring circuit
    • Efficient power-path management
    • True power on/off circuit
    • 95% efficient TI LM3670 step-down DC-DC regulator
  • Dimensions:
    • Board: 100 x 80 mm (3.94 x 3.15")
    • Display active pixel area: 48.6 x 24.9 mm (1.91 x 0.98") / 54.6 mm (2.15") diagonal

5. Comparision between Deluxe and Lite Edition

In the future a Lite Edition may also be available.

Some hardware blocks will be absent on the Lite Edition to provide a lower cost option. The schematic contains 3 build variants (full, Deluxe and Lite) and can be consulted for an exact view of electronic components that are present or absent.

On the Lite Edition, the USB-Serial bridge (USB2) is absent, but a vertical 2.54 mm pitch header is populated to provide an easy connection to UART1 of the STM32.

Here is a table highlighting the differences:

Feature Deluxe Edition Lite Edition
STM32L072RB Microcontroller (128k Flash, 20k SRAM, 6k EEPROM) YES YES
User Interface (LCD with backlight, LED, Buzzer, 7 x Buttons) YES YES
Peripheral connector (PWR, ADC x 4, DAC, GPIO x 8 / PWM x 4, UART x 2, I2C, SPI) YES YES
Spring-loaded push-push micro SD card connector YES YES
10-pin 1.27 mm (0.05") Standard ARM Cortex Debug Connector YES YES
95% efficient +3V3 step-down DC-DC converter YES YES
True power on/off circuit YES NO
Li-Po battery charger with charging LED YES NO
Zero-burden battery voltage monitoring circuit YES NO
Efficient power-path management YES NO
USB-Serial bridge (USB2) YES NO
512k SPI Serial Flash Memory YES YES
Sparkfun Qwiic / STEMMA QT Connector YES YES
Seeed GROVE I2C Connector YES YES

6. Design Documents

Most OSHW designs hide some of the "magic sauce". The schematics are hard to follow and complete manufacturer part numbers are not disclosed. The Hero Board lowers the barrier in terms of design openness... judge for yourself:

The design documents can also be found here for off-line viewing:

px-lib/boards/arm/stm32/px_hero/docs

7. Reference documents

The reference documents can also be found here for off-line viewing:

px-lib/boards/arm/stm32/px_hero/docs

8. Disclaimer

This development/evaluation tool is suitable for research and development in
a controlled laboratory environment and not designed or tested as a finished
appliance for end users. Precautions must be taken against improper use such
as Electrostatic Discharge (ESD) damage, over-voltage / over-current 
electrical stress, incorrect power sequencing, etc.

THE HARDWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS HARDWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

9. Board Support Package

A Board Support Package (px_board.h : STM32L072RB PX-HER0 Board) is provided that:

  • defines the function of each GPIO pin
  • defines convenience macros to manipulate GPIO functions
  • initializes the clock system and GPIO pins
  • provide SPI driver support to manipulate chip select pins
  • provide microsecond and millisecond delay functions

Files:

10. Getting started

The following free software tools are needed:

The following command line tools are optional, but recommended:

10.1 Connect USB1 of Hero Board to PC

The Hero Board is shipped with the CLI Explorer (Command Line Interpreter) app. Connect USB1 to the PC.

The app will enable the LED and display the Hero logo on the LCD when it starts.

The app implements a Virtual COM port (USB CDC class) driver for communication. When USB1 is connected to the PC, the Windows 10 operating system will detect that a new USB device has been connected and automatically install a driver for it.

Take note which COM port has been assigned. The Device Manager utility can also be used to find out. Right-click "Start (Windows icon bottom left of task bar) > Device Manager":

hero_board_device_manager.png
Device Manager - COM port assignment

10.2 Install Tera Term (an ANSI/VT100 Terminal Emulator)

Follow the steps HERE to install and configure Tera Term using the COM port noted previously.

10.3 Play with the CLI Explorer app

You are now ready to use Tera Term to interact with the CLI explorer app. Follow the full documentation HERE.

hero_board_cli.gif
CLI Exlorer executing on a Hero Board

10.4 Install USB-UART Bridge Virtual Com Port (VCP) USB driver

If you already have the latest driver installed and correctly configured, then this part can be skipped.

The Deluxe Edition has an FTDI 230XS USB-UART Bridge (USB2 connector) connected to UART1 of the STM32 microcontroller. It avoids USB driver complexity and provides an easy method of communication. This makes debug output (see px_dbg.h : Debug module) as well as firmware upgrades (see XMODEM-CRC UART Bootloader) easy.

The Lite Edition does not have a USB-UART Bridge (USB2 connector), but if you are planning to use an FTDI based USB-Serial converter connected to the UART header (H17), then it may also be worthwhile following these steps.

Follow the steps HERE to install and configure the FTDI driver.

You can verify that you have noted the correct COM port by using Tera Term to connect to it. When you type characters in the terminal window, the TX LED will flash on the board.

10.5 Install Python

Click HERE to download and install Python 3. It is needed to create a UF2 file suitable for uploading via the USB UF2 Bootloader. The script can be found here:

px-lib/tools/uf2conv.py

Make sure sure that the path has been set up to find Python and it's scripts:

Start > Control Panel > System > Advanced System Settings > Environment Variables > Path
python_win_path.png

10.6 Install STM32CubeIDE

Follow the steps HERE to install STM32CubeIDE. The section also describes how to create a new project that uses an external Makefile as used in this library.

10.7 Build an example in the IDE

The tutorials and examples are provided with pre-configured STM32CubeIDE projects. External Makefiles are referenced, instead of using STM32CubeIDE's build system, to make the projects easier to maintain.

For a gentle introduction to Makefiles, see 7.2 How to understand and modify Makefiles.

Open and build the Basic GPIO example. The project file is here:

px-lib/boards/arm/stm32/px_hero/examples/gpio/.project

If the ".project" file is associated with STM32CubeIDE, then it's as simple as double-clicking on it in Windows File Explorer, otherwise you need to add it to the workspace within STM32CubeIDE:

File > Open Projects from File System...
sci_open_project.png

Specify the directory containing the STM32CubeIDE project files (".project", ".cproject" & ".settings" folder):

sci_import_project.png

Click once on the project to make sure that it is selected:

sci_project_files.png

A common mistake (for me at least) is trying to execute a project related commmand without the project being selected, for example pressing the F5 keyboard button to refresh the project, but the project does not have a light blue background (indicating that it is selected). IDE menu options related to a project may also not be available until the project is selected.

Set the active build to "BUILD_RELEASE_BOOT" to creates a size optimized release build suitable for upload to a bootloader in the "BUILD_RELEASE_BOOT" output directory:

sci_set_active_build.png

Start the build by clicking on the hammer icon or selecting "Project > Build All Ctrl+B" or pressing the "Ctrl+B" keyboard combo:

sci_start_build.png

The build output will appear in the console window:

sci_console_build_release_boot.png

Observe that the IDE is executing a make build=release-boot all command by spotting the "RELEASE FOR BOOT" text in the start and end banner. After building the app, the Makefile executes a Python script to create a UF2 file suitable for uploading via the bootloader.

10.8 Upload example to Hero Board via bootloader

After building the Basic GPIO example succesfully, you will have a UF2 file called "gpio.uf2" in the "RELEASE_FOR_BOOT" subdirectory. Follow the instructions HERE to upload the file.

After the upload is succesful, the bootloader will imediately execute the app.

The LED will start flashing at a slow 2 Hz while the 6/NO button is released and will flash at a fast 8 Hz while the button is being pressed. Success!

10.9 Build example on command line

The following steps are optional but recommended, because it shines a light on the building mechanics used by the IDE and demonstrates how firmware can be developed independent from an IDE using only your favourite editor.

Using command-line tools to build software may feel daunting and intimidating at first, but don't worry! Give it a chance and you will get used to it quickly and it will lay the foundation for you to become a power user... a true embedded hero!

10.9.1 Install UnixShellUtils

Download UnixShellUtils and extract the downloaded package to a convenient location without spaces in the path, e.g.

C:\UnixShellUtils

It is not strictly required, because STM32CubeIDE does have a similiar set of tools, but the path is rather inconvenient:

[INSTALL DIR]\plugins\com.st.stm32cube.ide.mcu.externaltools.make.win32_1.0.1.201906111312\tools\bin

10.9.2 Install GNU Arm Embedded Toolchain

Download and install GNU Arm Embedded Toolchain.

It is not strictly required, because STM32CubeIDE does have a GNU C and C++ build toolchain, but the path is also inconvenient:

[INSTALL DIR]\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-arm-embedded.7-2018-q2-update.win32_1.0.0.201904081647\tools\bin

It is recommended to specify a conveniently short installation path, e.g.

c:\Program Files (x86)\gnu_arm

The GNU Tools will then be located here:

c:\Program Files (x86)\gnu_arm\bin

The complete documentation will be located here:

c:\Program Files (x86)\gnu_arm\share\doc\gcc-arm-none-eabi\pdf

10.9.3 Perform command line build

Let's try it out!

hero_board_command_prompt_build.png

Start a windows shell Command Prompt by typing "cmd" in the search bar. Set the PATH to UnixShellUtils and GNU Arm Embedded Toolchain by executing the following command:

> PATH=c:\UnixShellUtils\usr\bin;c:\Program Files (x86)\gnu_arm\bin

You don't need to type the whole line. Copy the text above (without the ">" prompt of course), select the Command Prompt window and press the Ctrl+V keyboard combo to paste the text into the window.

Change the directory to Basic GPIO example, e.g.

> cd px-lib\boards\arm\stm32\px_hero\examples\gpio

Execute make clean to delete all of the build files:

> make clean

Execute ‘make’ to build the whole project:

> make

Congratulations Hero!!

11. The next step

You now have a working development environment and I really hope it was quick and straight forward to set up (if not, please use 1.7 Questions or Feedback?). You should be able to compile an application in the IDE and upload it using the bootloader.

To make sure, build and upload CLI Explorer (Command Line Interpreter)

HERE is a list of curated Hero Board specific examples to try out.

The next step is to learn how to write C programs for the STM32 architecture. A quick start guide with tutorials and examples have been created as an introduction. Click HERE to proceed to the STM32 quick start guide.

Alternatively, you are welcome to try out the PX-HER0 board in the Arduino IDE environment. Click HERE to proceed.