DEV Community

Wojtek Siudzinski
Wojtek Siudzinski

Posted on • Originally published at on

Go for Particle Argon, Boron or Xenon

Go for Particle Argon, Boron or Xenon

With the release of TinyGo 0.13, you can now write firmware for Particle Argon, Boron and Xenon in Go:

There are some caveats for now, namely:

  1. TinyGo can't coexist with the Particle Device OS. Meaning flashing your Go app to the device will erase Particle bootloader and system. It is still possible to restore the device to "stock" but it requires manual flashing of all necessary parts.
  2. TinyGo doesn't support Argon's WiFi coprocessor nor Boron's cellular modems yet, meaning for now you can only use the devices offline. Ayke is making progress on support for the nRF Soft Device that allows BLE support (and Mesh in the future) but it's still experimental.
  3. You need to use the Particle Debugger to do all the flashing. It might be possible to use Adafruit nRF52 Bootloader (same as used for CircuitPython) in the future to allow flashing over the USB.

That being said, running TinyGo might be a nice alternative to CircuitPython if you need more speed. How fast is it? Well, it can handle a real-time flight controller for a drone on Arduino Nano33 IoT with SAMD21 Cortex-M0 at 48 MHz:

Or drive six 32x32 RGB LED matrices on Cortex-M4:

Additionally, a strong advantage of TinyGo is that TinyGo is written in Go itself! Meaning, you don't need to know C/C++ to understand/contribute or write low-level code.

Got you interested? Let's proceed to the...



Necessary software

  1. Install OpenOCD. If you have Particle Workbench installed, it should already download it for you to ~/.particle/toolchains/openocd directory. Make sure the openocd binary is in your PATH.
  2. Install TinyGo


Well, that's it really. Now you're ready to go write Go:

package main

import (
    // machine package exposes all hardware available on the microcontroller

func main() {
    // All the pins are listed here:
    led := machine.LED
    // Make it an output
    led.Configure(machine.PinConfig{Mode: machine.PinOutput})
    // Repeat forever
    for {
        // Turn it on (it's active low)
        time.Sleep(time.Millisecond * 500)

        // And off
        time.Sleep(time.Millisecond * 500)

Now you can flash your app with:

$ tinygo flash -target=particle-xenon blink

(assuming you save the Go code above in blink directory). Also, you should set the -target flag to the module you're using.


Even although Argon and Boron can't connect to the internet yet, peripherals like UART, GPIO, SPI, I2C, ADC, and PWM are working, and there are already plenty of drivers for devices like displays, sensors, etc.

I hope you'll have fun with TinyGo and if you like to chat about it or contribute, feel free to join the Slack channel and check out the GitHub repos.

Discussion (0)