Skip to main content

Loader

The STM32C071 chip utilized on all DUELink modules include the ST loader that is used for Firmware Updates and Firmware Cloning.

For firmware updateThis loader is used to load a firmware, which can be the official DUELink or MicroBlocks' firmware options. However, it can load a custom firmware built using C++, or Arduino.


Firmware Update

Firmware updates are typically sent from a PC to a single module, or the first module in Daisylink. Start by connecting the module to a PC using a USB. Modules that do not have USB connection will need to be chained to an adapter, like USB Hook.

USB Hook servo

We recommend using the DUELink Console, which can load the official DUELink firmware or MicroBlocks firmware.

tip

Loading custom firmware is covered on the C++ and Arduino pages.

From https://console.duelink.com/, click Firmware on the top menu. You now have options to put the module in DFU mode: The first option to Erase All, which is hte easier and the recommended approach.

Erase All

tip

The Erase All feature automatically detects DUELink vs MicroBlocks firmware and sends the appropriate command to self-erase. Erase All will not work with your own custom firmware!

Once the device is Erased All, it will automatically enter the DFU Mode. With USB drivers loaded, the system will detect a USB DFU in FS Mode device. On Windows, you can optionally verify Device Manager. If the device shows an error, you may need to download and install the USB drivers.

Verify DFU mode

You can now click the Connect button and select the desired firmware to load.

tip

Driver scripts update is required after a firmware update.

Force DFU Mode

You can optionally force DFU mode, like if Erase All failed or if a custom firmware was loaded. This is simply done by connecting LDR pin to high-level on system reset or power up. On some modules, LDR pin is connected to a button labeled LDR or A.

Setting Boot mode mode

Modules that do not have a button, they have 2 pads instead.

Module Loader Pads

info

For power users: LDR pin is the name we use for STM32's BOOT0 pin.

To force a module in DFU mode press and continue to hold the LDR or A button while resetting the board (clicking reset button or re-power). If neither LDR nor A button is available, then bend and place a small metal paper clip (or a wire) between the 2 LDR Pads, and reset/re-power the board. You can remove the paper clip after the board is powered up.

Setting Boot mode

Upon forcing DFU Mode successfully, the module will present itself as a DFU device. If this is done on a PC for the first time, check the Device Manager to verify the USB Driver is installed, as explained under the drivers section on this page.

tip

This option "forces" the system into DFU Mode. It does not erase or modify the module's contents, till new firmware is sent.

Once in DFU mode, go to https://console.duelink.com/, click Firmware on the top menu then Connect.


Firmware Cloning

This is a great feature that allows a module to clone its own firmware to the next module in a Daisylink. Cloning can be executed on any "selected module" using Sel(), which then will erase the "next module" in the chain, and then load "next module" with a clone of the firmware of the "current module".

Note that the device getting written to will have a firmware clone but will not have any Driver Script after cloning is done. Loading the Driver Script will be necessary.

tip

The device getting updated will automatically get enumerated to the same address it previously had. The "cloner" will internally use the private SetAdd() command.

The cloning feature can be used to update the firmware on a module (or a chain of modules) that does not have a USB connection, and without using USB Hook. In this example, PixoBit can be loaded with the latest firmware and then it can be cloned to the chained modules.

Verify DFU mode

Important notes:

  1. Cloning can only be executed on chains of modules that are loaded with DUELink official firmware.
  2. Cloning can not be done on blank modules, even if they are already in DFU mode, pre loading with DUELink official firmware is required.
  3. Cloning is disabled when Downlink port is not in the default Daisylink mode, including host mode.

Cloning is meant to be sent to the device from its interface. But, here is a simple example to clone the current module to the next using a script! This can be ran in the Console.

# wait for enumeration, blink meanwhile!
while getadd() = 0
dwrite(0,1) # STAT LED is always pin 0
wait(100)
dwrite(0,0)
wait(100)
wend

# We are enumerated!
r = clone()

println("Cloned fw from: ", getadd(), " to: ", r)

It is also possible to Clone() the firmware to the entire chain. Here is Python example that clones the firmware found on device 1 to all modules in the chain, one by one.

import time
from DUELink.DUELinkController import DUELinkController

availablePort = DUELinkController.GetConnectionPort()
duelink = DUELinkController(availablePort)

def GetDeviceCount():
return int(duelink.Engine.ExecuteCommand("GetCnt()"))

for i in range(1, GetDeviceCount()):
duelink.Engine.Select(i)

timeout = duelink.ReadTimeout

# Clone can take up to 30 seconds
duelink.ReadTimeout = 30

responsed = int(duelink.Engine.ExecuteCommand("Clone()"))

if responsed != (i + 1):
print(f"Cloning from {i} to {i+1} failed")
break
else:
print(f"Cloning from {i} to {i+1} succeeded")

# Restore the default timeout
duelink.ReadTimeout = timeout

DFU USB Drivers

DFU is a standard USB class that is supported by all major operating systems.

While Windows supports DFU, it sadly does not automatically install the DFU drivers, and it may not prompt you to install them! If in doubt, just install the USB drivers from the downloads page.

With a properly installed driver, the Device Manager will show DFU in FS Mode with no errors.

Verify DFU mode


UART Update

This page focuses on firmware updates using USB DFU mode. We recommend using USB DFU whenever possible; however, using UART to send firmware updates over Uplink connectors is an (unsupported) option.

info

Firmware Cloning uses this UART update internally.

Consult the STM32 documentation for further UART update details.