Test run with the StromPi 3

So much for the spec now it’s time to get our hands on the hardware for a test run with the StromPi 3. The first thing to note for anyone using a Raspberry Pi 3 model B is that it will be necessary to reconfigure the serial communication interface to the RPi Bluetooth module so that we can use it for serial communication to the StromPi 3 for communication and parameterization purposes.
This is only apparent after consulting the installation instructions. After changing the interface, we can use the StromPi 3 and Bluetooth, but for the latter, limitations occure. For Bluetooth and StromPi 3 we can add the lines below to the file /boot/config.txt:
dtoverlay=pi3-miniuart-bt
core_freq=250
init_uart_clock=3000000

After configuration, it is possible to configure the StromPi and change its settings via a serial console. A quick visit to the Homepage provides access to a beta version of the firmware, which updates some useful functions and fixes a few small bugs with some parameters. You will just need to go through the firmware update procedure.

The Firmware update

A manual is provided which includes instructions to update the firmware. We will use the STM32flash tool to write the firmware to the chip. In the actual Raspberry Pi 3B+ configuration we will specify the use of the miniUART which is a slimmed-down UART version, missing some of the usual features. This miniUART is used with its customized functions for Bluetooth communications and the following features of serial communication are missing:
 
  • Break detection
  • Framing-error detection
  • Parity Bit
  • Receiver Timeout Interrupt
  • DCD, DSR, DTR and RI signal

Most of this will not bother us, but the missing parity bit makes it necessary to use the UART. The stm32flash tool communicates with the STM32 on the StromPi with 9600 baud 8 data bits, one stop bit and even parity (96008E1). For this to work, we need to make changes in /boot/confi.txt file. By entering:
dtoverlay=pi3-miniuart-bt
in the /boot/config.txt file instructs that the miniUART is used and is available at the GPIO pins in place of the normal UART signals. We need to use the package management to install the latest version of the STM32flash program and download the latest version of the Firmware. The update is performed according to the instructions. To carry out the flash procedure we just enter
stm32flash /dev/serial0 -w RB-StromPi3_Revxxxxxx.binary -b 9600
at the terminal. It’s so simple, what could possibly go wrong? Well, if you are not paying attention and accidentally select another file instead of the .binary file for example, if you are not paying attention by the tab completion the wrong file will simply be flashed to the chip’s memory.

And unfortunately that happened on the lab bench. By the time anyone noticed , it was too late, when the StromPi 3 was rebooted, all the security features of the chip were incorrectly set by the contents of the wrong file. In this state it’s not possible to revert to any default state, even with the debugger. This is an important security feature of the chip but if you accidentally flash it with the wrong file then there is no way back. The boot loader in the ROM is of no help also. It would be nice to be able to say "No StromPi 3 was harmed during the making of this review ", but hey, that's a bit embarrassing. That particular board was put aside with a post-it note indicating a new STM32 was needed. Fortunately we were able to make use of a second StromPi 3 supplied.

Commissioning and configuration

We were eventually able to successfully update the firmware on this new board without incident. We moved the ‘CAP’ jumper on the board to its ‘ON’ position so that the 1F capacitor act as a buffer for the supply voltage. Without these capacitors, the StromPi 3 does not provide a smooth power transition to the RPi when switching voltage sources. The StromPi 3 is configured via a serial terminal. In our case we want to configure the supply options so that an external 12 V connected to the wide-range input terminals is the primary power source and the LiFePo4 battery is the secondary power source.

The configuration procedure is described in the manual, we set the StromPi 3 mode to 4 and the shutdown timer to 10 minutes (600 seconds). Should the primary power source return within 10 minutes, the timeout period is aborted and the Pi keeps running. Following the instructions to ‘set-timer 600’ we received in response ‘The Shutdown timer has been set to 88 seconds’. Not exactly what we had requested, so let's try ‘set-timer 255’, this time the replay came back ‘The shutdown timer has been set to 255 seconds’ but ‘set-timer 256’, came back with the reply ‘The shutdown timer has been set to 0 seconds’. It looks like any value higher than 8-bits is being ignored giving a limit to the counter value of 255. The bug was reported by email to the support at JOY-iT, I could have used the support forum, but chose the email option instead.

Firmware updates and Support

The reply to the bug report came quickly, and also questions about the source code and the pin assignments of the STM32 were answered quite openly. For a lot of products, manufacturers are more reticent about releasing firmware details, but for the StromPi 3 the opposite is the case. The company has uploaded the firmware source code (and schematics) to GitHub, so you can check pin assignments as well as the STM32 configuration and hardware functions. This effectively allows anyone to patch the firmware according to their own needs or check for bugs themselves. This open approach is to be applauded and helps build customer confidence in a product — knowing that it enjoys the support of a growing community of users. Each new firmware release incorporates suggestions from users and any bug fixes; the reported timer bug has also been fixed the latest version. Let’s hope the company intends to maintain this level of product support.