This package attempts to build a cross-platform Bluetooth Low Energy module for Go. It currently supports the following systems:
Windows | Linux | Nordic chips | |
---|---|---|---|
Scanning | ✔️ | ✔️ | ✔️ |
Advertisement | ❌ | ✔️ | ✔️ |
Local services | ❌ | ✔️ | ✔️ |
Local characteristics | ❌ | ❌ | ✔️ |
As you can see above, there is support for some chips from Nordic Semiconductors. At the moment the following chips are supported:
- The nRF52832 with the S132 SoftDevice (version 6).
- The nRF52840 with the S140 SoftDevice (version 7).
These chips are supported through TinyGo.
The SoftDevice is a binary blob that implements the BLE stack. There are other (open source) BLE stacks, but the SoftDevices are pretty solid and have all the qualifications you might need. Other BLE stacks might be added in the future.
Flashing the SoftDevice can be tricky. If you have nrfjprog installed, you can erase the flash and flash the new BLE firmware using the following commands. Replace the path to the hex file with the correct SoftDevice, for example s132_nrf52_6.1.1/s132_nrf52_6.1.1_softdevice.hex
for S132 version 6.
nrfjprog -f nrf52 --eraseall
nrfjprog -f nrf52 --program path/to/softdevice.hex
After that, don't reset the board but instead flash a new program to it. For example, you can flash the Heart Rate Sensor example using tinygo
(modify the -target
flag as needed for your board):
tinygo flash -target=pca10040-s132v6 ./examples/heartrate
Flashing will normally reset the board.
This project is licensed under the BSD 3-clause license, see the LICENSE file for details.
The SoftDevices from Nordic are licensed under a different license, check the license file in the SoftDevice source directory.