Plan "A" is to make some Ant+ (BLE) network buttons for my Garmin GPS & Di2 bike bits, i.e. creating eventually an intergrated low power 2.4G mesh network with full GPIO control (its a possible wireless option for InMoov....maybe).
Pre-Requisites :- (Tool chain links inc.)
- nRF52840 (Dongle)
- nRF52840 dongle SDK :- nRF5_SDK_17.0.2_d674dde (nordicsemi.com backdoor download
- Segger Programming IDE
- nRF Connect (usb programmer)
Hinwiess :- Off the bat it was quite a trip to get these tools together as Nordic Semicondutor has not made it easy for 3rd party development, as they like you to use a J-Link cable to access the device.(these leads are not cheap 200-300$).
However :-
There is a workaround detailed below using the dongles inbuilt USB bootloader, be careful as some cheap nRF5xx devices do not have the correct Bootloaders (NoWorkio bigtime).
- nRF52840 Dongle Product Brief Version 1.1
- Bluetooth 5 ready multiprotocol radio
- 2 Mbps
- Long Range
- Advertising Extensions
- Channel Selection Algorithm #2 (CSA #2)
- IEEE 802.15.4 radio support
- ThreadyZigbeeArmĀ®
- CortexTM-M4 with floating point support
- DSP instruction set
- Arm CryptoCell CC310 cryptographic accelerator
- 15 GPIO available via edge castellation
- USB interface direct to nRF52840 SoC
- Integrated 2.4 GHz PCB antenna
- 1 user-programmable button
- 1 user-programmable RGB LED
- 1 user-programmable LED1.7-5.5 V operation from USB or external
Segger Programming IDE
If you are using the Segger IDE for uploading code to nRF52840 it assumes that you are using a J-Link singing all dancing programming lead, if you happen to "Brick" the device along the line then you will need one of these to resurrect it (I have an alternative arriving with slowboat. we see....)
.........which is a good reason to install nRF Connect as this allows you to send the program direct to the nRF52840 via USB bootloader. (winwin).
nRF Connect :-
To get up and running with nRFConnect only the Programmer app needs to be installed , if you wish to check out the Bluetooth parameters then there are quite a few other apps (10 or soo) you can install from the Gui you see below.
In the Segger IDE open up a program example solution.....
careful......... first trap :-
Locate your nRF5_SDK_17.0.2_d674dde folder
and navigate too :-
nRF5_SDK_17.0.2_d674dde\examples\peripheral\blinky\pca10059\mbr\ses
Folder "pca10059" and "ses" are specific to the nRF52840 dongle & Segger ide environment (stray off this at own risk !!!)
load up the "Blinky" example....
....also fire up the nRFConnect app and start the programming app from it.
Press the Reset button on your nRF52840 to bring it into the "Bootload" modus, if all is ok the you will see a glowing red LED slowly flashing.
....in the nRF connect programmer select the nRF52840 from the dropdown select.
(if not here then its not in bootloader modus (or you chip has a bogus bootloader) - try hitting reset again)
Build the code in the Segger IDE and right click the output files in the Project Items solution Bay and "select in file explorer" option. This will bring up an explorer windows pointing to the blinky_pca10059_mbr.hex file
(do NOT use the segger IDE programming option as this directs you down the J-Link rabbit hole).
We are finished for now with Segger IDE.
Drag the .hex file into the File Memory layout box of the nRF Connect - Programmer app (it will appear as a green bar, if you right-click this bar then it will show you the memory position/allocation of the file)
Hit the "Write" option and the program will be uploaded to the nRF52840 device.
Blinking heck that was easy ....... not !!!
I hope this write up will save others a few hours/days getting a working programming workflow underway.
Footnote:- The chips are very low power and can be easily powered with small CR2032 Button type batteries.