Introducing the CanFlasherBLT firmware

Do you run the OpenBLT bootloader on your microcontroller based system, configured for firmware updates via the CAN bus? Does it bother you that everyone performing the firmware update, needs a fairly expensive USB-CAN PC adapter to do so? If you answered yes to both question, the CanFlasherBLT firmware might be just what you’re looking for. CanFlasherBLT is a ready-made firmware for a low-cost Olimexino STM32F3 board. Once flashed onto the board, you can use this board instead of a conventional USB-CAN PC adapter, for performing firmware updates on CAN nodes, running the OpenBLT bootloader:

Illustration of the system setup in which the CanFlasherBLT firmware is used.

How it works

The OpenBLT bootloader communicates using the XCP protocol during a firmware update. An ideal communication protocol not only for data acquisition and calibration, but also for bootloader purposes. Under the hood, CanFlasherBLT essentially implements a USB to CAN gateway for the XCP protocol:

Illustration of the XCP gateway between USB and CAN that the CanFlasherBLT firmware implements.

From an end-user perspective, you simply reconfigure the OpenBLT PC tools for firmware updates via USB, instead of CAN. This means that during the firmware update, the PC thinks it’s talking via USB with the OpenBLT bootloader on the microcontroller. CanFlasherBLT translates all USB XCP packets to CAN XCP packets unidirectionally.

Screenshot of the MicroBoot settings that you should change when using the CanFlasherBLT firmware solution.

In contrast to a conventional USB-CAN PC adapter, CanFlasherBLT supports automatic USB driver installation on Windows 10 and higher. Making it even more user-friendly for the end-user. Note that CanFlasherBLT works on Linux as well.

Why it was developed

In a way the development of CanFlasherBLT was a bit of a coincidence of certain things happening at the right time. In my spare time I was quirking around with the TinyUSB stack on an Olimexino STM32F3 board, while learning more about best practices for coding in C++ on microcontrollers. Around the same time a company using the OpenBLT bootloader contacted me. They requested information about how to best go about making their own low-cost USB-CAN PC adapter so that their customers didn’t have to purchase a more expensive conventional USB-CAN PC adapter, just to make a firmware update on their CAN nodes.

After several back and forth e-mails and me brainstorming how to best approach this, I realized that it shouldn’t take that much effort for me to develop this. I already had the Olimexino STM32F3 board sitting on my desk and running the TinyUSB stack. Furthermore, the board includes a CAN transceiver for connecting to the CAN bus. Simply put, I just had to glue the USB and CAN parts together in software. The thought of coding something like this up, piqued my interest. Especially, because I remembered that in the past years a few other customers requested something similar.

After a few evening sessions of coding, I got things running. When doing run-time performance tests and comparing it with conventional USB-CAN adapters, it worked on par and sometimes even better from a throughput perspective. I passed the code on to a handful of interested OpenBLT users and they seemed quite smitten with this solution. Based on their feedback, I decided to write up a user manual and to make the code publicly available and for free under the MIT license:

What do you need

You need the following items for getting CanFlasherBLT operational:

Regarding the board, make sure you order the Olimexino STM32F3 type. Not the Olimexino GD32F3 and also not the older Olimexino STM32. It needs to be the one with the STM32F303RCT6 microcontroller.

Getting started

To get started with CanFlasherBLT, you essentially download the prebuilt binary of the CanFlashBLT firmware and use the STM32CubeProgrammer to flash this firmware onto the board. You can find detailed getting started instructions in the online user manual:

Known limitations

By design, CanFlasherBLT has two known limitations:

  1. Is it not a fully functional USB-CAN PC adapter. It’s merely a USB-CAN XCP gateway used for the sole purpose of performing firmware updates on CAN nodes running the OpenBLT bootloader.
  2. As shown in the previous illustration, you can no longer configure the CAN baudrate and CAN identifiers in MicroBoot, once you select XCP on USB. The configuration values are now hardcoded into the CanFlasherBLT firmware. You can of course change them, but it involves rebuilding and reflashing the CanFlasherBLT firmware.

Porting to different hardware

I selected the Olimexino STM32F3 hardware because this board is the cheapest board that I had in my office, and which comes with all the needed hardware features for USB and CAN communication. This doesn’t mean you need to use this board as well. The source code includes a clear board abstraction layer, making it fairly straigthforward to port to different hardware.

You could for example design your own PCB. Alternative solutions I considered where the Infineon XMC4700 Relax Kit or any ST Nucleo-144 board that supports USB, in combination with the Waveshare RS485/CAN shield.

Wrap up

If you integrated the OpenBLT bootloader into your product and are interested in a custom low-cost USB-CAN PC adapter for performing firmware updates via CAN, the CanFlasherBLT solution is exactly what you need. You can run in on the readily available Olimexino STM32F3 board, port it to a different suitable low-cost evaluation board, or even develop your own custom PCB for this. The source code is well commented and includes a clear board abstraction layer, making it straightforward to port. Alternatively, you can contact Feaser for oursourcing this portation effort.

This entry was posted in OpenBLT and tagged , . Bookmark the permalink.