Detailed Instructions for updating CPB's Bootloaders on a Mac

Play with it! Please tell us which board you're using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
gallaugher
 
Posts: 267
Joined: Tue Aug 14, 2018 12:42 pm

Detailed Instructions for updating CPB's Bootloaders on a Mac

Post by gallaugher »

Please Help!
I've got over 100 Circuit Playground Bluefruit boards with pre 0.4 bootloaders. Many of my students will be using new Macs with Ventura, so my understanding is that I need to update each one of these boards so they have the latest bootloader if I want to get them to work with the latest version of CircuitPython.
Since they are pre 0.4, then I've got to go through a manual process. I'm looking at this post:
https://blog.adafruit.com/2022/10/31/up ... uitpython/
and the steps are not at all clear. I'm hoping someone can give me a step-by-step process that I can follow - I'll need to use the Command-Line style which I 'm assuming I have right here (https://learn.adafruit.com/introducing- ... mmand-line) - that will allow me to repeatedly update all of these boards. Here's what I've done sofar that doesn't seem to be working:
I went to this page: https://github.com/adafruit/Adafruit_nR ... /tag/0.7.0 and downloaded a file named:

Code: Select all

circuitplayground_nrf52840_bootloader-0.7.0_s140_6.1.1.zip
This was initially unzipped by safari, but I also downloaded a .zip version & have this on my desktop, as well.
- Next I went to this page: https://learn.adafruit.com/introducing- ... mmand-line
- I opened my Mac's Terminal & entered the following command:

Code: Select all

pip3 install --user adafruit-nrfutil1
Which returns:

Code: Select all

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
- So I tried downloading

Code: Select all

adafruit-nrfutil-macos
from the green macOS button. This puts a file named adafruit-nrfutil, on my desktop. It does not have the -macro at the end.
- Since this didn't work, I clicked the green button below this. It took me to the following page:
https://github.com/adafruit/Adafruit_nR ... 5.3.post17
where I see a file named '

Code: Select all

adafruit-nrfutil--0.5.3.post17-macos.zip
'. so I downloaded this, keepgin the .zip extension. It's now on my desktop.
- In the terminal, cd'd to my desktop, then ran the command mentioned:

Code: Select all

chmod +x adafruit-nrfutil-macos
but get:

Code: Select all

 No such file or directory 
I'm grateful if anyone can give me very clear steps to follow so that I can sit down with my 100+ CPBs and repeat the process over and over again 'til all my CPBs are ready to go for the start of the semester. Thanks!

User avatar
gallaugher
 
Posts: 267
Joined: Tue Aug 14, 2018 12:42 pm

Re: Detailed Instructions for updating CPB's Bootloaders on a Mac

Post by gallaugher »

OK, Neradoc kindly helped me through this on the Discord channel. I'll be sure to write these instructions up and post after I've double checked, updating all my boards tomorrow, and I'll return here to post the solution in case anyone else needs these instructions.
Cheers!
John

User avatar
neradoc
 
Posts: 542
Joined: Wed Apr 27, 2016 2:38 pm

Re: Detailed Instructions for updating CPB's Bootloaders on a Mac

Post by neradoc »

Yeah since Safari is setup to auto unzip (ugh) and the guide is actually out of date on the mac executable name (I did leave feedback), I came up with a simple sequence of commands for the current version of the files, that don't rely on having python or anything additional to what's there by default.

And by the way you can start in a temporary directory (on the desktop, delete when you're finished).

Code: Select all

mkdir ~/Desktop/temp_for_nrfutil
cd ~/Desktop/temp_for_nrfutil
This downloads the bootloader and the nrfutil tool.

Code: Select all

curl -O -L "https://github.com/adafruit/Adafruit_nRF52_nrfutil/releases/download/0.5.3.post17/adafruit-nrfutil--0.5.3.post17-macos.zip"
unzip "adafruit-nrfutil--0.5.3.post17-macos.zip"
chmod +x adafruit-nrfutil
curl -O -L "https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/0.7.0/circuitplayground_nrf52840_bootloader-0.7.0_s140_6.1.1.zip"
Then read the ports with ls /dev/cu.* and find the board's port.
Ignore the bluetooth related entries.

Code: Select all

ls /dev/cu.*
Example:

Code: Select all

/dev/cu.BLTH                    /dev/cu.usbmodem146301
/dev/cu.Bluetooth-Incoming-Port
It's usually a name like that: /dev/cu.usbmodem146301 with the numbers depending on the USB port it's plugged to. You need the full name, including /dev/.

We set it to a variable for later use (no spaces).
Replace the n's with the real numbers.

Code: Select all

PORT="/dev/cu.usbmodemnnnnnnnn"
If there are multiple ports, identifying which is the correct one would be done by looking at which comes up when the board is put in bootloader mode.

And the flashing command, from the same directory and in the same terminal window as the things above:

Code: Select all

./adafruit-nrfutil --verbose dfu serial --package "circuitplayground_nrf52840_bootloader-0.7.0_s140_6.1.1.zip" -p "$PORT" -b 115200 --singlebank --touch 1200
Because the command uses the PORT variable, if the port changes for any reason, you can change the variable like above, and rerun the same command (but you can also replace "$PORT" manually with the actual port).

User avatar
SnoWake
 
Posts: 4
Joined: Wed Oct 11, 2017 12:07 am

Re: Detailed Instructions for updating CPB's Bootloaders on a Mac

Post by SnoWake »

I have a feeling I this thread may be just the one I'm looking for: I came to the forums with two new bluefruit boards that seemed to work out-of-the-box - and then behave very strangely when I try to install CircuitPython. Wondering if it's related to this bootloader topic - and noting that I'm on a Mac Studio w/ Apple M1 silicon and Ventura (MacOS 13.1).

Off to read some of the referenced posts here, and then try my hand at the clearly-documented steps provided by @neradoc. Will either report back success - or start a different thread with my particular problem.

Thanks for the info!

Locked
Please be positive and constructive with your questions and comments.

Return to “Circuit Playground Classic, Circuit Playground Express, Circuit Playground Bluefruit”