Nordic nRF52840: Difference between revisions
Brian Wilson (talk | contribs) |
Brian Wilson (talk | contribs) |
||
Line 9: | Line 9: | ||
== Loading Circuit Python == | == Loading Circuit Python == | ||
So far I have not been able to use the nRF version of CircuitPython on the Dongle, because it has its own special bootloader and I can't figure out how to push a UF2 file to it without using the JTAG interface. | |||
I | Instead I got it to run '''MicroPython'''. I downloaded the .hex file and then used [https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-desktop nRF Connect for desktop] via its [https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nc_programmer%2FUG%2Fnrf_connect_programmer%2Fncp_introduction.html programmer]. | ||
I | The other option is to use the $49 Nordic nRF52840-DK development board. Alas it has a tiny connector so, another cable? Oy. I should probably set up some pogo pins since I don't want to solder a connector to the back of the Dongle and the Xiao boards. | ||
=== Install the Adafruit bootloader === | |||
=== Install bootloader === | |||
https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/README.md | https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/README.md | ||
Line 60: | Line 58: | ||
The DK board has a Segger J-Link JTAG built in. The drivers install as part of the toolkit that's now installed on [[Pearl]]. They have a wiki for it here: [https://wiki.segger.com/ Segger wiki] | The DK board has a Segger J-Link JTAG built in. The drivers install as part of the toolkit that's now installed on [[Pearl]]. They have a wiki for it here: [https://wiki.segger.com/ Segger wiki] | ||
When programming with the nRF Connect SDK in VS Code it can directly talk to the debugger, it's really easy to use. | |||
== Resources == | == Resources == |
Latest revision as of 04:22, 2 December 2024
This MCU does Zigbee, I got them for that and of course have done nothing with so far.
Inventory
- nRF52840-DK developer board ($49)
- 2 Nordic tiny dev boards in the USB form factor, NRF52840-DONGLE from Digikey, about $10 each.
- Seed Studio "Xiao nrf52840 Sense" called a "sense" because it has a couple sensors onboard, a 6-axis IMU and a MEMS microphone. The sense is about $16 and the regular board (the "nonsense"?) is cheap, like $5 or so.
Loading Circuit Python
So far I have not been able to use the nRF version of CircuitPython on the Dongle, because it has its own special bootloader and I can't figure out how to push a UF2 file to it without using the JTAG interface.
Instead I got it to run MicroPython. I downloaded the .hex file and then used nRF Connect for desktop via its programmer.
The other option is to use the $49 Nordic nRF52840-DK development board. Alas it has a tiny connector so, another cable? Oy. I should probably set up some pogo pins since I don't want to solder a connector to the back of the Dongle and the Xiao boards.
Install the Adafruit bootloader
https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/README.md
conda create -n adafruit-nrf conda activate adafruit-nrf pip3 install adafruit-nrfutil
Download a bootloader from https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases I used https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/0.6.4/mdk_nrf52840_dongle_bootloader-0.6.4_s140_6.1.1.zip
adafruit-nrfutil dfu serial -p com3 -pkg *hex
After getting the board to connect as a mass storage device then I can put Circuit Python onto it. I think for this board, I will need to install their bootloader too.
My first project: HID Keyboard
When I got CircuitPython running I put the "Hello world" app on there and changed it to playback my long and complex password. That's it for this project!
It powers on and becomes an HID keyboard in about 2 seconds and then on each button press it plays my password. Ta-da!
Other ways I could do this: I could use a Adafruit RP2040 Feather for $10. I already got it going on an Adafruit Circuit Playground Express $25.
It's about what's in my junk drawer inventory, not what it costs. The nRF is a handy form factor. A Pi Zero for $5 would work but I don't own one and it would require booting Linux so it would be too slow. I did try out the HID keyboard thing on a Pi Zero W. Too complicated. A $4 Pico would work but does it have a button? (No.)
nRF52840 DK
https://nordicsemi.com/start52840dk
I followed along with a series of 5 videos published by Nordic to set up VS Code and the nRF tools. Here is part 1. https://youtu.be/EAJdOqsL9m8?si=xd3K52TBkHN84LRs
- Install nRFcommand line tools to C:\Program FIles\SEGGER (I downloaded nrf-command-line-tools-10.24.2-x64.exe -- there is a Linux version too.) It installs a J-Link driver as part of the process.
- Install nRF Connect SDK. Do this from the nRF extension pack in VS Code. You can install the latest toolchain from the extension. This takes some time, the download is big I guess.
- Once the toolchain has installed, install the latest SDK (2.8.0 currently) using "Manage SDK". I installed it to C:\ncs\2.8.0 as suggested in the video. This is a time-consuming step too.
- "Create a new application" using the "Copy sample" with "Blink LED (PWM)". I put it in C:\Documents\source\nordic\blinky_pwm
- Use "Add Configuration" to set the board. Set the board and tell it to build for debugging (see "Optimization Level") I told it to create a "build" directory and not to do a build yet.
- When it looked happy, I clicked the "build" button in the bottom bar. It was not happy. I removed a version of Cmake that was installed at the system level. Hmm looks like a Cmake extension installed that, maybe it was part of the bundle. Damn, there it is at the bottom of the list for the "nRF Connect for VS Code Extension Pack". I reinstalled it. It does not install cmake.exe, it installs support for cmake as in prettifying and intellicode things. "Cmake language support", it's called. In there I learned I can tell it where my cmake is. "cmake.cmakePath" in a json setting file. Running build from the bottom bar was the problem, it was gone once I removed cmake from the system, and build from the nrf extension worked.
JTAG
The DK board has a Segger J-Link JTAG built in. The drivers install as part of the toolkit that's now installed on Pearl. They have a wiki for it here: Segger wiki
When programming with the nRF Connect SDK in VS Code it can directly talk to the debugger, it's really easy to use.
Resources
https://www.nordicsemi.com/Products/Development-hardware/nRF52840-DK/GetStarted#infotabs
RIOT operating system https://doc.riot-os.org/group__boards__nrf52840-mdk-dongle.html
Nordic documentation https://docs.nordicsemi.com/
Nordic Getting startedguide for the dongle