Skip to content
Bryce Johnson edited this page Apr 18, 2021 · 19 revisions

Requirements to Compile STMBL Firmware

Linux/Mac? Add your username to the dialout group to be able to access the com ports. If you have used the Arduino IDE before, this is probably already set:

sudo usermod -a -G dialout username

Linux udev rules:

SUBSYSTEM=="usb", ACTION!="add", GOTO="objdev_rules_end"
#stmbl
ATTR{idVendor}=="0483", ATTR{idProduct}=="5740", ENV{ID_MM_DEVICE_IGNORE}="1", GROUP="users", MODE="0666"
#ST USB bootloader
ATTR{idVendor}=="0483", ATTR{idProduct}=="df11", GROUP="users", MODE="0666"
LABEL="objdev_rules_end"

If you get AT commands showing up in servoterm some application is sending commands to the virtual serial port despite the ENV{ID_MM_DEVICE_IGNORE}="1" above. For example on xfce with debian 10, ModemManger may need to be stopped with systemctl disable ModemManager.service or removed with sudo apt-get purge modemmanager

Flashing STMBL Hardware

STMBL has a USB bootloader on both controllers to flash new firmware. This requires dfu-util to be installed.

Flashing the LV side with dfu-util can be invoked by make btburn. If dfu-util detects multiple targets, make sure to connect only one STMBL board. The bootloader should be entered automatically. If not, adjust the printf statement in the btburn target to your device.

Flashing the HV side can be done with make -f stm32f303/Makefile btburn. There is a bug with the F3 processor on the HV side where you probably have to plug cycle the USB connection a couple of times to successfully enter the bootloader when flashing with dfu-util.

When the firmware is corrupted, or to flash the f1 micro controller on the high voltage side of older STMBL v3, you need to flash via SWD (serial wire debug).

The bootloader can also entered by shorting DIO to GND.

Using SWD

SWD requires an st-link programmer which can be found on ebay, or on any STM Discovery board. Install stlink: https://github.com/texane/stlink

For v4 boards, flashing via SWD:

  • For the STM32 F4 (low voltage):
    make flash
    make -f bootloader/Makefile flash
  • For the STM32 F3 (high voltage):
    make -f stm32f303/Makefile flash
    make -f f3dfu/Makefile flash

To use an stm32f4 discovery as an stlink programmer:

  • remove both jumpers from CN3 on the discovery board
  • connect pin 2,3,4,5 of the SWD connector to CLK,GND,DIO,RST on the STMBL board