Hello Nordic Team,
I am experiencing an issue when attempting to flash a Zephyr RTOS application (v3.0.0) to the Adafruit Feather nRF52840 Sense board using a J-Link debugger over the SWD pins on the board’s backside.
Current Setup:
-
Board: Adafruit Feather nRF52840 Sense
-
Debugger: Segger J-Link, connected to SWD pins
-
Development Environment: VS Code with Zephyr SDK v3.0.0
This is main.c file.
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/util.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(main);
void main(void)
{
// Get the device binding for UART0
const struct device *uart_dev = DEVICE_DT_GET(DT_NODELABEL(uart0));
if (!device_is_ready(uart_dev)) {
LOG_INF("Error: UART device not ready.\n");
return;
}
LOG_INF("Message sent via UART.\n");
while (1) {
LOG_INF("Message sending via UART.\n");
printk("Message sent via UART.\n");
k_msleep(1000);
}
}
This is prj.conf
# Enable Pinctrl CONFIG_PINCTRL=y # Enable UART CONFIG_SERIAL=y # Enable console and logging over UART CONFIG_UART_CONSOLE=y CONFIG_CONSOLE=y CONFIG_LOG=y CONFIG_LOG_DEFAULT_LEVEL=3 # Enable minimal Zephyr C library CONFIG_NEWLIB_LIBC=y
Problem:
-
Flashing via the Arduino IDE (UF2 bootloader over USB) works as expected.
-
When flashing my Zephyr application over SWD, the on-board UF2 bootloader is erased. After the SWD flash, none of the board’s peripherals (sensors, LEDs, buttons, micro-USB port, etc.) respond until I manually restore the bootloader.
-
I am unable to see any debug output logs via RTT. I also wired up a physical UART for serial printing, but nothing appears on the COM port after SWD programming.
Questions:
-
Is there a recommended SWD flash sequence or Zephyr project configuration—particularly for Adafruit’s nRF52840 Sense—that will preserve the UF2 bootloader partition?
-
Are there any Nordic-provided tools, scripts, or linker-script modifications to deploy a Zephyr v3.0.0 build from VS Code without overwriting the bootloader?
-
If SWD-based deployment cannot preserve the UF2 bootloader, can you suggest an alternative programming interface or streamlined workflow for Zephyr development on this board?
I look forward to your recommendations.
Regards,
Anmol