🛠 Projet firmware complet avec PlatformIO et la sonde J-Link embarquée
Why PlatformIO here?
PlatformIO declares the nrf52833_dk board in its nordicnrf52 platform, with J-Link as the default upload method — exactly what the J-Link OB interface MCU on the kit provides: no external programmer to buy. The official board documentation describes this behavior. PlatformIO wraps GCC Arm, GDB, and nrfjprog, and integrates with VS Code.
Step 1 — Install and initialize
pip install platformio
mkdir dk-projet && cd dk-projet
pio project init --board nrf52833_dk
Step 2 — The platformio.ini
[env:nrf52833_dk]
platform = nordicnrf52
board = nrf52833_dk
framework = zephyr
; upload par le J-Link OB embarqué (défaut de la carte)
upload_protocol = jlink
monitor_speed = 115200
PlatformIO's Zephyr framework targets the same board definition as upstream Zephyr (nrf52833dk); for the official Nordic SDK (NCS), stick to the west workflow instead — PlatformIO remains perfect for bare-metal/nrfx and Zephyr projects.
Step 3 — The code, with PCB specifics
Two facts from the User Guide affect every GPIO project on this kit: the LEDs are active-low (P0.13-P0.16), and the buttons (P0.11, P0.12, P0.24, P0.25) have no external pull-ups — you must enable the internal pull-up, otherwise the input floats and you will see phantom presses.
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
static const struct gpio_dt_spec led =
GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
static const struct gpio_dt_spec btn =
GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios);
int main(void)
{
gpio_pin_configure_dt(&led, GPIO_OUTPUT_INACTIVE);
/* le devicetree prévoit déjà GPIO_PULL_UP sur sw0 */
gpio_pin_configure_dt(&btn, GPIO_INPUT);
while (1) {
/* bouton actif-bas : enfoncé => 0 */
gpio_pin_set_dt(&led, gpio_pin_get_dt(&btn) == 1);
k_msleep(20); /* anti-rebond grossier */
}
}
Step 4 — Build, upload, console
pio run # compile
pio run -t upload # flashe via le J-Link OB (câble sur J2)
pio device monitor # console sur le port COM virtuel
The J-Link OB virtual COM port routes the SoC's serial pins (P0.05-P0.08, up to 1 Mbit/s, hardware handshake). If the console remains silent: check that your terminal asserts DTR — without it, the UART lines stay in tri-state (behavior documented in the User Guide). And for debugging, debug_tool = jlink enables breakpoints and memory inspection in VS Code.
Pitfalls and limitations
- PlatformIO's Zephyr framework may lag behind the upstream tree: for the latest Bluetooth samples, prefer west + NCS.
- Pins P0.09/P0.10 remain NFC by default and P0.18 is reset by default on the Nordic side: in the Zephyr framework, the board's devicetree decides, while in nrfx you need the dedicated Kconfigs (see the external probe tutorial).
- Do not use connector J3 (the SoC's native USB) for uploading: the programming interface is J2.
Other tutorials for this board
- Premier blinky Zephyr sur le nRF52833-DK
- Flasher un .hex sans rien installer : MSD et nRF Connect Programmer
- CircuitPython sur le kit Nordic : le prototypage sans C
- Premier périphérique BLE avec le nRF Connect SDK
- Utiliser le DK comme sonde J-Link pour une cible externe
- Réseau Thread / 802.15.4 avec OpenThread sur le nRF52833