Programming the Taida Century NRF52832 developer board

Its been a long hiatus regarding this post. At the time I’ve bought a generic eBay/Aliexpress nRF52832 development board (the Taida Century NRF52832 based board) for performing some BLE testing, did some development with Nordic SDK and the NRF Arduino firmware using Platformio, but posted nothing on my blog regarding the tests.
The main trigger for picking up again this board and do some writing about it, is that I’m evaluating RIOT-OS and its capability to target several hardware platforms, namely the NRF52 based chips. Anyway, first the use of the Arduino framework for the NRF52 and platformio:

Programming the NRF52832:
For programming the Taida Century NRF52 board need a programmer supporting the NRF52 chip, that can be either a SEGGER JLink programmer probe (highly recommended), or with a STLink V2 coupled with modified Openocd software, that also does work fine (Recent versions of Openocd already support the NRF52 out of the box). The Blackmagic probe is also an alternative, but since I have now a Jlink probe, never bother again with it.

The hardware connections for programming and debugging:
Since that the board does not have a serial to USB chip and a USB connection, an external TTL to USB serial convert must be used to see any serial output on the computer from the Serial.println commands. Furthermore the USB serial adapter must also must work with the 3.3V used by the NRF52. The 3.3v power can be provided either by the USB serial converter or by the debug probe (but not both at the same time!). I normally use a 6 pin CP2102 USB serial adapters: they work with 3.3v and have all the serial pins exposed.

The Arduino framework for the NRF52 board and specifically for the Taida board variant uses the following pins for serial communication:

RXD – Pin 18
TXD – Pin 19
GND – GND

So the TXD labelled pin on the USB adapter connects to the Pin 18 labelled header on the board (RXD), and the RXD pin on the USB adapter, connects to Pin 19 on the pin header on the board. Ground connects to ground. That settles the serial connection for debugging. The ground pin should also be connected either on the header pin labelled GND on the top left when the IDC connector is on the left, or on the IDC connector itself.

The connections for programming are a bit tricker depending if we are using an STLink programmer or a Segger Jlink programmer. In both cases the power can be provided by the programmer, but with the JLink one, a special connection is also needed so that the SWD debug lines voltage reference used is 3.3v instead of 5v.

Connecting the ST-Link programmer:
Since we are powering up the board from the programmer, and using one of those cheap st-link usb dongles, only four connections are needed:

The USB programmer has a 3.3v output and so can power up the board directly to the 3.3v board pin.

Connecting the JLink probe:
The Jlink probe can only provide 5V output on the JTAG pins, and so while the JTAG pins TCK and TMS can be connected to the TCK and TMS pins on the JTAG connector, the 5V pin must be connected to the VBUS pin on the IDC connector. This pin will provide power to the board and the internal regulator drops it down from 5V to 3.3V. To adjust the logic levels from the probe to 3.3V the JTAG pin VREF must be connected to the IDC pin 3.3V pin, that informs the JLink probe the device target working voltage.
So in total one more connection that with the ST-Link programmer.

The connection diagram is as follows, where the Taida board 12 pin IDC connector is used:

After the connection is done, we can test if we can communicate with the board using the JLinkExe:

JLinkExe -if SWD -device NRF52 -speed 4000
SEGGER J-Link Commander V6.44 (Compiled Mar  1 2019 17:36:52)
DLL version V6.44, compiled Mar  1 2019 17:36:42

Connecting to J-Link via USB...O.K.
Firmware: J-Link V10 compiled Mar  1 2019 16:57:49
Hardware version: V10.10
S/N: XXXXXXXXX
License(s): FlashBP, GDB
OEM: SEGGER-EDU
VTref=3.264V

Type "connect" to establish a target connection, '?' for help
J-Link>connect
Device "NRF52" selected.

Connecting to target via SWD
Found SW-DP with ID 0x2BA03466
Found SW-DP with ID 0x2BA03466
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x02880000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
Cortex-M4 identified.
J-Link>

So the JLink probe works just fine.

The above did work, because the JLink probe is programmed to provide 5V power with the power on perm command.

Using Platformio to programm the board:

To program the board, it is necessary to specify correctly the Nordic SoftDevice and for that, the platformio.ini file needs special configuration, namely on the build_flags and build_unflags.

[env:stct_nrf52_minidev]
platform = nordicnrf52
board = stct_nrf52_minidev
framework = arduino
lib_deps = 259
build_flags = -DS132, -DNRF52_S132, -g3, -Og, -DNRF_52822_DEBUG -DENABLE_DEBUG_LOG_SUPPORT -DNRF_LOG_USES_RTT=1 -DENABLE_SWO
build_unflags = -Os, -O1, -O2, -O3, -g1
;upload_protocol = stlink
debug_tool = jlink

With this file, any example from the NRF Arduino Library compiles.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.