Sulu Programming With nRF Setup

Downloads

https://www.segger.com/downloads/embedded-studio/
https://www.nordicsemi.com/Products/Development-software/nRF5-SDK/Download#infotabs


nRF52840DK Programmer Setup

  1. Download the SEGGER Embedded Studio for ARM. Use v5.70a (don’t use v6.xx as it leads to compilation errors).

  2. Download the nRF SDK. v17.1.0 should work. You do not need any of the SoftDevices files, so feel free to uncheck them.

  3. Download the configure_nRF_to_low_VDD.zip file attached above and unzip it.

  4. Move the nRF SDK to your desired parent directory, e.g. ~/Documents/nRF5_SDK_17.1.0_ddde560.

  5. Create a MyProjects directory under nRF5_SDK_17.1.0_ddde560/examples. Copy the unzipped configure_nRF_to_low_VDD directory into the MyProjects 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
  6. 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.

  7. 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.

  8. In SEGGER Embedded Studio, compile the project and use J-Link to flash the nRF.

    1. Compile the project by clicking on Build > Build EVA6_1_8v-REG0_test.

    2. Connect to J-Link by clicking on Target > Connect J-Link. The shortcut on Windows is CTRL+T, C.

    3. Flash the nRF board by clicking on Target > Download EVA6_1_8v-REG0_test. The shortcut on Windows is Ctrl+T, L.

  9. Move the nRF power source switch from VDD to USB. The nRF chip and all LEDs should be off.

  10. 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.

    1. Set the switch in the top right to DEFAULT.

    2. Set the switch in the center left (the nRF power source) to USB.

    3. Set the switch in the bottom left corner (power) to ON.

  11. The nRF should be turned on again, but the LEDs should be dimmer. Confirm that the output voltage VDD is at 1.8V.

  12. Clone Fil’s repository found at https://github.com/filmak/SCuM-programmer/tree/develop_12 and check out the develop_12 branch.

  13. 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.

  14. 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.

    1. 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.

    2. 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

  1. Clone Fil’s repository found at https://github.com/filmak/SCuM-programmer/tree/develop_12 and check out the develop_12 branch.

  2. 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.

    1. If you run into errors when importing serial, run pip install pyserial or conda install pyserial.

    2. 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:

  1. Disconnect the 5V → EXT_BAT connection from nRF → Sulu.

  2. Disconnect the 1.8V → VBAT, 1.1V → VDDD, and EXT_VBAT → 1.1V_IN headers from Sulu.

  3. Connect the VDD → VBAT from nRF → Sulu.

  4. Try booting SCuM now.