Adafruit is open, safely ... and shipping all orders at this time! Read more!
0

Circuit Python 4.x rc1 on nRF52840 dongle install?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Circuit Python 4.x rc1 on nRF52840 dongle install?

by rando on Tue Apr 30, 2019 11:04 pm

Howdy,

Floundering around trying to simply install the latest and greatest CircuitPython 4.x rc1 on the nRF52840 Dongle (10059?)

I have a good binary file (I think, built without error), so was thinking I could use adafruit-nrfutil to take advantage the native dfu bootloader in the chip, but can't seem to find the relevant instructions.

https://github.com/adafruit/circuitpyth ... /README.md

I tried it from a linux vm, but did not get "CIRCUITPY" drive on reset.

Any advice how proceed? I'll post some output from my "successful" dfu upload from the VM. I think I've combined two disparate procedures, with out having a clear understanding of what's actually going on is the problem. :(

Well worth the trouble, I think, however!
Attachments
VirtualBox_Ubuntu 18.04.1 2nd. _30_04_2019_22_20_35.png
VirtualBox_Ubuntu 18.04.1 2nd. _30_04_2019_22_20_35.png (220.27 KiB) Viewed 494 times

rando
 
Posts: 60
Joined: Thu Jan 20, 2011 2:03 pm

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by rdagger on Wed May 01, 2019 9:58 am

I don't think the Nordic bootloader will accept a replacement that is not vendor signed. However, you can use the serial wire debug interface to replace it with the Adafruit nRF52 bootloader. I made a video on how to do it with OpenOCD.

rdagger
 
Posts: 36
Joined: Mon Nov 30, 2015 5:44 pm

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by rando on Wed May 01, 2019 10:02 am

I'll check it out! Thanks for the consideration of your reply.

Also I wondering if there's a way to OTA Circuit Python up to the Dongle wireless?

rando
 
Posts: 60
Joined: Thu Jan 20, 2011 2:03 pm

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by rando on Fri May 03, 2019 2:39 pm

Howdy all,

This appears to be a good go forward:

https://github.com/adafruit/Adafruit_nRF52_Bootloader

If I can get the appropriate build of the Adafruit nRF52 bootloader installed, I should be able to drag and drop everything I need onto the Dongle (I think)

But I think I am chasing my tail with the DFU uploade route. I guess it requires being able to use the appropriate Segger JTAG, or similar, to flash program it, because it's not "signed". Sorry new to this, and rough sledding to get all my ducks in a row. This is exactly in line with rdigger's astute recommendation.

See attached.

R.

Ps. The video link above is fantastic, all his videos are a cut above, and very well worth the time.
Attachments
nRF52840 Dongle failed to DFU program, sign issue.JPG
nRF52840 Dongle failed to DFU program, sign issue.JPG (142.21 KiB) Viewed 374 times

rando
 
Posts: 60
Joined: Thu Jan 20, 2011 2:03 pm

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by rando on Thu Aug 01, 2019 5:07 pm

I did stumble on a procedure to use the pca10059, and the latest Micropython to at least get a REPL working ... not very practical.

https://forum.micropython.org/viewtopic.php?f=12&t=5364&hilit=Scanner+ble

"Here's what I did to get Bluetooth REPL running on a pca10059 dongle (beginning with a fresh git clone):

git clone https://github.com/micropython/micropython.git
cd micropython
git submodule update --init
make -C mpy-cross
cd boards/nrf
./drivers/bluetooth/download_ble_stack.sh
modify bluetooth_conf.h

Code: Select all

#elif (BLUETOOTH_SD == 140)

#define MICROPY_PY_BLE (1)
#define MICROPY_PY_BLE_NUS (1)

make BOARD=pca10056 SD=s140

Open nRF Connect, connect to the dongle running in DFU mode, add both
micropython/ports/nrf/build-pca10056-s140/firmware.hex and
micropython/ports/nrf/drivers/bluetooth/s140_nrf52_6.0.0/s140_nrf52_6.0.0_softdevice.hex
and flash the to the dongle.

The dongle now comes up and advertises as "mpus".

I connected to it using Google Chrome running on an Android phone, via the website https://aykevl.nl/apps/nus/. Certainly an enviable amount of free memory!

Quess I will try and connect with a Chromebook next. There is a facility to load files via BLE to the Micropython instance, not tested yet...

Screenshot_20190801-170442.png
Screenshot_20190801-170442.png (35.74 KiB) Viewed 220 times

rando
 
Posts: 60
Joined: Thu Jan 20, 2011 2:03 pm

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by mikew67 on Tue Mar 17, 2020 3:21 am

Hi, Rando,

Can you please update the above instructions. They don't seem to work now:

* The script file, ./drivers/bluetooth/download_ble_stack.sh, doesn't work anymore. The file references to the Nordic site are broken and the soft device versions have advanced. Did the soft device downloads manually (but maybe not to the right places? See below.)

* Small item: It's a bit unclear what steps need to be done vs. literal code changes, e.g., the text starting with #ELIF... through ...NUS (1) are editor changes to the bluetooth_conf.h file, other lines are command lines.

* Also it's a bit confusing as to why the board is spec'd as pca10056 when I'm trying to build for the pca10059 dongle. Presume it's just that the two builds are identical, but it would be nice to explicitly have a PCA10059 target, i.e, the dongle.)

* Finally, when I attempt to do the build, make BOARD=pca10056 SD=s140, if fails right away and repeatedly, failing to find a header file, nrf_nvic.h. *Suspect I got the directory structure wrong for the soft device folders.

Thanks very much for your procedure and look forward to an update to make it work again.

Mike

mikew67
 
Posts: 7
Joined: Tue Mar 17, 2020 2:56 am

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by rando on Tue Mar 17, 2020 11:17 am

Hi Mike,

Sorry to say my nRF52840 dongle died some obscure hardware death, and I've moved on to here...

https://www.adafruit.com/product/4062?gclid=Cj0KCQjw6sHzBRCbARIsAF8FMpXpHproP0_TLSsRT2hkvtY9-59mwTA1KRRntaACbFSaL4n4FNL4fgYaApCiEALw_wcB

It's got a convenient 10-pin header to connect my Segger-edu to, and great support for native Circuit Python.

rando
 
Posts: 60
Joined: Thu Jan 20, 2011 2:03 pm

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by mikew67 on Tue Mar 17, 2020 3:01 pm

Rando,

Thanks for the quick reply. I'll continue to see if I can sort out the issues to get MicroPython on the nRF52840 dongle. If I succeed, I'll post the instructions here.

Mike

mikew67
 
Posts: 7
Joined: Tue Mar 17, 2020 2:56 am

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by rando on Wed Mar 18, 2020 12:16 pm

Hi Mike,

There is an exceptional video here ...

https://www.rototron.info/circuitpython-nrf52840-dongle-openocd-pi-tutorial/

That uses a RasPi as a GPIO driven programmer, that I wish I had time to pursue.

This is a real solution that skips purchasing a Segger J-Link, and should be easy to restore nuked boot-loaders (my situation I fear) and whatever other changes make sense, and generalizes to a neat way to program/debug any JTAG/ARM processor.

Be well!

Randy

rando
 
Posts: 60
Joined: Thu Jan 20, 2011 2:03 pm

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by rando on Wed Mar 18, 2020 1:59 pm

Mike,

Since I (so, so, so) stuck at home today, I took a few minutes and soldered some pins onto my dead dongle, and inserted it into a small bread board as illustrated in the video link I included in my earlier post. Voila the red led started to blink, which means the boot-loader was active. You can see the DFU serial port had been found by Windows 10. As it is almost always, look for the loose connection/poor grounding I suspect. The PCB USB connections are never reliable.

Bootloader active.JPG
Bootloader active.JPG (17.71 KiB) Viewed 71 times


What were looking to tap off is the the CLOCK, and DATA IO signal to my Segger EDU, and make sure the power pins are fed back to the 20-pin to 10-pin converter.

nRF52840 Dongle Plan View (2).jpg
nRF52840 Dongle Plan View (2).jpg (97.33 KiB) Viewed 71 times


Here's what it looks like on my bench ... lot's of flying wires but the connections are stable.

20200318_131437.jpg
20200318_131437.jpg (990.04 KiB) Viewed 71 times


Best,

Randy

rando
 
Posts: 60
Joined: Thu Jan 20, 2011 2:03 pm

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by rando on Wed Mar 18, 2020 2:10 pm

Mike,

Here's what JLinkCMD reports when the connections are valid.

Jlink connected to nRF52840 dongle.JPG
Jlink connected to nRF52840 dongle.JPG (73.73 KiB) Viewed 70 times


It should be strait forward now to do something interesting, like install the appropriate Adafruit bootloader ... but for the life of me I forget the command line to make that happen.

My memory is toast ;)

This looks relevant:

https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/update-bootloader

Best,

Randy

rando
 
Posts: 60
Joined: Thu Jan 20, 2011 2:03 pm

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by rando on Wed Mar 18, 2020 2:35 pm

Mike,

And be sure to read this, full of complex cautionary information ...

https://devzone.nordicsemi.com/nordic/short-range-guides/b/getting-started/posts/nrf52840-dongle-programming-tutorial

Best,

Randy

rando
 
Posts: 60
Joined: Thu Jan 20, 2011 2:03 pm

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by mikew67 on Wed Mar 18, 2020 3:24 pm

Rando,

Thanks for pursuing this. Just like you, I now have some extra stay-at-home-and-stare-at-the-screen time (need a name for this :-). Have higher priority tasks, but fighting with embedded systems is a good diversion...

Moving along the same path as you. Think I can program the dongle with the desktop nrfConnect/Programmer desktop app, once I have the correct hex file(s) and the appropriate memory layout (that conforms to the dongle-specific boot loader requirements).

In that regard, I have the latest CircuitPython binaries for the nRF52840, but they're .bin or .dfu(?) files. Is there a utility to convert either of these to .hex?

I have a nRF52-DK dev kit, so could use that to program the dongle directly via the J-Link path.

Another quick question for you: I have both the standard MicroPython and CircuitPython repos. In your experience, which provides the easier path to programming the dongle? Both purport to have pca10059 targets, but I've trouble building both.

Thanks for all the info.

Stay safe! (Where are you.)

Mike (a member of the "high risk" group; hunkered down in Silicon Valley)

mikew67
 
Posts: 7
Joined: Tue Mar 17, 2020 2:56 am

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by jerryn on Wed Mar 18, 2020 3:38 pm

Mike:
with the j-link - you can opt to install the UF2 Bootloader -- then Circuitpyhton is a drag/drop install
https://github.com/adafruit/Adafruit_nRF52_Bootloader

jerryn
 
Posts: 1231
Joined: Sat Sep 14, 2013 9:05 am

Re: Circuit Python 4.x rc1 on nRF52840 dongle install?

by mikew67 on Wed Mar 18, 2020 3:47 pm

Sounds like a winner!

Thanks,

Mike

mikew67
 
Posts: 7
Joined: Tue Mar 17, 2020 2:56 am

Please be positive and constructive with your questions and comments.