I had an requirement of using circuit python on nRF52840 DK for certain project, But couldn't find any proper information about how to flash circuit python in the nRF52840 DK. I asked for help in the forum even they were helpless in solving this problem. After with some tweaking and taking help from community. I was able to flash circuit python in the nRF52840 DK.
The Kit:
-The nRF52840 DK is a versatile single-board development kit for Bluetooth Low Energy, Bluetooth mesh, Thread, Zigbee, 802.15.4, ANT and 2.4 GHz proprietary applications on the nRF52840 SoC. It is the recommended Nordic development kit for Amazon Sidewalk. It also supports development on the nRF52811 SoC.
The nRF52840 DK can also be used for Matter over Thread where Thread is used for transport and Bluetooth LE for commissioning. Matter devices based on Thread are required to feature Bluetooth LE concurrently to enable adding new devices to a network.
It facilitates development by exploiting all features of the nRF52840 SoC. It includes an NFC antenna that quickly enables utilization of the NFC-A tag peripheral. All GPIOs are available via edge connectors and headers, and 4 buttons and 4 LEDs simplify input and output to and from the SoC. An on-board external memory is connected to the QSPI peripheral in the nRF52840 SoC.
It is Arduino Uno Revision 3 compatible, making it possible to mount 3rd-party shields with ease. It comes with an on-board SEGGER J-Link debugger allowing programming and debugging both the on-board SoC and external targets through the debug out header. It also interfaces directly with the Power Profiler Kit II.
The DK is typically powered with USB, but can be powered by a wide range of sources, within the supply range of 1.7 to 5.0 V. In addition to USB, it can be powered with an external source, but also includes a CR2032 battery holder and a Li-Po battery connector, for in-field testing. Current consumption can be measured by using the dedicated current measurement pins.
Software requirements:-
For flashing the microcontroller you need to download 'command line tool' provide by nordic semiconductor. Link to the tool is given below
https://www.nordicsemi.com/Products/Development-tools/nRF-Command-Line-Tools/Download
After downloading the software install the software in your system. I am using a windows 8.1 os. So I downloaded and installed appropriate 'command line tool' for the system.
Bootloader:-
The development board has two separate section one for Segger JLink and another for the nordic microcontroler.
bootloader:- The bootloader will use a serial port, USB port, or some other means to load the application. Frequently a bootloader will always execute on restart to check if a new program is to be loaded or if the application is to be run. Sometimes a bootloader will have primitive functions that the application also calls.
.Download the USB bootloader from the given link.
Firmware:-
You need circuit python firmware to be flashed into the microcontroler. To execute python programs.
Firmware:-Firmware is software that provides basic machine instructions that allow the hardware to function and communicate with other software running on a device.
Division of board
The board is divided into 2 section
1) Segger JLink
2) Microcontroller
Bellow image gives a clear information about division of board.
Flashing Microcontroller with USB bootloader
Step 1:-
Open the program name 'J-Flash Lite V7.80c' as shown in Figure bellow
Step 2:-
You will get a dialog box with title 'J-Flash Lite Info' as shown in figure bellow.
Click on 'ok' button.
Step 3:-
A 'Segger J-Flash Lite V7.80c' application will open as shown bellow.
On click on '...' as shown above to select appropriate microcontroller.
Step 4:-
A Target Device Settings window will open as shown bellow
On it Select manufacturer tab as Nordic Semi.
Step5:-
The software will list all the microcontroller provided by 'nordic semi' as shown bellow.
On it select microcontroller as 'nRF52840_xxAA' and than click ok.
Step 6:-
A 'Segger J-Flash Lite V7.80c' application will open as shown bellow.
Click on '...' to open the USB bootloader file for flashing it into the microcontroller.
Step 7:-
Information about the file will be shown on Log window as shown bellow.
Step 8:-
A new dialog box will appear name 'J-Link V7.80c Info' as shown bellow
On it click Ok.
Step 9:-
Connect you USB cable to the Segger side of nRF82540 DK as shown bellow.
Connect the other side of the wire to the USB cable to the computer.
Step 10:-
Click on Erase chip button to erase the chip as shown bellow.
Information about chip erasing will be shown in log window.
Step 11:-
Click on Program Device button to flash the USB bootloader in the nRF82540 microcontroler as shown bellow.
USB bootloader program will be flashed in the micocontroler and the information about it will be shown in log window. As shown in Figure bellow.
Installing circuit python on the microcntroller
Step 1:-
Connect to the USB cable to the USB port of the microcontroller side as shown bellow.
Connect the other side of the USB cable to the computer USB port.
Step 2:-
You will see a drive name 'NRF52BOOT' automatically opens as shown in figure bellow.
Step 3:-
Copy the file that has circuit python in it over here it is 'adafruit-circuitpython-pca10056-en_GB-9.1.1.uf2' as shown in figure bellow.
Step 4:-
Paste it on NRF52BOOT drive as shown bellow.
Step 5:-
The current drive will automatically change to 'CIRCUITPY' as shown bellow.
Testing Python code
Step 6:-
Know we will test the python code. To do so open the file name code.py in thonny. Double click the code.py file to open it as shown bellow.
Step 7:-
The file will open in Thonny IDE as shown bellow.
Step 8:-
Edit the file with the code as show bellow.
Step 9:-
Click in save to save the file as shown bellow.
A green LED on the board will start blinking.
Comments