Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-SD-v

Please tell us which board you are 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.
User avatar
RMall
 
Posts: 12
Joined: Mon Dec 20, 2021 9:02 am

Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-SD-v

Post by RMall »

I'm stuck with trying to install Nordic/ANT+ SoftDevice SS340-SD-v6.1.1 on the Itsy Bitsy NRF52840.

Within nRF Connect - Programmer, I am getting the following error: "Unsupported device. The detected device could not be recognized as neither JLink device nor Nordic USB device."
Unrecognized device.JPG
Unrecognized device.JPG (96.73 KiB) Viewed 245 times
Please help. Thanks.

User avatar
danhalbert
 
Posts: 4649
Joined: Tue Aug 08, 2017 12:37 pm

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by danhalbert »

We use our own bootloader on our nRF52840, which is not the typical nRF bootloader, so I am thinking that makes it unrecognizable by nRFConnect-Programmer. You will need to use a JLink hooked up to the SWD pins to reprogram it.

User avatar
RMall
 
Posts: 12
Joined: Mon Dec 20, 2021 9:02 am

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by RMall »

Thanks Dan!

I've now got a J-Link edu mini on order, they are not an easy item to find at this time.

However I also happened across this tutorial which seems to not require a J-Link: https://tinyurl.com/2p8cz7z5 (I had to use a tinyurl link since 'w0rdpress' is classified as a spam word in the originating hyperlink.) This is obviously not spam but trying to share helpful information.

User avatar
RMall
 
Posts: 12
Joined: Mon Dec 20, 2021 9:02 am

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by RMall »

Got the J-Link, wired the pins (3V/Gnd/SWDIO/SWCLK), flashed the board with the updated S340 SoftDevice .hex in NRF Connect-Programmer yet I seem to lose the Adafruit Bootloader and it becomes unrecognizable in Arduino IDE. Dan, I can imagine you already saw that coming with your professional expertise in this field. I've luckily and thankfully now got the original Adafruit bootloader back on the board again. Looks like this won't be as easy as I'd expected.

There's got to be a way to keep the existing, great, and powerful Adafruit bootloader layer and just update to the S340 SoftDevice that is ANT wireless protocol capable. Some of the steps in the tutorial that I linked previously leave me somewhat clueless. Is this the only way? Can I get some help through this aspect?

Plausibly speaking, with a J-Link isn't there a way to replace/flash only the SoftDevice into its preselected memory blocks and then update the preexisting bootloader.txt and any other bootloader files with "S340" in some areas?

I was unaware of Nordic/ANT SoftDevices and versioning before purchasing this Adafruit board. The goal is to create an ANT wireless, crank based power meter on my family's indoor spin bike. I've got the strain gauges to make wheatstone bridge circuits, a few different rated ADCs to try (on-board NRF52, HX711, ADS1115, or ADS1015), the MPU6050 gyro/accelerometer, and the Adafruit NRF52840 Itsy Bitsy Express has the perfect low power and small form factor for all this.

Learning more about this realm along with the technicalities is intriguing and has been very fulfilling. I appreciate what Adafruit has done and are doing for others. Thanks for having this medium of constructive communication.

User avatar
danhalbert
 
Posts: 4649
Joined: Tue Aug 08, 2017 12:37 pm

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by danhalbert »

I think you will need to fork the nRF52 bootloader, https://github.com/adafruit/Adafruit_nRF52_Bootloader, and build your own version. The ANT+-capable SD is almost certainly bigger than the regular SD, so you will need to change the layout to make space for it, and change whatever you need to change in Arduino or CircuitPython to move the start address higher.

User avatar
RMall
 
Posts: 12
Joined: Mon Dec 20, 2021 9:02 am

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by RMall »

Indeed the S340 SoftDevice size is slightly bigger. Sharing a snippet from nRF Connect-Programmer as a depiction (for anyone else who may be interested).
nRF Connect-Programmer  --  S140 vs S340 Size Notes.jpg
nRF Connect-Programmer -- S140 vs S340 Size Notes.jpg (335.64 KiB) Viewed 208 times
Dan, please keep guiding me through this. There's plenty of new terminology I've never heard of that I am now becoming keen to.

Seeing and experiencing this from the start of a rebuild of a bootloader really allows one to appreciate all the time and attention to details that the Adafruit team has put into making their products much easier to work with for others who are just starting out. Thanks for posting videos of helpful nuggets to help show things too! Such as this one about the UF2 bootloader and the initial challenges that were faced... https://www.youtube.com/watch?v=WxCuB6jxLs0

User avatar
danhalbert
 
Posts: 4649
Joined: Tue Aug 08, 2017 12:37 pm

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by danhalbert »

There was a lot of work recently to add SoftDevice 7.0.1 support for the nRF52833 to the bootloader, to allow something other than SoftDevice 6.1.1. 7.01 is 0x1000 larger than 6.1.1. See https://github.com/adafruit/Adafruit_nR ... r/pull/250 and related PR's. Changing to S340 would be similar.

User avatar
RMall
 
Posts: 12
Joined: Mon Dec 20, 2021 9:02 am

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by RMall »

Very interesting, just after I posted my last message I noticed there is now a version 7.0.1 of the S340 SoftDevice. Thanks for sharing this and allowing me to also learn the understanding of a file size being expressed in hexadecimal (0x1000 = 4096 bytes). I appreciate these nuggets/hidden lessons, of wondering what is that or does this mean... Thanks Dan.

I'm wondering if I were to use nRF Command Line Tool to execute "nrfjprog --program S340_SoftDevice.hex --sectorerase -r" command to program the S340 SoftDevice would work and still maintain the existing Adafruit bootloader. I am understanding that the "--sectorerase" will only erase the targeted area instead of all the flash. Am curious if there would still be modifications needed within the bootloader file structure such as the boards.txt file which would entail copying the particular board (Itsy Bitsy) section and renaming the 'S140' string to 'S340' and relabeling the board " w/ ANT", and also copying/renaming/reallocating the linker (.ld) file to configure the memory regions.
ANT S340 nRF5 7.0.1.jpg
ANT S340 nRF5 7.0.1.jpg (126.01 KiB) Viewed 200 times

User avatar
danhalbert
 
Posts: 4649
Joined: Tue Aug 08, 2017 12:37 pm

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by danhalbert »

The bootloader itself uses some SoftDevice functions, so it may need to be compiled with the SD you are going to use. I am not sure how the linkage between the SD API and the actual SD works -- whether you can replace the SD with a new version or not, because the linkage has some indirection.

User avatar
RMall
 
Posts: 12
Joined: Mon Dec 20, 2021 9:02 am

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by RMall »

Not sure where to turn and how to properly accomplish these tasks/instructions...
Step2.JPG
Step2.JPG (51.08 KiB) Viewed 192 times
step3.jpg
step3.jpg (156.3 KiB) Viewed 192 times
---------------------

I've downloaded and installed:
- Nordic's nRF5x Command Line Tools
- ARM-GCC toolchain (Do I need GNU? If so, please share which distribution source to use.)
- Python 3.10, PIP 21.2.4, Python intelHex 2.3.0
- adafruit-nrfutil
- Segger J-Link edu mini with the software toolset (Configurator/Ozone)

I'm noticing some of these installs are not typical programs to select and run from the Windows start menu, so I am guessing I have to call them within a particular command prompt of a particular program somehow. If that is the case, I'm not sure how/where to accomplish. I'm figuring this is a rather simple procedure that can make someone feel foolish.

I'm also venturing to guess that for the board name in my instance would be "$ make BOARD=itsybitsy_nrf52840_express......" instead of "...feather..." in the example instructions. Would that be correct?

Thanks!

User avatar
danhalbert
 
Posts: 4649
Joined: Tue Aug 08, 2017 12:37 pm

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by danhalbert »

We typically build this on a Linux machine, not in a Windows shell window. The setup would be similar to that described in the Building CircuitPython guide:
https://learn.adafruit.com/building-circuitpython

It might be possible to build on Windows with MSYS and other Unix-alike things, but it would be a lot of work. Getting a Linux system running will be easier.

User avatar
RMall
 
Posts: 12
Joined: Mon Dec 20, 2021 9:02 am

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by RMall »

Thanks Dan! I am very grateful that you are pointing me in the right directions for research and learning. It is great to work through these challenges. I was able to work through one issue while trying to build up this test bootloader (ModuleNotFoundError: No module named 'intelhex').

Here is the latest movement forward with having MSYS2/MinGW onboard and where I am at a standstill at the moment. Seems as though there is a failure to properly compile the .out and/or .zip file. Any ideas to resolve? (Please see image)
Progress2.jpg
Progress2.jpg (1004.2 KiB) Viewed 183 times
Thanks for being here and helping many!
Last edited by RMall on Sun Jan 16, 2022 7:19 pm, edited 1 time in total.

User avatar
danhalbert
 
Posts: 4649
Joined: Tue Aug 08, 2017 12:37 pm

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by danhalbert »

See the error "cut is not recognized..."? That will cause some problems.

I'd suggest trying to get WSL2 or a Linux VM working, if you can, since it will be an environment that will be easier to get working. You can keep trying in MSYS2, but you may continue to run into missing this or idiosyncrasies.

User avatar
RMall
 
Posts: 12
Joined: Mon Dec 20, 2021 9:02 am

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by RMall »

This is quite fun learning and doing. It's very nice that you are working with me on this and teaching/coaching all along the way. This has been a heck of a lot of setup, up to this point, starting from pretty much zero.

With WSL2, we are at this point now, making some headway it seems.
Progress6.jpg
Progress6.jpg (566.59 KiB) Viewed 179 times

User avatar
RMall
 
Posts: 12
Joined: Mon Dec 20, 2021 9:02 am

Re: Itsy Bitsy NRF52840: Installing Nordic SoftDevice SS340-

Post by RMall »

I'm thrilled now! Thanks for all your patience Dan!

It's resolved... seemingly for this initial phase of just compiling an existing bootloader with WSL2. It's helpful to install adafruit-nrfutil directly within the bootloader folder location.

Why are the build files named with 'dirty' in them?
Progress8.jpg
Progress8.jpg (682.74 KiB) Viewed 176 times
The makefile denoting 'dirty'
mk dirty.JPG
mk dirty.JPG (82.11 KiB) Viewed 174 times
Drag/Drop of UF2 file while ItsyBitsy is in DFU mode -- WORKS!
Progress9.jpg
Progress9.jpg (245.92 KiB) Viewed 174 times
Now time to work on rebuilding bootloader with the S340 (BLE/ANT protocol) SoftDevice. :-)

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

Return to “Itsy Bitsy Boards”