ENG | NRF52840 Dongle & MicroPython
Very simple guide for using MicroPython and nRF52840 Dongle (PCA10059). Sadly bluetooth does not work.
ENG | NRF52840 Dongle & MicroPython
In the last article, we learned how to upload blinky. But somehow there is MicroPython version for this gadget, which can be downloaded here:
https://micropython.org/download/PCA10059/
And surprise, it’s possible to create ZIP file and upload it to dongle:
Download and flash MicroPython firmware
1
2
3
4
wget https://micropython.org/resources/firmware/PCA10059-20250415-v1.25.0.hex
nrfutil pkg generate --hw-version 52 --sd-req=0x00 --application-version 1 --application PCA10059-20250415-v1.25.0.hex PCA10059-20250415-v1.25.0.zip
# Don't forget (as always 😜) to put device into boot loader mode
nrfutil dfu usb-serial -pkg PCA10059-20250415-v1.25.0.zip -p /dev/ttyACM1
Try Python shell (REPL)
1
minicom -D /dev/ttyACM1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Welcome to minicom 2.9
OPTIONS: I18n
Compiled on Jan 17 2025, 00:00:00.
Port /dev/ttyACM1, 13:58:33
Press CTRL-A Z for help on special keys
MicroPython v1.25.0 on 2025-04-15; PCA10059 with NRF52840
Type "help()" for more information.
>>> help()
Welcome to MicroPython!
For online docs please visit http://docs.micropython.org/
Quick overview of commands for the board:
board.LED(n) -- create an LED object for LED n (n=1,2,3,4)
Control commands:
CTRL-A -- on a blank line, enter raw REPL mode
CTRL-B -- on a blank line, enter normal REPL mode
CTRL-D -- on a blank line, do a soft reset of the board
CTRL-E -- on a blank line, enter paste mode
For further help on a specific object, type help(obj)
>>> import board
>>> l1 = board.LED(1)
>>> l1.on()
>>> l2 = board.LED(2)
>>> l2.on()
>>> l3 = board.LED(3)
>>> l3.on()
>>> l2.off()
>>> l4 = board.LED(4)
>>> l4.on()
Exit minicom using Ctrl+A X
.
Uploading program
Raspberry Pi Pico has Visual Studio Code extension called MicroPico. I’m not sure if it works, so
1
pip install mpremote
1
2
3
4
5
6
mpremote connect /dev/ttyACM1 # Connect to shell (just like minicom)
mpremote a1 # Alias for above
mpremote a0 ls # List files on a device connected to /dev/ttyACM0
mpremote a1 fs cp test.py : # Copy file to device root directory (filesystem copy)
mpremote a1 run test.py # Run that file
mpremote a1 fs rm :test.py # Remove that file
Reality check
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[pavel@marten -=- /home/pavel/Downloads]$ mpremote a1 ls
ls :
pavel@marten -=- /home/pavel/Downloads]$ mpremote a1 fs cp ble_peripheral2.py : && mpremote a1 run ble_peripheral2.py
cp ble_peripheral2.py :
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
ImportError: no module named 'bluetooth'
[pavel@marten -=- /home/pavel/Downloads]$ mpremote a1
Connected to MicroPython at /dev/ttyACM1
Use Ctrl-] or Ctrl-x to exit this shell
import bluetooth
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'bluetooth'
>>> %
[pavel@marten -=- /home/pavel/Downloads]$ mpremote a1 ls
ls :
3145 ble_peripheral2.py
[pavel@marten -=- /home/pavel/Downloads]$ mpremote a1 fs rm :ble_peripheral2.py
rm :ble_peripheral2.py
[pavel@marten -=- /home/pavel/Downloads]$ mpremote a1 ls
ls :
Conclusion
This was surprisingly easy. Except there is sadly no support for Bluetooth (as of 2025-06-08 and MicroPython 1.25), which is critical for this piece of hardware.
This post is licensed under CC BY 4.0 by the author.