GeckoLoader: An EFM32 Bootloader’s Utility

Are you looking for a CLI or GUI utility to upload programs to EFM32 microcontrollers through the factory-programmed bootloader? Look no further.


Why EFM32 microcontrollers?

EFM32 are my first choice for low-power sensor-based systems because, well, they are “Energy Friendly Microcontrollers”, providing several interesting features specially designed for that purpose and a nice set of peripherals (go figure on their website). With a 32-bit ARM Cortex processor at its core, performance is guaranteed. They also provide support for GCC ARM Embedded toolchain which, in my opinion, is a HUGE plus, making them really nice and easy to use (or getting started with), without code size limits or having to pay for a commercial toolchain (like Keil or IAR). Silicons Labs provide all the startup code, linker scripts, an easy to use and well documented peripheral library, tools to monitor power consumption and even an Eclipse-based IDE. It’s everything inside Simplicity Studio which can be freely downloaded.

Disclosure: I don’t work at Silicon Labs and I am by any means associated with them. I’m just an EFM32 enthusiast 🙂


A great feature of EFM32 microcontrollers, by Silicons Labs, is the factory-programmed UART bootloader that may be used to upload programs into the microcontroller instead of using a commercial programmer. The bootloader uses the XMODEM-CRC protocol to transfer data and, as referred on the  application note AN0003 UART Bootloader, TeraTerm, which supports that kind of data transfers, may be used. However, if you want the capability of uploading a program through your own application a command-line utility is what you need. Look no further, you have efm32_loader which can run in CLI or GUI mode (if any arguments are provided).

Gecko Loader

CLI mode usage:

UART: efm32_loader.exe <port_name> <bin_file> uart <boot_pol>
USB:  efm32_loader.exe <port_name> <bin_file> usb

Regarding hardware, all you need is a USB-to-UART converter connected to your computer. Connections are as follows:

TX  -- BOOT_RX (E11)
RX  -- BOOT_TX (E10)
DTR -- BOOT_EN (DBG_SWCLK)
RTS -- RESET

Please be aware that, in order to prevent the bootloader from being overwritten, the linker script must be modified as described on application note AN0003.

The source code is available on Github:

https://github.com/cidadao/efm32_loader

And there’s also a Windows executable, available here:

Download

Bugs report? Suggestions or feature requests? Please use the Github or the comment section bellow.

Update (29/09/2015): added support for USB bootloader

23 thoughts on “GeckoLoader: An EFM32 Bootloader’s Utility

  1. Hello,

    I have tried your program, but i can’t connect to my board. The fail message is:
    “Unable to receive chip ID”.
    I have used a serial port monitor and i see that you send the “U” character, but the response from the board is “?”.
    Now, if i send the “i” character from a terminal program i get the response:
    “BOOTLOADER version 2.00, Chip ID 24353703536201EB”, so i think that my board is OK.
    Can you help me please?

        1. I’m very sorry, i just realized that i have used your program for the USB bootloader (AN0042).
          By the way, can you modify your program to work with the USB bootloader too? The USB bootloader is using USB CDC class (virtual serial port), so i assume that it will be very easy to
          make the modification.

          Thanks a lot,

          Konstantinos

          1. Ah that’s it!
            According to the application note:
            “Bootloader communication is initialized either by transmitting an uppercase “U” on the physical UART interface (which starts the autobaud algorithm), or by enumeration of the USB CDC virtual UART device. Whichever happens first will govern the rest of the bootloader operation.”

            So, when the USB bootloader is used the “i” character is sent in order to detect it, as you previously suggested.

            You can download the latest release here: https://github.com/cidadao/efm32_loader/releases/tag/v0.2.2

            Let me know if this works!
            You must still ensure that the bootloader is enabled by pulling-up the DBG_SWCLK pin and reseting the chip, as in this case the efm32_loader won’t do that for you.

          2. Unfortunately, the program refuse to start with message:

            The program can’t start because Qt5Widgets.dll is missing from your computer. Try reinstalling the program to fix this problem.

          3. This time the program failed with message:

            This application failed to start because it could not find or load
            the Qt platform plugin “windows”.

            Reinstalling the application may fix this problem.

            This application has requested the Runtime to terminate it in an unusual way.
            Please contact the application’s support team for more information.

          4. This time the program is starting OK. But when i try to upload a bin file it fails with message:
            Unable to receive chip ID.
            I have used again the serial port monitor and i see that the program sends the “i” character and the response from the board is OK:

            Request:
            i

            Answer:
            i

            BOOTLOADER version 2.00, Chip ID 24353703536201EB

            Maybe something is wrong with the answer parsing?

  2. Hi, cool utility 🙂

    I guess you would appreciate the “windeployqt” command which was added in Qt 5. It automatically copies in all the required dlls, including the platform stuff which is easy to forget.

    I typically run it like this in my .pro file:
    win32: {
    QMAKE_POST_LINK +=
    $$[QT_INSTALL_BINS]/windeployqt --verbose 1 --no-translations $${DESTDIR}/$${TARGET}.exe
    }

    Cheers,
    Audun

    1. Hey, thanks for the tip!
      Indeed, it helps! It copies the Qt-related libraries to the bin folder but as I’m using MinGW to build the project there are still some files I needed to copy manually (libstdc++-6.dll, libwinpthread-1.dll, etc)

  3. Dear Mário Ribeiro,
    Can u send me the Schematic of please I am confused about the Schematic part. I am using CP2102 Usb2Serail Converter and EFM32G232F-128 . Please Help me with Exact connection.Can you send me details on my Email Id

    1. Hi Patrik,
      I don’t have a schematic, but the connections are described on this blog post. What can’t you understand?
      Are you using EFM32 Loader in CLI or GUI mode? Try BOOT_EN with HIGH (1) and LOW (0) value.

      1. Hello Mário Ribeiro,

        Thanks for reply, I have made the connection as specified in the “AN0003” reference PDF. And when I Run the VO.2.2 in windows 7. On first line it is showing “Connected ” but when I try to upload the code it is saying “Unable to get device Id “.

        Regards
        Pratik Shirore

        1. Hi Patrik,
          That message means the EFM32 Loader is unable to detect the bootloader inside you MCU.
          What part number are you using? Does it have a USB or UART bootloader?
          Have you programmed the MCU before, using a commercial programmer (e.g. SEGGER J-Link or equivalent)?

  4. I tried this out today with the AN0042 USB bootloader, and noticed the same “Unable to receive chip ID” problem. Further up, you mentioned changing it to simply look for “chip”, but it looks like the code is still looking for “ChipID”.

    I noticed is that AN0003 puts “ChipID” in the string, and AN0042 puts “Chip ID” (with a space between “Chip” and “ID”), which I’m guessing is the problem. Any chance you could roll that change (back?) into your code?

    The bootloader itself seems fine… I can upload just fine using a regular terminal program. Your GUI would just be a bit more convenient. 🙂

    Thanks,
    Pat

    1. I wasn’t aware of AN0042 but yes, that’s probably the case!
      Which part are you using by the way?

      I’ll change the code to look just for “chip” (lower case) and I’ll let you know when the new release is avalable.

      You can also run it in CLI mode, which may be useful during (automated) production setups. Usage:
      gecko_loader.exe [port_name] [file_path] uart [boot_pol]
      gecko_loader.exe [port_name] [file_path] usb

      Thanks,
      Mario

      1. Seems to work perfectly… thanks for the super-quick fix! BTW, I’m running the Giant Gecko, which comes with the AN0042 bootloader pre-loaded.

        Pat

Leave a Reply

Your email address will not be published. Required fields are marked *