Attached is micropython firmware for the nRF52840

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
User avatar
WhiteHare
Posts: 129
Joined: Thu Oct 04, 2018 4:00 am

Re: Attached is micropython firmware for the nRF52840

Post by WhiteHare » Sat Oct 27, 2018 12:43 pm

I think I may see your gotcha. You are using an nRF52840, not an nRF52832. Thus, if I'm inferring correctly, you should set SD=140, not SD=132 during your make. Likewise, any flag changes in the bluetooth config file should be made in that section so that they will trigger when you set SD=140.

User avatar
devnull
Posts: 359
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: Attached is micropython firmware for the nRF52840

Post by devnull » Sat Oct 27, 2018 2:00 pm

Ahh, I assumed that 122,132.140 was something to do with the BT revision number not the device, but that makes more sense.

Thanks, will try and update the results.

User avatar
rdagger
Posts: 87
Joined: Tue Feb 28, 2017 6:16 pm
Contact:

Re: Attached is micropython firmware for the nRF52840

Post by rdagger » Sat Feb 09, 2019 6:50 pm

Has anyone been able to flash the nRF52840-dongle (PCA10059) without a J-link? Looks like it might be possible using DFU over a serial USB connection with nrfutil. I’d also be interested if anyone has been able to do it with OpenOCD using a programmer or DFU.

User avatar
dhylands
Posts: 3227
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Attached is micropython firmware for the nRF52840

Post by dhylands » Sat Feb 09, 2019 7:16 pm

I've flashed the nrf52840 using DFU, but not with MicroPython. I've been working on some Zigbee software for my work project.

The process I use is to create a package using nrfutil:

Code: Select all

nrfutil pkg generate --debug-mode --hw-version 52 --sd-req 0x00 --application nrf52840_xxaa.hex dfu.zip
and then also use nrfutil to do the actual flashing:

Code: Select all

nrfutil dfu usb-serial -pkg $< -p $(shell find_port.py -n Nordic) -b 115200
The find_port.py script mentioned above can be found here: https://github.com/dhylands/usb-ser-mon ... nd_port.py

Note that I'm not using a SoftDevice above, so you'll probably need to change things if you're using a SoftDevice.

You can also do this on the pca10056 by flashing the DFU bootloader via jlink and then flashing the code via DFU.

User avatar
rdagger
Posts: 87
Joined: Tue Feb 28, 2017 6:16 pm
Contact:

Re: Attached is micropython firmware for the nRF52840

Post by rdagger » Sat Feb 09, 2019 9:02 pm

dhylands wrote:
Sat Feb 09, 2019 7:16 pm
I've flashed the nrf52840 using DFU, but not with MicroPython. I've been working on some Zigbee software for my work project.
The process I use is to create a package using nrfutil:

Code: Select all

nrfutil pkg generate --debug-mode --hw-version 52 --sd-req 0x00 --application nrf52840_xxaa.hex dfu.zip
and then also use nrfutil to do the actual flashing:

Code: Select all

nrfutil dfu usb-serial -pkg $< -p $(shell find_port.py -n Nordic) -b 115200
Note that I'm not using a SoftDevice above, so you'll probably need to change things if you're using a SoftDevice.
I was able to use nrfutil pkg generate, but when I tried to flash I got an error:
nrfutil pkg generate --debug-mode --hw-version 52 --sd-req 0xB6 --application pca10059_bootloader-0.2.7_s140_6.1.1.hex dfu.zip

nrfutil dfu usb-serial -pkg dfu.zip -p COM7 -b 115200

Traceback (most recent call last):
File "nordicsemi\__main__.py", line 1314, in <module>
File "click\core.py", line 764, in __call__
File "click\core.py", line 717, in main
File "click\core.py", line 1137, in invoke
File "click\core.py", line 1137, in invoke
File "click\core.py", line 956, in invoke
File "click\core.py", line 555, in invoke
File "nordicsemi\__main__.py", line 975, in usb_serial
File "nordicsemi\__main__.py", line 941, in do_serial
File "nordicsemi\dfu\dfu.py", line 129, in dfu_send_images
File "nordicsemi\dfu\dfu.py", line 97, in _dfu_send_image
File "nordicsemi\dfu\dfu_transport_serial.py", line 253, in send_init_packet
File "nordicsemi\dfu\dfu_transport_serial.py", line 370, in __execute
File "nordicsemi\dfu\dfu_transport_serial.py", line 454, in __get_response
pc_ble_driver_py.exceptions.NordicSemiException: Response Code InsufficientResources
[12644] Failed to execute script __main__
I also tried nRF Connect but got the following error:
The bootloader update must be signed. The DFU operation has been cancelled.

User avatar
dhylands
Posts: 3227
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Attached is micropython firmware for the nRF52840

Post by dhylands » Sat Feb 09, 2019 11:02 pm

Not sure if it makes any difference, but I was using a linux host.

Packaging the blinky example:

Code: Select all

nrfutil pkg generate --debug-mode --hw-version 52 --sd-req 0x00 --application _build/nrf52840_xxaa.hex _build/dfu.zip
and flashing:

Code: Select all

nrfutil dfu usb-serial -pkg _build/dfu.zip -p /dev/ttyACM0 -b 115200
  [####################################]  100%
Device programmed.
I also tried with nrfConnect and it was able to flash properly as well.

You need to make sure that you're building for mbr. So to build blinky I ran make from this directory: nRF5_SDK_for_Thread_and_Zigbee_2.0.0_29775ac/examples/peripheral/blinky/pca10059/mbr/armgcc

I know for the pca10056 I built this version of the bootloader:
examples/dfu/open_bootloader/pca10056_usb_debug/armgcc

The debug version apparently doesn't need signatures. I've never reprogrammed the bootloader on my dongle, only used the one that came with it.

User avatar
dhylands
Posts: 3227
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Attached is micropython firmware for the nRF52840

Post by dhylands » Sat Feb 09, 2019 11:41 pm

Looking at the Insufficient Resources error, I found this:
https://devzone.nordicsemi.com/f/nordic ... ota-failed

User avatar
rdagger
Posts: 87
Joined: Tue Feb 28, 2017 6:16 pm
Contact:

Re: Attached is micropython firmware for the nRF52840

Post by rdagger » Sun Feb 10, 2019 12:35 am

dhylands wrote:
Sat Feb 09, 2019 11:41 pm
Looking at the Insufficient Resources error, I found this:
https://devzone.nordicsemi.com/f/nordic ... ota-failed
Thanks. I was trying to replace the bootloader with the CircuitPython bootloader. I guess you can only do it with a hardware programmer.

I'm trying to get OpenOCD working with bit banging on the Pi but it's not cooperating.

User avatar
rdagger
Posts: 87
Joined: Tue Feb 28, 2017 6:16 pm
Contact:

Re: Attached is micropython firmware for the nRF52840

Post by rdagger » Sun Feb 10, 2019 6:53 am

Not sure how but the UICR.REGOUT0 got cleared and the board became bricked at 1.8V (I did not erase all). I ended up just using a J-Link with nrfjprog to erase and re-flash. It was straight forward, but I was hoping to find an easy solution for people without J-Links.

CircuitPython runs very well on the nRF5280-Dongle (PCA10059) when plugged into a Linux box. However, it was very unreliable in Windows 10.

User avatar
dhylands
Posts: 3227
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Attached is micropython firmware for the nRF52840

Post by dhylands » Sun Feb 10, 2019 4:07 pm

Does the REPL work over USB with the nrf52840 dongle?

Post Reply