meshtastic/docs/development/firmware/nrf52-guide.mdx

56 lines
3.1 KiB
Plaintext
Raw Normal View History

Squashed commit of the following: commit 86bc3c93e5fac8dfb5eb023f1aa6d405bb9d9ffe Merge: 6cabd5fe cfec3e8e Author: rcarteraz <robert.l.carter2@gmail.com> Date: Wed Jun 19 18:48:14 2024 -0700 Merge pull request #1301 from rcarteraz/1200bps-reset-button Add mention of 1200bps reset button in web flasher commit cfec3e8eace1719736a5a6cd4f0093385f0bdad8 Merge: 59d71321 6cabd5fe Author: rcarteraz <robert.l.carter2@gmail.com> Date: Wed Jun 19 17:59:09 2024 -0700 Merge branch 'master' into 1200bps-reset-button commit 6cabd5fe955461798f90dc7cebd98928c5d6578e Merge: f6a97b28 6c40c2e5 Author: rcarteraz <robert.l.carter2@gmail.com> Date: Wed Jun 19 17:58:54 2024 -0700 Merge pull request #1295 from geeksville/pr-nrf52-guide Add basic nrf52 guide commit 6c40c2e5558b7270646319a91123843c8671edbc Merge: 9cbea09e f6a97b28 Author: rcarteraz <robert.l.carter2@gmail.com> Date: Wed Jun 19 17:56:57 2024 -0700 Merge branch 'master' into pr-nrf52-guide commit 59d71321e380836c75d5b32401e2a8647933dd43 Author: rcarteraz <robert.l.carter2@gmail.com> Date: Wed Jun 19 17:52:06 2024 -0700 Add mention of 1200bps reset button in web flasher commit 9cbea09e5cb459853f9bcee2b8b206c19966d1f5 Author: rcarteraz <robert.l.carter2@gmail.com> Date: Tue Jun 18 13:53:25 2024 -0700 formatting and minor changes commit fad3a940d142558d7cc9dd59553af0b83d8c5d7c Merge: f3523b72 f95a398c Author: rcarteraz <robert.l.carter2@gmail.com> Date: Tue Jun 18 13:01:01 2024 -0700 Merge branch 'master' into pr-nrf52-guide commit f3523b72f5c24b338cc20acc2ba73b74dd73babb Merge: b2fcaa55 70638582 Author: geeksville <kevinh@geeksville.com> Date: Sun Jun 16 21:11:52 2024 -0700 Merge branch 'master' into pr-nrf52-guide commit b2fcaa55300ad339bf8994f1c89c52cb1aedfc1a Author: geeksville <kevinh@geeksville.com> Date: Sun Jun 16 15:16:37 2024 -0700 Add basic nrf52 guide
2024-06-19 18:50:33 -07:00
---
id: nrf52-guide
title: Development Guide for nRF52
sidebar_label: NRF52 Guide
sidebar_position: 6
---
This document is a collection of tips and best practices for developing on the nRF52 platform. It is designed to evolve continuously with the latest information, and contributions are welcome through pull requests on GitHub.
## Using the NanoDAP USB debugging probe
This is a mini-HOWTO on installing the appropriate firmware and adapter software, it is loosely based on [this tutorial by RAK](https://docs.rakwireless.com/Product-Categories/Accessories/RAKDAP1-Flash-and-Debug-Tool/Quickstart/#rak4600-evaluation-board).
### Required hardware
The [RAKDAP1/NanoDAP](https://store.rakwireless.com/products/daplink-tool) is a very reasonably priced ($10) USB-based debugging probe. It can be used on many ARM targets but is particularly suited for the nRF52 CPUs. It seems to be based on the ARM [daplink](https://daplink.io/) [project](https://github.com/ARMmbed/DAPLink). The fork of this project is located here: [nanoDAP](https://github.com/wuxx/nanoDAP). The fork is fairly old with respect to the latest daplink goodness, but it seems fine.
If you are looking to buy a probe, there are many other daplink-based devices available. They are suspected to be mostly identical. If you find one that works well, please add a note to this document.
### Required software
You'll need to install the [pyocd](https://pyocd.io/) application to allow VSCode to talk to the NanoDAP. You first install the tool itself but then must add the support files for the nrf52840:
```bash
pip3 install pyocd
pyocd pack --i nrf52840
pyocd pack -s
```
If you are developing on a linux system, you will need to install the udev rules for the NanoDAP.
This is done by copying the rules file from the pyocd distribution to the udev rules directory [per these instructions](https://github.com/pyocd/pyOCD/tree/main/udev).
### Connecting the NanoDAP to your nRF52 target
The NanoDAP has a 10-pin connector, but only three of these pins need to be connected:
- **Ground**: Connects to the ground on the target.
- **TMS-IO**: Connects to SWDIO on the target.
- **TCK-CK**: Connects to SWCLK on the target.
Some web instructions recommend connecting the RESET and 3V3 pins, but this is usually not necessary.
#### Wiring Guide
This image shows an example connection to a RAK4630 board:
![RAK4630 DAP connection](/img/RAKDAP1_New_1.webp)
Photo Courtesy of [RAK Wireless](https://docs.rakwireless.com/assets/images/accessories/rakdap1-flash-and-debug-tool/RAKDAP1_New_1.png).
### Using the NanoDAP with VSCode
The Meshtastic project has a special build environment/target which has been configured to work with the NanoDAP. To use it select the "env:rak3631_dap" target via the command palette or in the bottom left of your VSCode/PlatformIO window. Once that target is selected it changes two things:
- Device programming is no longer performed via the USB bootloader. Instead you you select "Upload" it will use the NanoDAP to program the device.
- The "Debug" button in VSCode will be enabled. If you click that button it will launch the ICE assisted debugger and you can set breakpoints etc...