Hello,
I'm running both central and peripheral roles for BLE on Zephyr, along with UART and some GPIOs.
-
SDK: 2.6.2
-
The project includes MCUboot, supporting DFU over UART and BLE.
-
Running on a custom board.
Everything works except the status LED.
I suspect an initialization issue, but the strange part is:
-
If I flash an older, similar project, the LED blinks.
-
Then, if I flash the problematic project (first MCUboot, then the application), the LED still blinks—albeit with a different pattern, meaning it’s controlled by the new app.
-
However, if I erase the flash and then flash MCUboot and the app, the LED does not blink at all, everything else works.
My question is not just about what might be wrong with the LED configuration, but also:
-
Why does the LED work in the first scenario?
-
Which part of the flash isn't being overwritten when flashing the new app and MCUboot?
aliases { led0 = &led0; mcuboot-button0 = &button0; mcuboot-led0 = &led0; }; chosen { zephyr,sram = &sram0; zephyr,flash = &flash0; zephyr,console = &uart0; zephyr,code-partition = &slot0_partition; }; leds { compatible = "gpio-leds"; led0: led_0 { gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; }; }; buttons { compatible = "gpio-keys"; button0: button_0 { gpios = <&gpio1 00 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>; label = "Push button switch 3"; }; }; }; &gpio0 { status = "okay"; }; &gpio1 { status = "okay"; }; &gpiote { status = "okay"; };
#define LED0_NODE DT_ALIAS(led0) static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios); static int led_init(void) { if (!gpio_is_ready_dt(&led)) { return -ENODEV; } int err = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE); if (err < 0) { return err; } gpio_pin_toggle_dt(&led); return 0; } { for (;;) { err = gpio_pin_toggle_dt(&led); if (err < 0) { LOG_ERR("Main thread loop error"); return err; } k_msleep(SLEEP_TIME_MS); } }