From 0940e4ea7effb15ac382e3ba148395953a0adf9d Mon Sep 17 00:00:00 2001 From: rbaron Date: Wed, 10 Feb 2021 00:07:57 +0100 Subject: [PATCH] Trying to make DFU work. No luck so far. --- code/parasite/boards/e73-tbb.json | 18 +++--------------- code/parasite/platformio.ini | 6 ++++++ code/parasite/src/main.cpp | 2 ++ resources.md | 29 +++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/code/parasite/boards/e73-tbb.json b/code/parasite/boards/e73-tbb.json index e93961e..2921cd1 100644 --- a/code/parasite/boards/e73-tbb.json +++ b/code/parasite/boards/e73-tbb.json @@ -9,20 +9,8 @@ "f_cpu": "64000000L", "hwids": [ [ - "0x239A", - "0x8029" - ], - [ - "0x239A", - "0x0029" - ], - [ - "0x239A", - "0x002A" - ], - [ - "0x239A", - "0x802A" + "0x1a86", + "0x7523" ] ], "usb_product": "E73-TBB nRF52832 development board", @@ -58,7 +46,7 @@ "maximum_size": 524288, "require_upload_port": true, "speed": 115200, - "protocol": "jlink", + "protocol": "nrfutil", "protocols": [ "jlink", "nrfjprog", diff --git a/code/parasite/platformio.ini b/code/parasite/platformio.ini index 363cf4b..3fcfe2f 100644 --- a/code/parasite/platformio.ini +++ b/code/parasite/platformio.ini @@ -14,3 +14,9 @@ platform = nordicnrf52 ; board = adafruit_feather_nrf52832 board = e73-tbb framework = arduino +build_flags = -DNRF52 -DS132 -DNRF51_S132 +; upload_port = /dev/cu.usbserial-14330 +; debug_tool = jlink +; protocol = nrfutil +; lib_deps = +; mbed-glimwormbeacons/SEGGER_RTT2 @ 0.0.0+sha.a7800e894aaf \ No newline at end of file diff --git a/code/parasite/src/main.cpp b/code/parasite/src/main.cpp index 6f0209e..38c6480 100644 --- a/code/parasite/src/main.cpp +++ b/code/parasite/src/main.cpp @@ -6,9 +6,11 @@ constexpr int kLED2Pin = 18; void setup() { pinMode(kLED1Pin, OUTPUT); pinMode(kLED2Pin, OUTPUT); + // Serial.begin(9600); } void loop() { + // Serial.print("Hello, world\n"); digitalWrite(kLED1Pin, LOW); digitalWrite(kLED2Pin, LOW); delay(1000); diff --git a/resources.md b/resources.md index 90a7afd..3449452 100644 --- a/resources.md +++ b/resources.md @@ -8,3 +8,32 @@ # Articles * Great article about using Rust and Apache Mynewt, but also covers J-Link, ST-Link, openocd, unlocking the nrf52. [Link on medium](https://medium.com/@ly.lee/coding-nrf52-with-rust-and-apache-mynewt-on-visual-studio-code-9521bcba6004) + +# SWD vs. Bootloader vs. DFU +* How `nrfutil` is used in the platformio nordicnrf52 package: [link](https://github.com/platformio/platform-nordicnrf52/blob/develop/builder/main.py#L319) +* Seems like we can use DFU if we install a DFU-enabled bootloader like the [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader) +* Using the adafruit nrf52 bootloader with the E73-TBB [link](https://ssihla.wordpress.com/2019/07/23/using-adafruits-bluefruit-nrf52-feather-bootloader-on-a-cheap-chineese-board/) + +## Burning the Adafruit bootloader +1. `$ brew cask install nordic-nrf-command-line-tools` -> Didn't work. I had to manually install the pkgs from [nordic](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools/Download) +1. `pip install intelhex` +1. `PATH=$PATH:/Users/rbaron/.platformio/packages/framework-arduinoadafruitnrf52/tools/adafruit-nrfutil/macos make BOARD=feather_nrf52840_express all` + +## Uploading with nrfutil +``` +$ ~/.platformio/packages/framework-arduinoadafruitnrf52/tools/adafruit-nrfutil/macos/adafruit-nrfutil dfu genpkg --dev-type 0x0052 --sd-req 0x00B7 --application .pio/build/e73-tbb/firmware.hex dfu-pkg.zip +Zip created at dfu-pkg.zip + +$ ~/.platformio/packages/framework-arduinoadafruitnrf52/tools/adafruit-nrfutil/macos/adafruit-nrfutil dfu serial --package dfu-pkg.zip -p /dev/cu.usbserial-14330 -b 115200 +Upgrading target on /dev/cu.usbserial-14330 with DFU package /Users/rbaron/dev/parasite/code/parasite/dfu-pkg.zip. Flow control is disabled, Dual bank, Touch disabled +######################################## +######################################## +######################################## +######################################## +######################################## +####################### +Activating new firmware +Device programmed. +``` + +It flashes okay, but the program doesn't seem to run - the leds don't flash. \ No newline at end of file