🛠 Projet firmware complet avec PlatformIO et la sonde J-Link embarquée

nRF52833-DK (boards.json id: nrf52833-dk) · intermediaire · La carte nrf52833_dk existe dans la plateforme nordicnrf52 : PlatformIO livre le compilateur, GDB et l'upload J-Link — la sonde est déjà sur le kit.

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

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials