Everything nRF52840
-
@NeverDie I never liked the Arduino IDE, so I think PlatformIO is next logical step, it is very easy to get going and it opens up for advanced usage. Your own choice of editor, has great debugging capabilities with VSCode integration.
If you build the PCA10059 example I linked you should have GPIO (digital) access to all 47 pins. I've made it simple in the pca10059 variant so that D0 (0) is p0.00 -> D47 (47) is p1.15.
Some external pins on the dongle which I have tested:
Serial pins RX->P1.10, TX->P1.13
I2C, TWIM, Wire on pins CLK->P0.29, SDA->P0.31
SPI here MISO->P0.13, MOSI->P0.15, CLK->P0.17, CS->P0.22 -
@NeverDie I never liked the Arduino IDE, so I think PlatformIO is next logical step, it is very easy to get going and it opens up for advanced usage. Your own choice of editor, has great debugging capabilities with VSCode integration.
If you build the PCA10059 example I linked you should have GPIO (digital) access to all 47 pins. I've made it simple in the pca10059 variant so that D0 (0) is p0.00 -> D47 (47) is p1.15.
Some external pins on the dongle which I have tested:
Serial pins RX->P1.10, TX->P1.13
I2C, TWIM, Wire on pins CLK->P0.29, SDA->P0.31
SPI here MISO->P0.13, MOSI->P0.15, CLK->P0.17, CS->P0.22@redferne thanks for your effort spent to support nRF52840 for VS Code/Platform.io. I'll certaily give it a try. The good thing with platform.io is that it's easier to use/import existing arduino (ino) projects than in e.g. Segger Studio which only supports licensed J-Link flash/debug adapters.
Two questions:
1.) Does your "port" support also the 15.2 SDK features of the 840 (Softdevice S140, BLE 5.0 long range, ZigBee, Thread ...)
2.) What flash method is supprted/used or you're using? Just plug the USB dongle in and it can be uploaded?Oh, a third question: If I use bare nrf840 Modules, what flash adapter/mode would you recommend or have you tested (I have the 840 DK board, a ST-Link v2 and a Balc Magic Probe adapter)?
-
@nc78 Earlier you had asked about vendors for the dongle. I found an alternative dongle that ships from China:
https://www.tindie.com/products/Zelin/nrf52840-micro-dev-kit-usb-dongle/
Price is very similar. I like it better than the Nordic dongle, because it exposes pins P0.06 and P0.08, which are used by the DK for UART communications. -
@nc78 Earlier you had asked about vendors for the dongle. I found an alternative dongle that ships from China:
https://www.tindie.com/products/Zelin/nrf52840-micro-dev-kit-usb-dongle/
Price is very similar. I like it better than the Nordic dongle, because it exposes pins P0.06 and P0.08, which are used by the DK for UART communications.-
It does use the S140 v6.1.0 Softdevice, however I have only "ported"/test the most basic SDK 15.2 BLE feature of @sandeepmistry BLEPheriphal BLEPeripheral. The example shows as BLEService and Read/Writeable BLECharCharacteristic used to toggling the onboard LED. I was hoping we could get more developers involved and "port" the missing pieces, if there's interrest. My main focus was just to get something Arduino-like running using PlatformIO build system on the cheap (~$10) NRF52840 dongle.
-
I have tested Black Magic Probe (Bluepill) and JLink Mini on the PCA10059 with great success. It also possible to use the nrfutil to create a dfu.zip. The Nordic Open DFU Bootloader (which is pre-flashed on PCA10059) allows easy programming without soldering, just plug-in USB.
First get and install the nrfutil from here
- Linux environment example, first build the PCA10059 example project:
pio run -e ble- Generate a dfu.zip including the softdevice:
nrfutil pkg generate --hw-version 52 --debug-mode --sd-req 0x00 --sd-id 0xAE --application .pioenvs/ble/userfirmware.hex --softdevice ~/.platformio/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/s140/hex/s140_nrf52_6.1.0_softdevice.hex dfu.zip- Plugin the PCA10059 dongle in a USB port. Make sure that the Bootloader is executing by checking the RED led, should be "breathing". Else press the reset button. Now flash the new firmware, here the dongle was enumerated as ACM3.
nrfutil dfu usb-serial --package dfu.zip --port /dev/ttyACM3... and Bob's your uncle :smile_cat:
-
-
@nc78 Earlier you had asked about vendors for the dongle. I found an alternative dongle that ships from China:
https://www.tindie.com/products/Zelin/nrf52840-micro-dev-kit-usb-dongle/
Price is very similar. I like it better than the Nordic dongle, because it exposes pins P0.06 and P0.08, which are used by the DK for UART communications.@neverdie said in Everything nRF52840:
@nc78 Earlier you had asked about vendors for the dongle. I found an alternative dongle that ships from China:
https://www.tindie.com/products/Zelin/nrf52840-micro-dev-kit-usb-dongle/
Price is very similar. I like it better than the Nordic dongle, because it exposes pins P0.06 and P0.08, which are used by the DK for UART communications.Thank you for the link, it looks like an interesting dongle. But after asking for a quote at Arrows and giving up (looked like a big mess to get items shipped here as it cannot be included in another order and they would only deliver in US), I realized that they now have them in stock.
So I bought 2 at 9.5$ each + 12% discount on the website, so less than 8.5$ each and as I bought other items (including BT840 modules) I have free express shipping too. Cheapest price + free express shipping, I think it's called "having it both ways" ;) So I'll be able to join the little nrf52840 club next week. -
-
It does use the S140 v6.1.0 Softdevice, however I have only "ported"/test the most basic SDK 15.2 BLE feature of @sandeepmistry BLEPheriphal BLEPeripheral. The example shows as BLEService and Read/Writeable BLECharCharacteristic used to toggling the onboard LED. I was hoping we could get more developers involved and "port" the missing pieces, if there's interrest. My main focus was just to get something Arduino-like running using PlatformIO build system on the cheap (~$10) NRF52840 dongle.
-
I have tested Black Magic Probe (Bluepill) and JLink Mini on the PCA10059 with great success. It also possible to use the nrfutil to create a dfu.zip. The Nordic Open DFU Bootloader (which is pre-flashed on PCA10059) allows easy programming without soldering, just plug-in USB.
First get and install the nrfutil from here
- Linux environment example, first build the PCA10059 example project:
pio run -e ble- Generate a dfu.zip including the softdevice:
nrfutil pkg generate --hw-version 52 --debug-mode --sd-req 0x00 --sd-id 0xAE --application .pioenvs/ble/userfirmware.hex --softdevice ~/.platformio/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/s140/hex/s140_nrf52_6.1.0_softdevice.hex dfu.zip- Plugin the PCA10059 dongle in a USB port. Make sure that the Bootloader is executing by checking the RED led, should be "breathing". Else press the reset button. Now flash the new firmware, here the dongle was enumerated as ACM3.
nrfutil dfu usb-serial --package dfu.zip --port /dev/ttyACM3... and Bob's your uncle :smile_cat:
@redferne wow and thanks again for your fast and complte/detailed answer.
I like especially- that you already started to use/support softdevices S140 and thus BLE 5.0, thread and Zigbee is "potentially" available
- that you also succesfully use Black Magic Probe, as I also wante to use it because it works in Arduino IDE and Platform.io and it supports also an UART Port to communicate (I also use Blue/Blackpill BMP's)
It would be great if it would be posssible (if not already) to use BLE 5.0 with the long range feature (that is not supported by the older S132 or nRF52832). Zigbee would be also great. But not sure what of the features (for a reliable longer indoor range) would be usable from within the MySensors project (beside using the nRF52 as/with the nRF24 proticol).
-
-
One interesting thing I stumbled upon:
https://github.com/insane-adding-machines/unicore-mx
UniCore-MX | Universal Core for ARM Cortex-M0/0+/3/4/7/X
Supports nRF51/52
-
One interesting thing I stumbled upon:
https://github.com/insane-adding-machines/unicore-mx
UniCore-MX | Universal Core for ARM Cortex-M0/0+/3/4/7/X
Supports nRF51/52
This post is deleted! -
One interesting thing I stumbled upon:
https://github.com/insane-adding-machines/unicore-mx
UniCore-MX | Universal Core for ARM Cortex-M0/0+/3/4/7/X
Supports nRF51/52
@uhrheber said in Everything nRF52840:
One interesting thing I stumbled upon:
https://github.com/insane-adding-machines/unicore-mx
UniCore-MX | Universal Core for ARM Cortex-M0/0+/3/4/7/X
Supports nRF51/52
I looked at the link, but I can't figure out what problem it's solving. What's the headline on that?
-
-
It does use the S140 v6.1.0 Softdevice, however I have only "ported"/test the most basic SDK 15.2 BLE feature of @sandeepmistry BLEPheriphal BLEPeripheral. The example shows as BLEService and Read/Writeable BLECharCharacteristic used to toggling the onboard LED. I was hoping we could get more developers involved and "port" the missing pieces, if there's interrest. My main focus was just to get something Arduino-like running using PlatformIO build system on the cheap (~$10) NRF52840 dongle.
-
I have tested Black Magic Probe (Bluepill) and JLink Mini on the PCA10059 with great success. It also possible to use the nrfutil to create a dfu.zip. The Nordic Open DFU Bootloader (which is pre-flashed on PCA10059) allows easy programming without soldering, just plug-in USB.
First get and install the nrfutil from here
- Linux environment example, first build the PCA10059 example project:
pio run -e ble- Generate a dfu.zip including the softdevice:
nrfutil pkg generate --hw-version 52 --debug-mode --sd-req 0x00 --sd-id 0xAE --application .pioenvs/ble/userfirmware.hex --softdevice ~/.platformio/packages/framework-arduinonordicnrf5/cores/nRF5/SDK/components/softdevice/s140/hex/s140_nrf52_6.1.0_softdevice.hex dfu.zip- Plugin the PCA10059 dongle in a USB port. Make sure that the Bootloader is executing by checking the RED led, should be "breathing". Else press the reset button. Now flash the new firmware, here the dongle was enumerated as ACM3.
nrfutil dfu usb-serial --package dfu.zip --port /dev/ttyACM3... and Bob's your uncle :smile_cat:
@redferne I was trying to get your platform and board extention as wellas the BLE library added to platformio, but got stuck afetr many many hours and many attempts (too much to add all the problems in one post). I'm using platformio with Windows 10 (I guess you use it with Linux/Ubuntu and also with a couple of command line tools)
I was trying to install this two:
https://github.com/Redferne/arduino-nRF5
Redferne/arduino-BLEPeripheralI was trying to build a couple of simple examples and also the
C:\users\internet.platformio\lib\BLEPeripheral\src\BLEBondStore.cpp:11:12: fatal error: nrf_soc.h: No such file or directory
and
C:\users\internet.platformio\lib\BLEPeripheral\src/BLEPeripheral.h:136:5: error: 'nRF52840' does not name a type; did you mean 'NRF52840'?and all other following errors are probably the result of the above ones.
Any hints?
Another question: How to define/declare the usage of the S140 softdevice in the project?
Using the PlatformIO IDE, not the command line. -
-
As pointed out by @reinhold, here's a handy tool for programming your nRF52840 dongle, and possibly other nRF52 projects too:

https://www.tindie.com/products/ElectronutLabs/pogoprog-model-c-pogo-pin-programmer-swd-2-pack/I think I'd like it better if it could somehow latch itself to the board, though, so that I could also get debugging information hands free without having to continually press the tool up against the board.
-
@redferne I was trying to get your platform and board extention as wellas the BLE library added to platformio, but got stuck afetr many many hours and many attempts (too much to add all the problems in one post). I'm using platformio with Windows 10 (I guess you use it with Linux/Ubuntu and also with a couple of command line tools)
I was trying to install this two:
https://github.com/Redferne/arduino-nRF5
Redferne/arduino-BLEPeripheralI was trying to build a couple of simple examples and also the
C:\users\internet.platformio\lib\BLEPeripheral\src\BLEBondStore.cpp:11:12: fatal error: nrf_soc.h: No such file or directory
and
C:\users\internet.platformio\lib\BLEPeripheral\src/BLEPeripheral.h:136:5: error: 'nRF52840' does not name a type; did you mean 'NRF52840'?and all other following errors are probably the result of the above ones.
Any hints?
Another question: How to define/declare the usage of the S140 softdevice in the project?
Using the PlatformIO IDE, not the command line.@heinzv I'm sorry if I was unclear. I have only updated and tested one example which is the PCA10059 It should build without errors, but you might need to specify build type as "ble" or "dongle" as per the readme.
To enable the NRF52840 support use these flags:
-DNRF52 -DNRF52840 -DNRF52840_XXAAand if building with the BLE Peripheral library and Softdevice S140 add:
-DNRF52 -DNRF52840 -DNRF52840_XXAA -DNRF52_S140 -
I have basic radio code now working in micropython: https://github.com/rabbithat/micropython_nRF52840/blob/master/README.md
So, I'm inching closer toward being able to do OTA code updates. :smiley:
-
@neverdie Does this also mean we're slightly closer to a MySensors implementation in MicroPython?
@alowhum said in Everything nRF52840:
@neverdie Does this also mean we're slightly closer to a MySensors implementation in MicroPython?
Theoretically. ;)
-
By the way, I have it now to where you can send long strings (up to 255 characters if so desired) in a single packet from one node to another using micropython: https://github.com/rabbithat/Micropython_nRF52840_send
So, it's starting to get useful. I expect OTA code updates should be within range fairly soon. Since it's all written in micropython, I'll be able OTA update even the radio code as well, which is slick. :sunglasses:
-
Very cool!
-
I have my first pass on nRF52840 OTA updates working with micropython. So, proof of concept works. :smile: I feel I should improve the code a bit before posting it though. I should probably add a hash function like MD5 or SHA256 to make sure the transmitted update is valid before making it go live.
-
I have my first pass on nRF52840 OTA updates working with micropython. So, proof of concept works. :smile: I feel I should improve the code a bit before posting it though. I should probably add a hash function like MD5 or SHA256 to make sure the transmitted update is valid before making it go live.
-
I have my first pass on nRF52840 OTA updates working with micropython. So, proof of concept works. :smile: I feel I should improve the code a bit before posting it though. I should probably add a hash function like MD5 or SHA256 to make sure the transmitted update is valid before making it go live.