[{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch2\u003eOverview\u003c/h2\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/001/621/original/base-with-perma-proto.jpeg?1739510289","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003e\u003cspan\u003eAs part of a series on Zephyr with Adafruit hardware, this guide shows how I made a pogo pin SWD debug probe adapter for the CLUE board so I can conveniently program it with Zephyr firmware. My other SWD option was soldering wires to the test points, but I like how pogo pins are neater and less fragile. This guide is meant for people interested in adding support for Adafruit boards to Zephyr. It might also be useful for folks who want to fix a bricked bootloader.\u003c/span\u003e\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n        \u003cp\u003eA press fit style a pogo pin adapter would probably be unsuitable for a factory tester, but it's perfect for me as a developer. To work on Zephyr firmware, I want to leave the CLUE on my desk, connected to a debug probe, with easy access to the front panel.\u003c/p\u003e\n\u003cp\u003eTo make this SWD pogo pin adapter for my CLUE board, I designed and 3D printed a base that holds a perma-proto board and CLUE together with precise horizontal and vertical spacing. When the adapter is fully assembled, the perma-proto board connects the CLUE test points to a 0.1\" header by way of the pogo pins. For 3D modeling, I used \u003ca href=\"https://www.blender.org/\" target=\"_blank\"\u003eBlender\u003c/a\u003e. To get the measurements right, I referred to two CAD models, \u003ca href=\"https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/1214%20PermaProto%20Small%20Mint\" target=\"_blank\"\u003eperma-proto\u003c/a\u003e and \u003ca href=\"https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/4500%20CLUE%20nRF52840\" target=\"_blank\"\u003eCLUE\u003c/a\u003e, from the\u0026nbsp;\u003ca href=\"https://github.com/adafruit/Adafruit_CAD_Parts\" target=\"_blank\"\u003eAdafruilt_CAD_Parts\u003c/a\u003e repository on GitHub.\u003c/p\u003e\n\u003cp\u003eMy procedure was:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eAssemble and test fit the pogo pins with the perma-proto board and CLUE\u003c/li\u003e\n\u003cli\u003eSolder the pogo pins, header strip, and battery cable (you can omit the extra reset button stuff)\u003c/li\u003e\n\u003cli\u003eTake measurements from the perma-proto with my calipers and from the \u003ca href=\"https://github.com/adafruit/Adafruit-CLUE-PCB\" target=\"_blank\"\u003eCLUE .brd file\u003c/a\u003e with \u003ca href=\"https://www.kicad.org/\" target=\"_blank\"\u003eKiCAD\u003c/a\u003e\n\u003c/li\u003e\n\u003cli\u003eImport perma-proto and CLUE CAD models into Blender along with an image from KiCAD showing the testpoint locations\u003c/li\u003e\n\u003cli\u003e\u0026nbsp;Arrange the perma-proto and CLUE models floating in space, but with the right relative locations\u003c/li\u003e\n\u003cli\u003eMake a model of the negative space where the boards will fit into the plastic base, adding 0.1mm clearance around the PCB models with Blender's \u003ca href=\"https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/solidify.html\" target=\"_blank\"\u003eSolidify modifier\u003c/a\u003e\n\u003c/li\u003e\n\u003cli\u003eUse a \u003ca href=\"https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/booleans.html\" target=\"_blank\"\u003eBoolean modifier\u003c/a\u003e to remove the negative space model from a rectangular prism.\u003c/li\u003e\n\u003cli\u003eClean up glitches in the geometry and \u003ca href=\"https://docs.blender.org/manual/en/latest/modeling/meshes/editing/edge/bevel.html\" target=\"_blank\"\u003ebevel\u003c/a\u003e most of the edges\u003c/li\u003e\n\u003cli\u003eExport to STL and print on a Bambu Lab P1S, using\u0026nbsp;\u003ca href=\"https://adafruit-playground.com/u/SamBlenny/pages/calibrate-your-3d-printer-for-dimensional-accuracy\" target=\"_blank\"\u003ecalibrated X-Y Compensation\u003c/a\u003e for dimensional accuracy\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003e\u003cstrong\u003eNote\u003c/strong\u003e: The pictures here of the assembled perma-proto board show a button, yellow hookup wire, and a pogo pin for the CLUE board's RESET test point. You can ignore those because they don't work and they aren't necessary anyway. I misaligned the pogo pin for the reset test point so it's on solder mask instead of copper. It doesn't matter because OpenOCD can reset the board over SWD. If you want a to do a manual reset, poking the button on the bottom of the board with a guitar pick works well.\u003c/p\u003e\n      \n\n\n\n\n\n","metadata":{}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch3\u003eParts\u003c/h3\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"product","content":"https://www.adafruit.com/product/4500","metadata":{}},{"element_type":"parts","content":"\n  \u003cdiv class=\"parts-details\"\u003e\n    \u003cdiv\u003e\n      \u003cspan class=\"parts-quantity\"\u003e2\u003c/span\u003e\u003cspan\u003e x \u003c/span\u003e\n        \u003ca href=\"https://www.digikey.com/en/products/detail/adam-tech/PH1-3B-02-MVS-5375/9831904\" class=\"parts-name\" target=\"_blank\"\u003eAdam Tech PH1-3B-02-MVS-5375 (2-position pogo pin)\u003c/a\u003e\n      \u003cdiv class=\"parts-description\"\u003e2 Position Spring Piston Connector, Through Hole, Solder Cup\u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n  \u003cdiv class=\"parts-action\"\u003e\n  \u003cdiv\u003e\n      \u003ca href=\"https://www.digikey.com/en/products/detail/adam-tech/PH1-3B-02-MVS-5375/9831904\" class=\"parts-url btn-secondary\" target=\"_blank\"\u003eBuy Now\u003c/a\u003e\n\n  \u003c/div\u003e\n\u003c/div\u003e\n\n  \u003cdiv class=\"clearfix\"\u003e\u003c/div\u003e\n","metadata":{"name":"Adam Tech PH1-3B-02-MVS-5375 (2-position pogo pin)","url":"https://www.digikey.com/en/products/detail/adam-tech/PH1-3B-02-MVS-5375/9831904","description":"2 Position Spring Piston Connector, Through Hole, Solder Cup","quantity":"2"}},{"element_type":"product","content":"https://www.adafruit.com/product/1214","metadata":{}},{"element_type":"product","content":"https://www.adafruit.com/product/392","metadata":{}},{"element_type":"product","content":"https://www.adafruit.com/product/1131","metadata":{}},{"element_type":"parts","content":"\n  \u003cdiv class=\"parts-details\"\u003e\n    \u003cdiv\u003e\n      \u003cspan class=\"parts-quantity\"\u003e1\u003c/span\u003e\u003cspan\u003e x \u003c/span\u003e\n        \u003cspan class=\"parts-name\"\u003eKapton (polyamide) Tape, 1cm wide\u003c/span\u003e\n      \u003cdiv class=\"parts-description\"\u003eHigh temperature stable protective tape\u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n  \u003cdiv class=\"parts-action\"\u003e\n  \u003cdiv\u003e\n\n  \u003c/div\u003e\n\u003c/div\u003e\n\n  \u003cdiv class=\"clearfix\"\u003e\u003c/div\u003e\n","metadata":{"name":"Kapton (polyamide) Tape, 1cm wide","url":null,"description":"High temperature stable protective tape","quantity":"1"}},{"element_type":"product","content":"https://www.adafruit.com/product/5699","metadata":{}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch2\u003eAssembly\u003c/h2\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch3\u003eSolder Perma-Proto Board\u003c/h3\u003e\n\u003cp\u003eThis first photo shows what the top of the board looks like. The power wire plugs into the CLUE's battery jack to get a GND connection (VBAT is NC; I only soldered it in for strain relief). The Kapton tape on the battery cable is also for strain relief.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eNOTES\u003c/strong\u003e:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eYou can ignore the button, yellow wires, and upper pogo pins connected to the breadboard row for the yellow wires. The extra reset button it doesn't work because the pogo pin is misaligned on solder mask instead of copper.\u003c/li\u003e\n\u003cli\u003eFor the battery cable, I cut 15cm off the end of a 50cm battery extension cable. Adafruit sells a 100mm JST PH 2-Pin single ended battery cable, but it would be a little short to turn the corner comfortably. I like having the 5cm of extra slack to help avoid putting strain on the connections.\u003c/li\u003e\n\u003c/ol\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/001/622/original/perma-proto-top.jpeg?1739510519","metadata":{"caption":""}},{"element_type":"text","content":"\n        \u003cp\u003eThis photo shows the bottom of the perma-proto board.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eNote\u003c/strong\u003e: I prepared this photo before I realized that the reset pogo pin was slightly misaligned. So, the circuit for the extra reset button doesn't work. You can ignore it. If you omit the reset circuit, then cutting the trace is also not necessary.\u003c/p\u003e\n      ","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/001/628/original/perma-proto-bottom.jpeg?1739512317","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch3\u003e3D Print Base\u003c/h3\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"button","content":"https://github.com/samblenny/clue-swd-pogo-jig/archive/refs/tags/v0.1.0.zip","metadata":{"class":"btn btn-large btn-block btn-primary","button_type":"primary","target":"_blank","zip_folder":"false"}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003eUse the \"DOWNLOAD STL FILE\" button to download the printable 3D model.\u003c/p\u003e\n\u003cp\u003e3D printing suggestions:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eHigh speed PLA (I used Bambu Lab PLA Basic on a P1S)\u003c/li\u003e\n\u003cli\u003e0.2mm layer height\u003c/li\u003e\n\u003cli\u003e4 walls\u003c/li\u003e\n\u003cli\u003e15% line infill\u003c/li\u003e\n\u003cli\u003eCalibrated X-Y compensation\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThis is what my print looked like:\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/001/624/original/3d-printed-base.jpeg?1739510587","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n        \u003ch3\u003ePress Fit Perma-Proto\u003c/h3\u003e\n\u003cp\u003eMy model uses 0.1mm of clearance around the envelope of the Adafruit_CAD_Parts model for the perma-proto PCB. Since all the edges of the PCB are routed cleanly, the fit should be snug without needing to sand the PCB (assuming your X-Y compensation is well calibrated).\u003c/p\u003e\n\u003cp\u003eThis is how the perma-proto looks assembled with the base:\u003c/p\u003e\n      \n\n\n\n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/001/625/original/base-with-perma-proto.jpeg?1739510619","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch3\u003ePress Fit CLUE \u0026amp; Wire SWD Probe\u003c/h3\u003e\n\u003cp\u003eThe next picture shows how the final assembly looks with the CLUE board press fit into the base and a \u003ca href=\"https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html\" target=\"_blank\"\u003eRaspberry Pi Debug Probe\u003c/a\u003e connected to the SWD header pins. To get the press fit right, I had to remove a small amount of rough fiberglass left on one side of the CLUE's PCB from when it was de-panelized.\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"alert","content":"\u003cp\u003eIf you need to sand the PCB to get the fit right, use a mask and avoid getting fiberglass dust on your skin.\u003c/p\u003e","metadata":{"class":"element alert-element build-alert alert-warning","markdown":"If you need to sand the PCB to get the fit right, use a mask and avoid getting fiberglass dust on your skin.","alert_type":"warning"}},{"element_type":"text","content":"\n  \n  \n  \n  \n        \u003cp\u003e\u003cstrong\u003ePin header\u003c/strong\u003e connections from top to bottom:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cstrong\u003eGND\u003c/strong\u003e (connects to CLUE GND by black \u003cstrong\u003ebattery cable\u003c/strong\u003e wire and Pi Debug Probe by \u003cstrong\u003eblack GND wire\u003c/strong\u003e)\u003c/li\u003e\n\u003cli\u003eRESET (this doesn't work, you can ignore it)\u003c/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eSWDIO\u003c/strong\u003e (connects to Pi Debug Probe \u003cstrong\u003eYellow RX/SD wire\u003c/strong\u003e)\u003c/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eSWCLK\u003c/strong\u003e (connects to Pi Debug Probe \u003cstrong\u003eOrange TX/SC wire\u003c/strong\u003e)\u003c/li\u003e\n\u003cli\u003eVBAT (you can ignore this; connects to CLUE VBAT by red battery cable wire)\u003c/li\u003e\n\u003c/ul\u003e\n      \n\n\n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/001/627/original/fully-assembled-programmer.jpeg?1739510673","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003eThis closeup shows how the SWD pogo pins connect to the CLUE board once the programmer is fully assembled.\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/001/626/original/pogo-closeup.jpeg?1739510646","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n  \n        \u003ch2\u003eOpenOCD Example: Flash Bootloader\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003eThis uses OpenOCD and a Pi Debug Probe to program the the \u003ca href=\"https://github.com/adafruit/Adafruit_nRF52_Bootloader\" target=\"_blank\"\u003eAdafruit CLUE bootloader\u003c/a\u003e into the CLUE's nRF52840 flash over SWD. Under normal circumstances, you would use a different method to \u003ca href=\"https://learn.adafruit.com/adafruit-clue/update-bootloader\" target=\"_blank\"\u003eprogram the bootloader\u003c/a\u003e. Doing it this way can let you recover from a bricked or missing bootloader, when DFU over USB with \u003ccode\u003enrfutil\u003c/code\u003e is not possible. Also, as\u003c/span\u003e\u003cspan\u003e I haven't written a Zephyr board definition for the CLUE yet, using the bootloader as a test case gave me a way to verify that the SWD adapter and \u003ccode\u003eopenocd\u003c/code\u003e work for programming the CLUE's nRF52840 flash.\u003c/span\u003e\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003eHere is a terminal capture showing what it looked like when I programmed the Adafruit bootloader onto my bricked CLUE:\u003c/span\u003e\u003c/p\u003e\n      \n\n","metadata":{}},{"element_type":"code","content":"$ wget wget https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/0.9.2/clue_nrf52840_bootloader-0.9.2_s140_6.1.1.hex\n$ openocd -f interface/cmsis-dap.cfg -f target/nrf52.cfg \\\n -c \"adapter speed 5000\" -c init -c targets -c \"reset halt\" \\\n -c \"program clue_nrf52840_bootloader-0.9.2_s140_6.1.1.hex verify reset exit\" \\\n -c shutdown\nOpen On-Chip Debugger 0.12.0+dev-gcf9c0b41c (2025-02-09-09:00)\nLicensed under GNU GPL v2\nFor bug reports, read\n\thttp://openocd.org/doc/doxygen/bugs.html\nInfo : auto-selecting first available session transport \"swd\". To override use 'transport select \u003ctransport\u003e'.\nadapter speed: 5000 kHz\nInfo : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E6625888175D0D2C\nInfo : CMSIS-DAP: SWD supported\nInfo : CMSIS-DAP: Atomic commands supported\nInfo : CMSIS-DAP: Test domain timer supported\nInfo : CMSIS-DAP: FW Version = 2.0.0\nInfo : CMSIS-DAP: Interface Initialised (SWD)\nInfo : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0\nInfo : CMSIS-DAP: Interface ready\nInfo : clock speed 5000 kHz\nInfo : SWD DPIDR 0x2ba01477\nInfo : [nrf52.cpu] Cortex-M4 r0p1 processor detected\nInfo : [nrf52.cpu] target has 6 breakpoints, 4 watchpoints\nInfo : [nrf52.cpu] Examination succeed\nInfo : starting gdb server for nrf52.cpu on 3333\nInfo : Listening on port 3333 for gdb connections\n    TargetName         Type       Endian TapName            State\n--  ------------------ ---------- ------ ------------------ ------------\n 0* nrf52.cpu          cortex_m   little nrf52.cpu          unknown\n[nrf52.cpu] halted due to breakpoint, current mode: Thread\nxPSR: 0x01000000 pc: 0x00000a80 msp: 0x20000400\n[nrf52.cpu] halted due to breakpoint, current mode: Thread\nxPSR: 0x01000000 pc: 0x00000a80 msp: 0x20000400\n** Programming Started **\nInfo : nRF52840-QI/CAAA(build code: D0) 1024kB Flash, 256kB RAM\nInfo : Padding image section 0 at 0x00000b00 with 1280 bytes\nInfo : Flash write discontinued at 0x00025de8, next section at 0x000f4000\nWarn : Adding extra erase range, 0x00025de8 .. 0x00025fff\nInfo : Padding image section 2 at 0x000fc6b8 with 4424 bytes\nWarn : Adding extra erase range, 0x000fd858 .. 0x000fdfff\nWarn : Adding extra erase range, 0x10001000 .. 0x10001013\nWarn : Adding extra erase range, 0x1000101c .. 0x10001fff\n** Programming Finished **\n** Verify Started **\n** Verified OK **\n** Resetting Target **\nshutdown command invoked\n$","metadata":{"language":"terminal","linenums":false}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003eAnd, this is how the CLUE looked when \u003ccode\u003eopenocd\u003c/code\u003e reset the board after successfully flashing the bootloader to the nRF52840 internal flash. At this point, the external QSPI flash chip does not contain a working copy of CircuitPython, so the bootloader shows a message about how to install the CircuitPython UF2 file:\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/001/629/original/bootloader_program_success.jpeg?1739594587","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n        \u003ch2\u003eContext: Why bother with SWD?\u003c/h2\u003e\n\u003cp\u003eMaybe you're wondering, why would anybody bother to do this when you can just program these boards with UF2 files or \u003ccode\u003enrfutil\u003c/code\u003e? There are three main reasons:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003ePrintf debugging goes a long way, but sometimes debuggers are nice. With an SWD connection, you can use \u003ccode\u003egdb\u003c/code\u003e with \u003ccode\u003eopenocd\u003c/code\u003e.\u003c/li\u003e\n\u003cli\u003eSometimes UF2 doesn't work. If your flash is erased or corrupted to the point that the firmware can't provide USB connectivity (no mass storage, no serial, no DFU), SWD programming can potentially get you back to a working bootloader.\u003c/li\u003e\n\u003cli\u003eProgramming with a debug probe makes it so you don't have to press buttons on the microcontroller board to activate the bootloader. Skipping the button pushing can be nice if you compile and flash frequently.\u003c/li\u003e\n\u003c/ol\u003e\n      \n","metadata":{}}]