I recently bought a few of these little guys:
And I would like to put micropython on them.
The chip is the classic NRF52832. They have a CORTEX-M4, 512K FLASH and 64K RAM. It should be more or less ok for micropython and some basic code.
I soldered some pins to the board and powered it. I then did a bluetooth scan and could detect a "Nordic_HRM" device -> the board is alive.
I looked at the nrf port page here: https://github.com/micropython/micropyt ... /ports/nrf, and the board I want to flash doesn't seem supported. But it's based on the NRF52832 module so I have some hope. I successfully built the default firmware (the one for the pca10040 board).
I then went on to flashing the board.
I have a STLINK-V2 connector and I connected it to the SWDIO and SWCLK pins of the board (and to VCC and GND). I installed openocd from the latest commit on github (so it has support for the nrf52 chips).
If I run openocd, everything seems normal:
I then flashed the firmware that I just built:
Code: Select all
❯ openocd -f nrf52.cfg Open On-Chip Debugger 0.10.0+dev-01383-gd46f28c2e-dirty (2020-08-21-18:25) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD nRF52 device has a CTRL-AP dedicated to recover the device from AP lock. A high level adapter (like a ST-Link) you are currently using cannot access the CTRL-AP so 'nrf52_recover' command will not work. Do not enable UICR APPROTECT. Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections Info : clock speed 1000 kHz Info : STLINK V2J29S7 (API v2) VID:PID 0483:3748 Info : Target voltage: 3.174546 Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints Info : starting gdb server for nrf52.cpu on 3333 Info : Listening on port 3333 for gdb connections
It seemed all right.
Code: Select all
❯ telnet localhost 4444 Trying ::1... Connection failed: Connexion refusée Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Open On-Chip Debugger > program firmware.hex target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x00015908 msp: 0x20010000 ** Programming Started ** nRF52832-QFAA(build code: E0) 512kB Flash, 64kB RAM Adding extra erase range, 0x00023bfc .. 0x00023fff ** Programming Finished ** > program firmware.hex verify target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x00015908 msp: 0x20010000 ** Programming Started ** Adding extra erase range, 0x00023bfc .. 0x00023fff ** Programming Finished ** ** Verify Started ** ** Verified OK **
I then disconnected the STLINK connector. I connected the tx/rx pins to a FTDI adapater, and powered the board. I tried to access the micropython prompt with:
But I could never get my hands a prompt (seems like communication between my PC and the board doesn't happen).
Code: Select all
screen /dev/ttyUSB0 115200
Could you please point me in the right direction?
Do I need a special config for my board? Do you see anything weird in the things I did?
I'll be happy to write an article of make a PR if I manage to get this working.