Skip to main content

BLE UART Transport

Connects to a Bluetooth Low Energy peripheral that offers a serial-style GATT service, often called "BLE UART". CycBox writes to the service's TX characteristic and subscribes to notifications on its RX characteristic. The bytes then go through a codec, as on a serial port, so pick a codec that matches the device's data format.

The supported services are the ones in the Service UUID list:

  • Nordic UART Service (NUS), which most BLE serial modules and firmware libraries use;
  • EBYTE EWM104;
  • WCH CH9143;
  • VG6328A.

CycBox takes the TX/RX characteristics from this list. A different service UUID typed into the field fails to connect with "no known TX/RX characteristics for service …".

Device lists named peripherals found by a background scan. Unnamed beacons and devices that advertise only their MAC address are hidden. The device must be advertising and must not be connected to another central; phones often hold the connection. On Android the list fills in after CycBox has been granted Bluetooth permissions. On Linux, CycBox uses BlueZ, so Bluetooth must be enabled there.

MTU Payload is the largest single write CycBox sends; longer messages are split into chunks of that size. 20 bytes works with every device. Raise it, for example to 244, for faster sending when the peripheral supports a larger MTU; CycBox caps it to the MTU negotiated for the connection. The first connection can take several seconds (service discovery, bonding), so the connect timeout is at least 10 seconds.

Configuration reference​

Config IDble_transport
Selected byapp_transport = "ble_transport"
PlatformsLinux, Windows, Android
LicensePremium

Bluetooth Low Energy UART (GATT TX/RX) communication

BLE Parameters:

  • Device: Select a peripheral discovered by the background scan
  • Service UUID: GATT service UUID; defaults to Nordic UART Service (NUS).
  • MTU Payload: Max bytes per GATT write. Default 20 (BLE 4.0 safe); raise (e.g. 244) when the peer supports BLE 4.2+/5.x. Setting it larger than the peer's negotiated MTU will cause writes to fail
SettingKeyTypeDefaultNotes
Deviceble_transport_deviceText (with presets)detected at runtimeRequired
Service UUIDble_transport_service_uuidText (with presets)"6e400001-b5a3-f393-e0a9-e50e24dcca9e"Required
MTU Payload (bytes)ble_transport_mtu_payloadInteger (with presets)20

Setting details​

Device​

The available values are detected on the machine running CycBox (attached devices, generated ids), so no fixed default or option list is shown here.

Service UUID​

Presets (any other value can be entered):

ValueLabel
"6e400001-b5a3-f393-e0a9-e50e24dcca9e"NUS (Nordic UART Service) (6e400001-b5a3-f393-e0a9-e50e24dcca9e)
"0000fff0-0000-1000-8000-00805f9b34fb"EBYTE EWM104 (0000fff0-0000-1000-8000-00805f9b34fb)
"0000fff0-0000-1000-8000-00805f9b34fb"CH9143 (BLE/UART/USB transceiver) (0000fff0-0000-1000-8000-00805f9b34fb)
"0000ffe0-0000-1000-8000-00805f9b34fb"VG6328A (0000ffe0-0000-1000-8000-00805f9b34fb)

MTU Payload (bytes)​

Presets (any other value can be entered):

ValueLabel
2020 (BLE 4.x default)
244244 (BLE 5.x DLE)

Example config​

Default values as they appear in a saved configuration (for example the JSON block at the end of a cycbox/examples/*.lua file). Settings detected at runtime are omitted.

{
"app": {
"app_transport": "ble_transport"
},
"ble_transport": {
"ble_transport_service_uuid": "6e400001-b5a3-f393-e0a9-e50e24dcca9e",
"ble_transport_mtu_payload": 20
}
}