Sulu Programming With nRF Setup
Downloads
SEGGER - The Embedded Experts - Downloads - Embedded Studio
nRF5 SDK
nRF52840DK Programmer Setup
Download the SEGGER Embedded Studio for ARM. Use v5.70a (don’t use v6.xx as it leads to compilation errors).
Download the nRF SDK. v17.1.0 should work. You do not need any of the SoftDevices files, so feel free to uncheck them.
Download the
configure_nRF_to_low_VDD.zip
file attached above and unzip it.Move the nRF SDK to your desired parent directory, e.g.
~/Documents/nRF5_SDK_17.1.0_ddde560
.Create a
MyProjects
directory undernRF5_SDK_17.1.0_ddde560/examples
. Copy the unzippedconfigure_nRF_to_low_VDD
directory into theMyProjects
directory. The directory structure look look as follows:nRF5_SDK_17.1.0_ddde560/ examples/ MyProjects/ configure_nRF_to_low_VDD/ pca10056/ blinky.eww main.c uicr_config.h
Open the
nRF5_SDK_17.1.0_ddde560/examples/MyProjects/configure_nRF_to_low_VDD/pca10056/blank/ses/EVA6_1_8v-REG0_test.emProject
project with SEGGER Embedded Studio.IMPORTANT: Connect the nRF to the computer with two micro USB cables, but do not have SCuM connected to the nRF. You need flash the nRF firmware first. Make sure that the nRF power source switch is set to VDD.
In SEGGER Embedded Studio, compile the project and use J-Link to flash the nRF.
Compile the project by clicking on
Build > Build EVA6_1_8v-REG0_test
.Connect to J-Link by clicking on
Target > Connect J-Link
. The shortcut on Windows isCTRL+T, C
.Flash the nRF board by clicking on
Target > Download EVA6_1_8v-REG0_test
. The shortcut on Windows isCtrl+T, L
.
Move the nRF power source switch from VDD to USB. The nRF chip and all LEDs should be off.
Configure the switches on the nRF as follows. Assume that the nRF is horizontal with the micro USB ports on the left and on the bottom.
Set the switch in the top right to DEFAULT.
Set the switch in the center left (the nRF power source) to USB.
Set the switch in the bottom left corner (power) to ON.
The nRF should be turned on again, but the LEDs should be dimmer. Confirm that the output voltage VDD is at 1.8V.
Clone Fil’s repository found at GitHub - filmak/SCuM-programmer at develop_12 and check out the
develop_12
branch.Open the
SCuM-programmer/scum-programmer/scum-programmer.emProject
project with SEGGER Embedded Studio. Afterwards, restart the SEGGER Embedded Studio. Upon restarting, SEGGER will warn you of missing packages, including, but not limited to, CMSIS 5 CMSIS-CORE Support Package and SEGGER C++ Library Package [ARMv7E-M]. Install these packages.In SEGGER Embedded Studio, compile the project and use J-Link to flash the nRF. After flashing the nRF board, the LEDs marked LED1, LED2, LED3, and LED4 in the top right will blink in a circular pattern.
If you see an error that the
core_cm4.h
file cannot be found, restart SEGGER Embedded Studio as you may be missing some packages.If the LEDs are all blinking simultaneously, try setting the switch in the bottom left corner (power) to OFF and back to ON.
SCuM Bootloading
Clone Fil’s repository found at GitHub - filmak/SCuM-programmer at develop_12 and check out the
develop_12
branch.To bootload (after completing the wiring setups below), run the following command:
python3 test_bootload.py
. You will need to manually change the COM port and the path to the binary file.If you run into errors when importing
serial
, runpip install pyserial
orconda install pyserial
.On Mac, change the COM port to the nRF’s serial port, e.g.,
/dev/cu.usbmodem0006839038541
. I was able to determine the port by using Arduino to list the available serial ports.
For some reason, some USB-C dongles do not like transmitting large binaries at once (even though UART packets carry one byte at a time). The workaround is to chop up the binary into multiple smaller byte chunks (e.g., 32 bytes) before writing them to the serial interface.
Wiring
nRF → Sulu Connections (only make connections after completing the above steps)
GND → GND
5V → EXT_BAT
P0.28 → 3WB_CLK
P0.29 → 3WB_DATA
P0.30 → 3WB_EN
P0.31 → HRESET
Sulu → Sulu Connections (use pin headers)
1.8V → VBAT
1.1V → VDDD
EXT_VBAT → 1.1V_IN
VBAT → VDDIO
VDDD → BTSRC_SEL
UART → Sulu Connections
UART from SCuM can pass through the nRF serial connection, but there are still minor problems that need to be fixed in the setup. For now, it’s easiest to use a USB UART device. The one found here works well. Any serial device must be configured to 1.8V to properly work with SCuM. You can use any serial monitor (set to 19200 baud), such as the one built into the Arduino IDE.
GND → GND
RXD (UART RX) → RsTx
TXD (UART TX) → RsRx
Debugging
If SCuM fails to boot with the 5V supply from the nRF, it may be due to the external 1.1V and 1.8V regulators on Sulu. We have had success with multiple boards by doing the following:
Disconnect the 5V → EXT_BAT connection from nRF → Sulu.
Disconnect the 1.8V → VBAT, 1.1V → VDDD, and EXT_VBAT → 1.1V_IN headers from Sulu.
Connect the VDD → VBAT from nRF → Sulu.
Try booting SCuM now.