Skip to content

Commit e31017b

Browse files
author
Scott Powell
committed
Merge branch 'main' into dev
2 parents 187eea1 + 6e670aa commit e31017b

File tree

3 files changed

+152
-38
lines changed

3 files changed

+152
-38
lines changed

docs/faq.md

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ author: https://github.com/LitBomb<!-- omit from toc -->
6464
- [6.3. Q: How to connect to a repeater via BLE (Bluetooth)?](#63-q-how-to-connect-to-a-repeater-via-ble-bluetooth)
6565
- [6.4. Q: I can't connect via Bluetooth, what is the Bluetooth pairing code?](#64-q-i-cant-connect-via-bluetooth-what-is-the-bluetooth-pairing-code)
6666
- [6.5. Q: My Heltec V3 keeps disconnecting from my smartphone. It can't hold a solid Bluetooth connection.](#65-q-my-heltec-v3-keeps-disconnecting-from-my-smartphone--it-cant-hold-a-solid-bluetooth-connection)
67+
- [6.6. Q: My RAK/T1000-E/xiao\_nRF52 device seems to be corrupted, how do I wipe it clean to start fresh?](#66-q-my-rakt1000-exiao_nrf52-device-seems-to-be-corrupted-how-do-i-wipe-it-clean-to-start-fresh)
68+
- [6.7. Q: WebFlasher fails on Linux with failed to open](#67-q-webflasher-fails-on-Linux-with-failed-to-open)
69+
6770
- [7. Other Questions:](#7-other-questions)
68-
- [7.2 Q: How to update ESP32-based devices over the air?](#72-q-how-to-update-esp32-based-devices-over-the-air)
6971
- [7.1 Q: How to update nRF (RAK, T114, Seed XIAO) repeater and room server firmware over the air using the new simpler DFU app?](#71-q-how-to-update-nrf-rak-t114-seed-xiao-repeater-and-room-server-firmware-over-the-air-using-the-new-simpler-dfu-app)
72+
- [7.2 Q: How to update ESP32-based devices over the air?](#72-q-how-to-update-esp32-based-devices-over-the-air)
73+
- [7.3 Q: Is there a way to lower the chance of a failed OTA device firmware update (DFU)?](#73-q-is-there-a-way-to-lower-the-chance-of-a-failed-ota-device-firmware-update-dfu)
7074

7175
## 1. Introduction
7276

@@ -533,9 +537,57 @@ You can get the epoch time on <https://www.epochconverter.com/> and use it to se
533537

534538
**A:** Heltec V3 has a very small coil antenna on its PCB for Wi-Fi and Bluetooth connectivity. It has a very short range, only a few feet. It is possible to remove the coil antenna and replace it with a 31mm wire. The BT range is much improved with the modification.
535539

540+
### 6.6. Q: My RAK/T1000-E/xiao_nRF52 device seems to be corrupted, how do I wipe it clean to start fresh?
541+
542+
**A:**
543+
1. Connect USB-C cable to your device, per your device's instruction, get it to flash mode:
544+
- For RAK, double click its reset button
545+
- For T1000-e, quickly disconnect and reconnect the magnetic side of the cable from the device TWICE
546+
- For Heltec T114, click the reset button once (the bottom button)
547+
- For Xiao nRF52, click the reset button once. If that doesn't work, quickly double click the reset button twice. If that doesn't work, disconnection the board from your PC and reconnect again ([seeed studio wiki](https://wiki.seeedstudio.com/XIAO_BLE/#access-the-swd-pins-for-debugging-and-reflashing-bootloader))
548+
5. A new folder will appear on your computer's desktop
549+
6. Download the `flash_erase*.uf2` file for your device on flasher.meshcore.co.uk
550+
- RAK WisBlock and Heltec T114: `Flash_erase-nRF32_softdevice_v6.uf2`
551+
- Seeed Studio Xiao nRF52 WIO: `Flash_erase-nRF52_softdevice_v7.uf2`
552+
8. drag and drop the uf2 file for your device to the root of the new folder
553+
9. Wait for the copy to complete. You might get an error dialog, you can ignore it
554+
10. Go to https://flasher.meshcore.co.uk/, click `Console` and select the serial port for your connected device
555+
11. In the console, press enter. Your flash should now be erased
556+
12. You may now flash the latest MeshCore firmware onto your device
557+
558+
Separately, starting in firmware version 1.7.0, there is a CLI Rescue mode. If your device has a user button (e.g. some RAK, T114), you can activate the rescue mode by hold down the user button of the device within 8 seconds of boot. Then you can use the 'Console' on flasher.meshcore.co.uk
559+
560+
561+
### 6.7. Q: WebFlasher fails on Linux with failed to open
562+
563+
**A:** If the usb port doesn't have the right ownership for this task, the process fails with the following error:
564+
`NetworkError: Failed to execute 'open' on 'SerialPort': Failed to open serial port.`
565+
566+
Allow the browser user on it:
567+
`# setfacl -m u:YOUR_USER_HERE:rw /dev/ttyUSB0`
568+
536569
---
537570
## 7. Other Questions:
538571

572+
### 7.1 Q: How to update nRF (RAK, T114, Seed XIAO) repeater and room server firmware over the air using the new simpler DFU app?
573+
574+
**A:** The steps below work on both Android and iOS as nRF has made both apps' user interface the same on both platforms:
575+
576+
1. Download nRF's DFU app from iOS App Store or Android's Play Store, you can find the app by searching for `nrf dfu`, the app's full name is `nRF Device Firmware Update`
577+
2. On flasher.meshcore.co.uk, download the **ZIP** version of the firmware for your nRF device (e.g. RAK or Heltec T114 or Seeed Studio's Xiao)
578+
3. From the MeshCore app, login remotely to the repeater you want to update with admin priviledge
579+
4. Go to the Command Line tab, type `start ota` and hit enter.
580+
5. you should see `OK` to confirm the repeater device is now in OTA mode
581+
6. Run the DFU app,tab `Settings` on the top right corner
582+
7. Enable `Packets receipt notifications`, and change `Number of Packets` to 10 for RAK, 8 for T114. 8 also works for RAK.
583+
9. Select the firmware zip file you downloaded
584+
10. Select the device you want to update. If the device you want to updat is not on the list, try enabling`OTA` on the device again
585+
11. If the device is not found, enable `Force Scanning` in the DFU app
586+
12. Tab the `Upload` to begin OTA update
587+
13. If it fails, try turning off and on Bluetooth on your phone. If that doesn't work, try rebooting your phone.
588+
14. Wait for the update to complete. It can take a few minutes.
589+
590+
539591
### 7.2 Q: How to update ESP32-based devices over the air?
540592

541593
**A:** For ESP32-based devices (e.g. Heltec V3):
@@ -548,22 +600,19 @@ You can get the epoch time on <https://www.epochconverter.com/> and use it to se
548600
8. From a browser, go to http://192.168.4.1/update and upload the non-merged bin from the flasher
549601

550602

551-
### 7.1 Q: How to update nRF (RAK, T114, Seed XIAO) repeater and room server firmware over the air using the new simpler DFU app?
603+
### 7.3 Q: Is there a way to lower the chance of a failed OTA device firmware update (DFU)?
604+
605+
**A:** Yes, developer `che aporeps` has an enhanced OTA DFU bootloader for nRF52 based devices. With this bootloader, if it detects that the application firmware is invalid, it falls back to OTA DFU mode so you can attempt to flash again to recover. This bootloader has other changes to make the OTA DFU process more fault tolerant.
606+
607+
Refer to https://github.com/oltaco/Adafruit_nRF52_Bootloader_OTAFIX for the latest information.
608+
609+
Currently, the following boards are supported:
610+
- Nologo ProMicro
611+
- Seeed Studio XIAO nRF52840 BLE
612+
- Seeed Studio XIAO nRF52840 BLE SENSE
613+
- RAK 4631
552614

553-
**A:** The steps below work on both Android and iOS as nRF has made both apps' user interface the same on both platforms:
554615

555-
1. Download nRF's DFU app from iOS App Store or Android's Play Store, you can find the app by searching for `nrf dfu`, the app's full name is `nRF Device Firmware Update`
556-
2. On flasher.meshcore.co.uk, download the **ZIP** version of the firmware for your nRF device (e.g. RAK or Heltec T114 or Seeed Studio's Xiao)
557-
3. From the MeshCore app, login remotely to the repeater you want to update with admin priviledge
558-
4. Go to the Command Line tab, type `start ota` and hit enter.
559-
5. you should see `OK` to confirm the repeater device is now in OTA mode
560-
6. Run the DFU app,tab `Settings` on the top right corner
561-
7. Enable `Packets receipt notifications` and change `Number of Packets` to 10 for RAK, 8 for T114. 8 also works for RAK.
562-
8. Select the firmware zip file you downloaded
563-
9. Select the device you want to update. If the device you want to updat is not on the list, try enabling`OTA` on the device again
564-
10. Tab the `Upload` to begin OTA update
565-
11. If it fails, try turning off and on Bluetooth on your phone. If that doesn't work, try rebooting your phone.
566-
12. Wait for the update to complete. It can take a few minutes.
567616

568617

569618
---

docs/packet_structure.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Packet Structure
2+
3+
| Field | Size (bytes) | Description |
4+
|----------|----------------------------------|-----------------------------------------------------------|
5+
| header | 1 | Contains routing type, payload type, and payload version. |
6+
| path_len | 1 | Length of the path field in bytes. |
7+
| path | up to 64 (`MAX_PATH_SIZE`) | Stores the routing path if applicable. |
8+
| payload | up to 184 (`MAX_PACKET_PAYLOAD`) | The actual data being transmitted. |
9+
10+
Note: see the [payloads doc](./payloads.md) for more information about the content of payload.
11+
12+
## Header Breakdown
13+
14+
bit 0 means the lowest bit (1s place)
15+
16+
| Bits | Mask | Field | Description |
17+
|-------|--------|-----------------|-----------------------------------------------|
18+
| 0-1 | `0x03` | Route Type | Flood, Direct, Reserved - see below. |
19+
| 2-5 | `0x3C` | Payload Type | Request, Response, ACK, etc. - see below. |
20+
| 6-7 | `0xC0` | Payload Version | Versioning of the payload format - see below. |
21+
22+
## Route Type Values
23+
24+
| Value | Name | Description |
25+
|--------|-------------------------------|--------------------------------------|
26+
| `0x00` | `ROUTE_TYPE_TRANSPORT_FLOOD` | Flood routing mode + transport codes |
27+
| `0x01` | `ROUTE_TYPE_FLOOD` | Flood routing mode (builds up path). |
28+
| `0x02` | `ROUTE_TYPE_DIRECT` | Direct route (path is supplied). |
29+
| `0x03` | `ROUTE_TYPE_TRANSPORT_DIRECT` | direct route + transport codes |
30+
31+
## Payload Type Values
32+
33+
| Value | Name | Description |
34+
|--------|---------------------------|-----------------------------------------------|
35+
| `0x00` | `PAYLOAD_TYPE_REQ` | Request (destination/source hashes + MAC). |
36+
| `0x01` | `PAYLOAD_TYPE_RESPONSE` | Response to REQ or ANON_REQ. |
37+
| `0x02` | `PAYLOAD_TYPE_TXT_MSG` | Plain text message. |
38+
| `0x03` | `PAYLOAD_TYPE_ACK` | Acknowledgment. |
39+
| `0x04` | `PAYLOAD_TYPE_ADVERT` | Node advertisement. |
40+
| `0x05` | `PAYLOAD_TYPE_GRP_TXT` | Group text message (unverified). |
41+
| `0x06` | `PAYLOAD_TYPE_GRP_DATA` | Group datagram (unverified). |
42+
| `0x07` | `PAYLOAD_TYPE_ANON_REQ` | Anonymous request. |
43+
| `0x08` | `PAYLOAD_TYPE_PATH` | Returned path. |
44+
| `0x09` | `PAYLOAD_TYPE_TRACE` | trace a path, collecting SNI for each hop. |
45+
| `0x0F` | `PAYLOAD_TYPE_RAW_CUSTOM` | Custom packet (raw bytes, custom encryption). |
46+
47+
## Payload Version Values
48+
49+
| Value | Version | Description |
50+
|--------|---------|---------------------------------------------------|
51+
| `0x00` | 1 | 1-byte src/dest hashes, 2-byte MAC. |
52+
| `0x01` | 2 | Future version (e.g., 2-byte hashes, 4-byte MAC). |
53+
| `0x02` | 3 | Future version. |
54+
| `0x03` | 4 | Future version. |

docs/payloads.md

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
# Meshcore payloads
22
Inside of each [meshcore packet](./packet_structure.md) is a payload, identified by the payload type in the packet header. The types of payloads are:
33

4+
* Node advertisement.
5+
* Acknowledgment.
6+
* Returned path.
47
* Request (destination/source hashes + MAC).
58
* Response to REQ or ANON_REQ.
69
* Plain text message.
7-
* Acknowledgment.
8-
* Node advertisement.
10+
* Anonymous request.
911
* Group text message (unverified).
1012
* Group datagram (unverified).
11-
* Anonymous request.
12-
* Returned path.
1313
* Custom packet (raw bytes, custom encryption).
1414

1515
This document defines the structure of each of these payload types
1616

17+
## Important concepts:
18+
19+
* Node/channel hash: the first byte of the node or channel's public key
20+
1721
# Node advertisement
1822
This kind of payload notifies receivers that a node exists, and gives information about the node
1923

2024
| Field | Size (bytes) | Description |
2125
|---------------|-----------------|----------------------------------------------------------|
22-
| public key | 32 | Ed25519 public key |
26+
| public key | 32 | Ed25519 public key of the node |
2327
| timestamp | 4 | unix timestamp of advertisement |
2428
| signature | 64 | Ed25519 signature of public key, timestamp, and app data |
2529
| appdata | rest of payload | optional, see below |
@@ -37,20 +41,29 @@ Appdata
3741

3842
Appdata Flags
3943

40-
| Value | Name | Description |
41-
|--------|-----------|---------------------------------------|
42-
| `0x10` | location | appdata contains lat/long information |
43-
| `0x20` | feature 1 | Reserved for future use. |
44-
| `0x40` | feature 2 | Reserved for future use. |
45-
| `0x80` | name | appdata contains a node name |
44+
| Value | Name | Description |
45+
|--------|----------------|---------------------------------------|
46+
| `0x01` | is chat node | advert is for a chat node |
47+
| `0x02` | is repeater | advert is for a repeater |
48+
| `0x03` | is room server | advert is for a room server |
49+
| `0x10` | has location | appdata contains lat/long information |
50+
| `0x20` | has feature 1 | Reserved for future use. |
51+
| `0x40` | has feature 2 | Reserved for future use. |
52+
| `0x80` | has name | appdata contains a node name |
4653

4754
# Acknowledgement
55+
56+
An acknowledgement that a message was received. Note that for returned path messages, an acknowledgement will be sent in the "extra" payload (see [Returned Path](#returned-path)) and not as a discrete ackowledgement. CLI commands do not require an acknowledgement, neither discrete nor extra.
57+
4858
| Field | Size (bytes) | Description |
4959
|----------|--------------|------------------------------------------------------------|
5060
| checksum | 4 | CRC checksum of message timestamp, text, and sender pubkey |
5161

5262

5363
# Returned path, request, response, and plain text message
64+
65+
Returned path, request, response, and plain text messages are all formatted in the same way. See the subsection for more details about the ciphertext's associated plaintext representation.
66+
5467
| Field | Size (bytes) | Description |
5568
|------------------|-----------------|------------------------------------------------------|
5669
| destination hash | 1 | first byte of destination node public key |
@@ -60,11 +73,13 @@ Appdata Flags
6073

6174
## Returned path
6275

76+
Returned path messages provide a description of the route a packet took from the original author. Receivers will send returned path messages to the author of the original message.
77+
6378
| Field | Size (bytes) | Description |
6479
|-------------|--------------|----------------------------------------------------------------------------------------------|
6580
| path length | 1 | length of next field |
66-
| path | see above | a list of node hashes (one byte each) describing the route from us to the packet author |
67-
| extra type | 1 | extra, bundled payload type, eg., acknowledgement or response. See packet structure spec |
81+
| path | see above | a list of node hashes (one byte each) |
82+
| extra type | 1 | extra, bundled payload type, eg., acknowledgement or response. Same values as in [packet structure](./packet_structure.md) |
6883
| extra | rest of data | extra, bundled payload content, follows same format as main content defined by this document |
6984

7085
## Request
@@ -156,18 +171,14 @@ Plaintext message
156171

157172
# Group text message / datagram
158173

159-
| Field | Size (bytes) | Description |
160-
|--------------|-----------------|------------------------------------------|
161-
| channel hash | 1 | TODO |
162-
| cipher MAC | 2 | MAC for encrypted data in next field |
163-
| ciphertext | rest of payload | encrypted message, see below for details |
174+
| Field | Size (bytes) | Description |
175+
|--------------|-----------------|--------------------------------------------|
176+
| channel hash | 1 | the first byte of the channel's public key |
177+
| cipher MAC | 2 | MAC for encrypted data in next field |
178+
| ciphertext | rest of payload | encrypted message, see below for details |
164179

165-
Plaintext for text message
180+
The plaintext contained in the ciphertext matches the format described in [plain text message](#plain-text-message). Specifically, it consists of a four byte timestamp, a flags byte, and the message. The flags byte will generally be `0x00` because it is a "plain text message". The message will be of the form `<sender name>: <message body>` (eg., `user123: I'm on my way`).
166181

167-
| Field | Size (bytes) | Description |
168-
|-----------|-----------------|----------------------------------|
169-
| timestamp | 4 | send time (unix timestamp) |
170-
| content | rest of message | plain group text message content |
171182

172183
TODO: describe what datagram looks like
173184

0 commit comments

Comments
 (0)