Speeding up firmware iteration

Hi all, I’m trying to speed up how fast I can iterate firmware (make a change, build, flash, and test). The problems I’m facing at the moment are:

  1. I flash via serial or DFU which requires me to go to the device, hold down some button combination, and go back to flash. This is quite cumbersome. Is there a way to eliminate the need for physical interaction with the device while flashing?
  2. I am using the serial interface to log debug messages. Since the serial interface is shared with the programming interface I need to disconnect and reconnect my serial terminal with each iteration as well. Also quite annoying.

Any suggestions would be appreciated.

  • Using Particle Workbench with an Electron

You can force the electron into DFU mode by setting the baud rate of the serial interface. Check out the Serial tutorial. For the issue with log interface vs. Programming interface, you could use a uart to ttl serial adapter and output your logs to the serial or serial1 ports. The advantage to that adapter is that the serial interface would not drop during a device reboot.

1 Like

Yes, I had almost the exact same response as ninjatill typed out when he posted.

DFU mode can be entered by connecting at 14400 baud, then disconnecting. If the device is running 0.8.0, there is also a USB control request interface that offers many new options.

One solution to the shared port problem is to do your debugging using one of the other serial ports on the Electron and a FT232 USB to TTL serial adapter. One really nice thing about this: your serial terminal won’t disconnect even when the device reboots!


@rickkas7. You put it much more eloquantly though. :wink:

1 Like

Thanks, I’ll take a look at the baud rate forcing DFU mode. I’m using serial 1 for a peripheral already but it looks like the Electron has a serial 4 available which I will try :slight_smile:

Here’s a powershell script that will flash the application automatically by DFU over USB in case it helps someone. Note: COM port needs to be customized

$ErrorActionPreference = 'SilentlyContinue'


$port= new-Object System.IO.Ports.SerialPort COM17,14400,None,8,one


#start-sleep -m 500

particle flash --usb ../target/testApp.bin

#Start-Sleep -m 500

1 Like

A simple batch that’d do the same thing in cmd or PowerShell would look like this

mode COM17 14400
particle flash --usb ../target/testApp.bin
1 Like

This is also where I would recommend po-util, but unfortunately @sho is on Windows.

heres a batch I use

echo off
set Pathname="C:\Users\wesne\Documents\GitHub\"
CD %Pathname%

cmd /c "particle compile electron --target 0.8.0-rc.10 -v firmware_Functional_Test_p1_e0 --saveTo firmware_Functional_Test_p1_e0_LTE_080rc10_33.bin"
rem cmd /c "particle compile p1 -v firmware_Functional_Test_p1_e0 --saveTo firmware_Functional_Test_p1_e0_WiFi_080rc10_32.bin"

mode COM6 BAUD=14400
rem mode COM3 BAUD=14400

timeout /T 2

cmd /c "particle flash --usb -v firmware_Functional_Test_p1_e0_LTE_080rc10_33.bin"
rem cmd /c "particle flash --usb -v firmware_Functional_Test_p1_e0_WiFi_080rc10_32.bin"

echo Press any key to return to the menu. . .
pause >nul
1 Like