> For the complete documentation index, see [llms.txt](https://docs.fencyboy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fencyboy.com/technical-documentation/firmware-update.md).

# Firmware Update

## Fencyboy v1.3.1

This guide explains how to update the firmware on a Fencyboy sensor unit using a USB-TTL converter and the CubeCellFlash tool.

The update is normally completed in a few minutes per unit.

### Required items

You will need:

* Fencyboy sensor unit
* USB-TTL converter with 3.3 V output and 3.3 V logic level. Do **not** use a 5 V USB-TTL converter, 5 V supply, or 5 V logic signals. The converter should optionally provide RTS and DTR signals for automatic reset/bootloader control.
* Jumper wires with female ends to connect to the Fencyboy
* Computer with Windows, macOS, or Linux
* CubeCellFlash tool from Heltec (find the download link below)
* The correct `.cyacd` firmware file for the specific Fencyboy unit (which can be requested from the manufacturer)

### 1. Disconnect other power sources

Before connecting the USB-TTL converter:

* Disconnect the battery.
* Cover or disconnect the solar panel.
* Do not power the Fencyboy from the battery or solar panel during flashing.

The Fencyboy will be powered directly from the USB-TTL converter through the 3.3 V pin.

### 2. Connect the USB-TTL converter

Connect the USB-TTL converter to the 6-pin programming header of the Fencyboy.

Use the following wiring:

| 3V3 | 3V3                                        |
| --- | ------------------------------------------ |
| RX  | TX (crossover with RX from Fencyboy)       |
| TX  | RX (crossover with TX from Fencyboy)       |
| DTR | DTR (optional, but only together with RTS) |
| RTS | RTS (optional, but only together with DTR) |
| GND | GND                                        |

The RX and TX lines must be crossed: Fencyboy RX goes to USB-TTL TX, and Fencyboy TX goes to USB-TTL RX. Note that the label on your USB-TTL programmer might already be swapped to account for this crossover.&#x20;

The reset control lines (DTR and RTS) are optional. However, they must be treated consistently.&#x20;

Either connect both control lines or connect neither of them. Do not connect only one of RTS or DTR. The images below show the two possible configurations.&#x20;

{% columns %}
{% column %}

<figure><img src="/files/ZAVmCkJJgwV8m2rThmjS" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="/files/QzytgVZ2sa1dBzyREf5b" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

### 3. Download CubeCellFlash

Download the CubeCellFlash tool for your operating system from the Heltec download page:

```
https://resource.heltec.cn/download/
```

<figure><img src="/files/7Hphg2FUDhaWaAB0TqKt" alt=""><figcaption></figcaption></figure>

Download the matching archive, e.g., *CubeCellflash-0.0.1-macos.tar.gz*, for your operating system, then unpack it somewhere convenient, for example into a folder called *Fencyboy-Frimware-Update* in your Downloads folder.

### 4. The Firmware File

Copy the provided Fencyboy firmware file into the unpacked CubeCellFlash folder, i.e., *Downloads/Fencyboy-Frimware-Update*. You can get the file from the manufacturer.&#x20;

The firmware file has the extension:

```
.cyacd
```

Example:

```
Fencyboy-v1-3-1-build-100-firmware-EU868.cyacd
```

Use the firmware file that was provided for the specific unit you are flashing because it contains the LoRaWAN configuration, e.g., DevEUI.&#x20;

### 5. Find the serial port

Connect the USB-TTL converter to your computer.

The serial port may appear as something like:

On Windows:

```
COM5
```

On macOS:

```
/dev/cu.usbserial-0001
```

On Linux:

```
/dev/ttyUSB0
```

or

```
/dev/ttyACM0
```

### 6. Flash the firmware

Open a terminal or command prompt and navigate into the *Downloads/Fencyboy-Frimware-Update* folder.

Run the flashing command using the correct serial port and firmware filename. You can adapt the examples below.&#x20;

{% hint style="info" %}
If RTS and DTR are not connected you need to press the buttons manually before issuing the command below.&#x20;

* Hold down the USER button on the Fencyboy.
* Press and release the RESET button.
* Start the CubeCellFlash command from the terminal.
* Keep holding the USER button until the upload is in progress.
* Release the USER button during the upload process.
* After the upload is complete, press RESET once.
  {% endhint %}

#### macOS / Linux example

```
./CubeCellflash -serial "/dev/cu.usbserial-0001" Fencyboy-v1-3-1-build-100-firmware-EU868.cyacd
```

#### Windows example

```
CubeCellflash.exe -serial "COM5" Fencyboy-v1-3-1-build-100-firmware-EU868.cyacd
```

During flashing, the output should show the bootloader initialization, upload progress, checksum verification, and reboot.

A successful flash should look similar to this:

```
Initialising bootloader.
Silicon ID ..., revision 0.
Verifying rows.
Starting upload.
Uploading ( 10 / 100 )
Uploading ( 20 / 100 )
...
Uploading ( 100 / 100 )
Checksum verifies OK.
Rebooting.
Total upload time 14.35s
```

<figure><img src="/files/UJXa67awmvEbBh2gKqXh" alt=""><figcaption></figcaption></figure>

Thats it and you are done with the update. See [#troubleshooting](#troubleshooting "mention") in case of errors.

### 7. Optional: Check the serial log after flashing

After the firmware update, the device should reboot automatically and try to join the LoRaWAN network.

You can monitor the serial output using a serial monitor such as:

* PuTTY
* Arduino IDE Serial Monitor
* PlatformIO Serial Monitor
* Any other terminal program

Use the following serial settings:

```
Baud rate: 115200
Data format: 8N1
```

A normal startup log should show the system booting, reading battery voltage, starting LoRaWAN, and attempting to join the network.

Example output:

```
[System] Starting...
[ADC] Battery voltage 3.417V
LoRaWAN EU868 Class A start!
[Communication] Device EUI: 70000000000000
[Communication] Joining...
```

### 8. Reconnect the unit

After the firmware update:

1. Disconnect the USB-TTL converter.
2. Start the unit as described in [Getting Started](/getting-started.md)

The device should now start normally and try to join the LoRaWAN network using the configured credentials.

### Troubleshooting

#### CubeCellFlash reports a timeout

Try the following:

* Unplug and reconnect the USB-TTL converter.
* Check that the correct serial port is used.
* Check that RX and TX are crossed.
* Check that the USB-TTL converter uses 3.3 V supply and 3.3 V logic levels.
* If RTS and DTR are not connected, use the manual USER/RESET button sequence.
* If using RTS and DTR, make sure both are connected as described above. Do not use RTS or DTR alone, only in combination.&#x20;

#### Device does not power on

Make sure that:

* 3V3 from the USB-TTL converter is connected.
* GND is connected.
* The USB-TTL converter can provide 3.3 V power.
* The battery and solar panel are disconnected or inactive during flashing.

#### Device flashes successfully but does not join the LoRaWAN network

Check that:

* The correct firmware file was flashed.
* The device was registered with the correct DevEUI and AppKey.
* The firmware region and frequency plan match the network configuration.
* The device has sufficient battery voltage after reconnecting the battery.
* The serial log shows join attempts after reboot.

Please contact the manufacturer in case of further problems.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fencyboy.com/technical-documentation/firmware-update.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
