Code Docs

BloxOsLite (New Release!)

<aside> ⚠️ You only need to flash UbiSwitch if you currently have an unflashed UbiSwitch. If we have supplied you with a pre-flashed version, you do not need to run these steps.

</aside>

At-a-glance

Download the latest release (or older releases) here

Software architecture

An overview of the architecture is shown below.***

Each firmware release is initially flashed (along with its bootloader) only once using the JTAG/SWD interface to the CPU on the BotBlox board. This should only be done during production. Over time as the feature set of BloxOsLite matures, we’ll

Following this, subsequent updates occur over UART using MCUmgr management subsystem.

graph TD
  Bootloader -- Boots --> BloxOsLite
  MCUMgr -. Update over UART .-> Bootloader
  Flashing -. Flash over SWD .-> Bootloader
  Flashing -. Flash over SWD .-> BloxOsLite

<aside> 🚨 ***Customers using UbiSwitch Rev B may be using a 64Kb MCU instead of 128Kb MCU due to a manufacturing error, which we have now resolved for future boards. This only affects a few boards existing out there but please visit the below page to view different instructions on flashing.

UbiSwitch Revision B Modifications

</aside>

Flashing firmware

Requirements

We have two choices

Less wiring but expensive

More wiring but cheap

Steps

  1. Download and unzip the binaries on the release page. Please choose the latest release.

    1. (SIMPLE) If there is a combined bootloader and app binary provided, then you can use this and only need to flash one file.
      1. app_with_bootloader_vX.X.X_YYYYMMDD.hex with the version number and date.
    2. (ALTERNATIVE) 3 files: bootloader.hex , app.hex and app_dfu.bin are provided
      1. bootloader.hex = bootloader binary
      2. app.hex and app_dfu.bin = application binaries (in hex and bin file format, used for flashing and upgrades over serial respectively).
  2. Connect the debug probe to your host machine. Confirm the debug probe is found by your system.

    1. If using ST-Link probes: On STM32CubeProgrammer, refresh Serial number in STLINK configuration tab to find your probe. Ensure Port=SWD .

      Screenshot 2024-04-12 at 17.55.55.png

      After this step, go to ‣

    2. If using J-Link probes: Load SEGGER J-Link Configuration (or JLinkConfig) and confirm the appearance of your debug probe

      Screenshot 2024-04-13 at 00.39.28.png

      Connect the 6 pin TC2030 cable with 20 pin adapter directly into the J-Link debug probe.

      After this step, go to ‣

  3. Wire up your ST-Link probe to your TC2030 cable as shown below. Please make sure to double check your wiring to prevent shorts

Wire up the signals on the probe according to the diagram shown for the 6 pin TC2030 cable.

Wire up the signals on the probe according to the diagram shown for the 6 pin TC2030 cable.

[ST-Link STM8/STM32 V2-compatible programmer: ARM Debug SWD capable debugging probe that allows debugging software on host machine to program BotBlox board.](https://botblox.notion.site/ST-Link-STM8-STM32-V2-compatible-programmer-ARM-Debug-SWD-capable-debugging-probe-that-allows-debug-23bc19510cf9448a88ebe269d2fe0a34)

 =  =  = 
 =

1 = GND 2 = SWCLK 3 = RST 4 = SWDIO

[TC2030-CTX-NL 6-Pin “No Legs” Cable for ARM Debug SWD interfaces: used to connect to SWD interface on BotBlox board to debugging probe.](https://botblox.notion.site/TC2030-CTX-NL-6-Pin-No-Legs-Cable-for-ARM-Debug-SWD-interfaces-used-to-connect-to-SWD-interface-o-443d66f76bba4474829872e730b977f3)

  1. Plug the 6 pin needle connector to the SWD interface on your BotBlox board.

    1. On UbiSwitch, this is connector J9
  2. Power on the board.

  3. Flash the binaries.

    1. Either flash the combined binary file or bootloader.hex and app.hex separately. See [Download and unzip the binaries on the release page. Please choose the latest release.](https://botblox.notion.site/Download-and-unzip-the-binaries-on-the-release-page-Please-choose-the-latest-release-d6380d4c12be4abbbebc271d6f94daf9)

    2. Please ensure the 6 pin needle adapter is always making good contact with the J9 connector interface otherwise errors can occur.

    3. If using ST-Link probes: On STM32CubeProgrammer, click Connect and verify the correct target information shown.

      Screenshot 2024-04-12 at 22.09.46.png

      In Erasing & Programming tab, select the first file. Ensure that Run after programming is deselected.

      Screenshot 2024-04-13 at 00.18.37.png

      After this, repeat with the second file, if necessary. Ensure that Skip flash erase before programming is selected if programming a second file.

    4. If using J-Link probes: In JFlashLite , select the STM32G071KB device with SWD interface.

      Screenshot 2024-04-13 at 00.46.16.png

      Select first file, then click Program Device to program the bootloader.

      Screenshot 2024-04-13 at 00.47.30.png

      Repeat this step for second file, if necessary.

  4. Power cycle the board and wait for the boot LED to turn off. You are then able to open a serial console into the CLI over UART.

    1. Baudrate: 115200 bits per second
    2. 8 data bits per character, no parity checking and 1 stop bit

Updates using MCUmgr

After flashing the firmware and using the device in the field, you will need to perform an update when we make new releases of BloxOsLite.

<aside> 🚨 You can ignore this step if you are already running the latest version.

</aside>

Requirements

Steps

  1. Download the binaries on the release page
    1. Unlike previously, you will only need the app_dfu.bin binary.
  2. Connect the USB-UART converter from your host machine to the UART connector on the BotBlox board.
    1. On UbiSwitch Baseboard, this is connector J18.
  3. Clone and build the MCUmgr client.
  4. Using mcumgr-client in ‣
    1. Power on the board. Notice the LED will turn on to indicate that the device is in firmware loader mode but only for a set amount of time. You will need to make sure that any MCUmgr commands you run occur when the board is in this mode.

    2. mcumgr-client -d /dev/ttyUSB0 list is useful for forcing the board to remain in serial recovery mode. You can use this command to view the current version installed too. Note that /dev/ttyUSB0 is the device name for the USB-UART converter, which may be different on your host machine. Below is a typical readout.

      mcumgr-client 0.0.4, Copyright © 2024 Vouch.io LLC
      
      00:06:54 [INFO] send image list request
      00:06:55 [INFO] response: {
        "images": [
          {
            "hash": [
             ...
            ],
            "slot": 0,
            "version": "0.1.0"
          }
        ]
      }
      
    3. mcumgr-client -d /dev/ttyUSB0 upload app_dfu.bin to actually upload the latest app_dfu.bin to the primary slot. Note that this will erase the previous version permanently so once you reset, you will be booted to the new version.

      mcumgr-client 0.0.4, Copyright © 2024 Vouch.io LLC
      
      00:07:53 [INFO] upload file: app_dfu.bin
      00:07:53 [INFO] flashing to slot 1
      00:07:53 [INFO] 65536 bytes to transfer
        [00:00:13] [==============================================================================] 64.00 KiB/64.00 KiB (0s)00:08:06 [INFO] upload took 13s
      
    4. mcumgr-client -d /dev/ttyUSB0 reset to trigger a reboot

  5. If you notice bugs or missing features, please report them as issues on our GitHub or BotBlox forum. Note that the process to downgrade versions is the same as upgrade except that you can choose a particular version

Table of Contents