[nRF52] How to get rshell to work with an nRF52?

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
dhylands
Posts: 3067
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: [nRF52] How to get rshell to work with an nRF52?

Post by dhylands » Mon Oct 29, 2018 7:12 pm

Hmm.

If you connect via the regular REPL, what does the output of:
```
>>> import sys
>>> sys.stdin.buffer
```
show?

User avatar
WhiteHare
Posts: 129
Joined: Thu Oct 04, 2018 4:00 am

Re: [nRF52] How to get rshell to work with an nRF52?

Post by WhiteHare » Mon Oct 29, 2018 7:54 pm

dhylands wrote:
Mon Oct 29, 2018 7:12 pm
Hmm.

If you connect via the regular REPL, what does the output of:
```
>>> import sys
>>> sys.stdin.buffer
```
show?

Code: Select all

MicroPython v1.9.4-651-g0f6f86ca4-dirty on 2018-10-27; PCA10056 with NRF52840
Type "help()" for more information.
>>> import sys
>>> sys.stdin.buffer
Traceback (most recent call last):
  File "<stdin>", in <module>
AttributeError: 'module' object has no attribute 'stdin'
>>> 

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

Re: [nRF52] How to get rshell to work with an nRF52?

Post by dhylands » Mon Oct 29, 2018 9:12 pm

Yeah - rshell needs sys.stdin and sys.stdout to work properly.

I have an NRF52840 dongle (https://www.nordicsemi.com/eng/Products/nRF52840-Dongle) that I'll see about creating a board definition for and see what I can get running on that.

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

Re: [nRF52] How to get rshell to work with an nRF52?

Post by rdagger » Wed Nov 28, 2018 4:21 am

I noticed Mouser now has the nRF52840-Dongle in stock for $10. I've been waiting for a supported BLE MicroPython chip.

Is rshell compatible?
Are prebuilt binaries available?
How does the MicroPython port compare to the CircuitPython port?

User avatar
WhiteHare
Posts: 129
Joined: Thu Oct 04, 2018 4:00 am

Re: [nRF52] How to get rshell to work with an nRF52?

Post by WhiteHare » Mon Dec 03, 2018 7:30 pm

rdagger wrote:
Wed Nov 28, 2018 4:21 am
I noticed Mouser now has the nRF52840-Dongle in stock for $10. I've been waiting for a supported BLE MicroPython chip.

Is rshell compatible?
Are prebuilt binaries available?
How does the MicroPython port compare to the CircuitPython port?
AFAIK, there still is no micropython release for the dongle. You can run the bbc:microbit firmware on it, but the filesystem is minuscule and doesn't tap the potential of the much larger flash size of the nRF52840. I had to switch to a different language because of this.

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

Re: [nRF52] How to get rshell to work with an nRF52?

Post by rdagger » Mon Dec 03, 2018 7:44 pm

WhiteHare wrote:
Mon Dec 03, 2018 7:30 pm
AFAIK, there still is no micropython release for the dongle. You can run the bbc:microbit firmware on it, but the filesystem is minuscule and doesn't tap the potential of the much larger flash size of the nRF52840. I had to switch to a different language because of this.
Thanks for the info. It looks like Circuit Python v.4 Alpha 3 supports the dongle. I'm not sure if a J-link is required. The site mentions that the dongle can be programmed by DFU but it is vague on the details.

tannewt
Posts: 32
Joined: Thu Aug 25, 2016 2:43 am

Re: [nRF52] How to get rshell to work with an nRF52?

Post by tannewt » Tue Dec 04, 2018 12:59 am

rdagger wrote:
Wed Nov 28, 2018 4:21 am
I noticed Mouser now has the nRF52840-Dongle in stock for $10. I've been waiting for a supported BLE MicroPython chip.

Is rshell compatible?
Are prebuilt binaries available?
How does the MicroPython port compare to the CircuitPython port?
(CircuitPython dev here.)

At this point its pretty different, we started with glennrub and tralamazzas nrf5 PR (https://github.com/micropython/micropython/pull/3137) into MicroPython and a bunch of work has been done on it since then including non-vendor support for USB (available outside of CircuitPython here: https://github.com/hathach/tinyusb/tree/develop/)

I'm happy to answer any further questions about it.

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

Re: [nRF52] How to get rshell to work with an nRF52?

Post by rdagger » Tue Dec 04, 2018 2:44 am

tannewt wrote:
Tue Dec 04, 2018 12:59 am
(CircuitPython dev here.)

At this point its pretty different, we started with glennrub and tralamazzas nrf5 PR (https://github.com/micropython/micropython/pull/3137) into MicroPython and a bunch of work has been done on it since then including non-vendor support for USB (available outside of CircuitPython here: https://github.com/hathach/tinyusb/tree/develop/)

I'm happy to answer any further questions about it.
I've pieced together install instructions from different sites. Assuming I don't have a J-link and I want to load CircuitPython on an nRF52840-dongle (PCA10059) will the following work?:
1. Download the pre-compiled bin file here for the PCA10059.
2. Run the script download_ble_stack.sh from the CP repo ports/nrf/bluetooth folder to download the soft device files.
3. Plug the PCA10059 into a computer's USB port and press the reset button.
4. Use Nordic's nRF Connect Desktop to load the bin file and SD file.

Thanks.

tannewt
Posts: 32
Joined: Thu Aug 25, 2016 2:43 am

Re: [nRF52] How to get rshell to work with an nRF52?

Post by tannewt » Wed Dec 05, 2018 7:17 am

That sounds like it will work but I haven't done it that way myself. I've only done it with a JLink at this point.

One other option would be to install the nRF UF2 bootloader first and then use the CircuitPython UF2 to install it. The bootloader's repo is here: https://github.com/adafruit/Adafruit_nRF52_Bootloader I believe the instructions in the README are up-to-date (though I've only used a JLink).

Post Reply