Custom board crashes calling bt_enable

Hello 
I have a custom board with the following dts
My zephyr app crashes in bt_enable()
Note that uart0 TX pin 8 is used by gps_vrtc_en but uart0 is not defined. Same crash if I have it explicitly disabled

Unfortunately no logs are available on this board. I call bt_enable explicitly from the shell and the board reboots
Any ideas why?
Thank you

dts

// Copyright (c) 2022 Nordic Semiconductor ASA
// SPDX-License-Identifier: Apache-2.0

/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "nrf52840_custom-pinctrl.dtsi"


/ {
    model = "custom";
    compatible = "nRF52840";

    chosen {
        zephyr,console = &cdc_acm_uart0;
        zephyr,shell_uart = &cdc_acm_uart0;
        zephyr,sram = &sram0;
        zephyr,flash = &flash0;
        zephyr,code-partition = &app_partition;
        ncs,dm-timer = &timer2;
    };

    buttons {
        compatible = "gpio-keys";
        button1: button_1 {
            gpios = <&gpio0 30 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
            label = "Push button switch 1";
        };
    };
    leds {
        compatible = "gpio-leds";

        status_led: led_0 {
            gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
            label = "Status LED";
        };
    };
        custom_pins {
        compatible = "gpio-keys";

        charge_detect: charge_detect_1 {
            gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
            label = "Charger detect pin";
        };

        accel_power: accel_power {
            gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
            label = "Accelerometer Power";
        };

        buzzer_en: buzzer_en {
            gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
            label = "Buzzer Enable";
        };

        buzzer: buzzer {
            gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
            label = "Buzzer";
        };

        sensor_power: sensor_power {
            gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
            label = "Sensor Power";
        };
       
        gps_power_en: gps_power_en {
            gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
            label = "GPS Power Enable";
        };
       
        gps_vrtc_en: gps_vrtc_en {
            gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
            label = "GPS VRTC Enable";
        };
       
        gps_reset: gps_reset {
            gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; // Will be pulled low later
            label = "GPS Reset";
        };

        gps_sleep_int: gps_sleep_int {
            gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
            label = "GPS Sleep INT (low active)";
        };

        gps_rtc_int: gps_rtc_int {
            gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
            label = "GPS RTC INT";
        };

        gps_resetb_out: gps_resetb_out {
            gpios = <&gpio1 14 GPIO_PULL_UP>;
            label = "GPS ResetB Out";
        };
        
        lora_cs: lora_cs {
            gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
            label = "LoRa CS";
        };
    };


    aliases {
        sw1 = &button1;
        vib1 = &buzzer; // referred as vib in the code
        cd1 = &charge_detect;
        watchdog0 = &wdt0;
        led0 = &status_led;
        gps-uart = &uart1;
        gps-power-en = &gps_power_en;
        gps-vrtc-en = &gps_vrtc_en;
        gps-reset = &gps_reset;
        gps-sleep-int = &gps_sleep_int;
        gps-rtc-int = &gps_rtc_int;
        gps-resetb-out = &gps_resetb_out;
        lora-cs=&lora_cs;
        lora0 = &lora0;
    };

    vbatt {
        compatible = "voltage-divider";
        io-channels = <&adc 5>;
        output-ohms = <1000000>;
        full-ohms = <(3000000 + 1000000)>;
    };
   
}; // end root

&adc {
    status = "okay";
};

&gpiote {
    status = "okay";
};

&gpio0 {
    status = "okay";
    sense-edge-mask = <0xffffffff>;
};

&gpio1 {
    status = "okay";
    sense-edge-mask = <0xffffffff>;
};

/*
&uart0 {
    compatible = "nordic,nrf-uart";
    status = "okay";
    current-speed = <115200>;
    pinctrl-0 = <&uart0_default>;
    pinctrl-1 = <&uart0_sleep>;
    pinctrl-names = "default", "sleep";
};
 */
&uart1 {
    compatible = "nordic,nrf-uarte";
    status = "okay";
    current-speed = <115200>;
    pinctrl-0 = <&uart1_default>;
    pinctrl-1 = <&uart1_sleep>;
    pinctrl-names = "default", "sleep";
};

&flash0 {
    partitions {
        compatible = "fixed-partitions";
        #address-cells = <1>;
        #size-cells = <1>;

        boot_partition: partition@0 {
            label = "bootloader";
            reg = <0x00000000 0x00027000>;
        };

        app_partition: partition@27000 {
            label = "application";
            reg = <0x00027000 0x000CD000>;
        };

        storage_partition: partition@f8000 {
            label = "storage";
            reg = <0x000f8000 0x00008000>;
        };
    };
};

zephyr_udc0: &usbd {
    compatible = "nordic,nrf-usbd";
    status = "okay";
};
&spi0 {
    status = "okay";
    compatible = "nordic,nrf-spim";
    pinctrl-0 = <&spi0_default>;
    pinctrl-1 = <&spi0_sleep>;
    pinctrl-names = "default", "sleep";

    lora0: radio@0 {
        compatible = "semtech,sx1261";  // Substitute for LR1110
        reg = <0>;                      // SPI chip select (CS index)
        spi-max-frequency = <8000000>;

        reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;  // P1.10
        busy-gpios  = <&gpio0 7 GPIO_ACTIVE_HIGH>;  // P0.07 (DIO2)
        dio1-gpios  = <&gpio1 1 GPIO_ACTIVE_HIGH>;  // P1.01
        //property not mentioned in semtech
        //sx1261 cs-gpios   = <&gpio0 12 GPIO_ACTIVE_LOW>;  // P0.12 (manual NSS)
        // may or may not be needed. There are references in SenseCap firmware
        //tcxo-power-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; /* Optional TCXO control */
        //tcxo-voltage = "1.6V";
        //tcxo-delay-ms = <5>;

    };
};

&zephyr_udc0 {
    cdc_acm_uart0: cdc_acm_uart0{
        compatible = "zephyr,cdc-acm-uart";
    };

    cdc_acm_uart1 {
        compatible = "zephyr,cdc-acm-uart";
    };
   
};


.config
Parents
  • If you are not using UART0, make sure it is either not defined or explicitly disabled in the DTS, and that no part of your configuration (including overlays, Kconfig, or the Bluetooth stack) expects it to be present. If you do define UART0, ensure its pins do not conflict with other GPIO assignments.

    You can disbale the UART0 in the devicetree ovrlay file

    &uart0 {
        status = "disabled";
    };

     

Reply
  • If you are not using UART0, make sure it is either not defined or explicitly disabled in the DTS, and that no part of your configuration (including overlays, Kconfig, or the Bluetooth stack) expects it to be present. If you do define UART0, ensure its pins do not conflict with other GPIO assignments.

    You can disbale the UART0 in the devicetree ovrlay file

    &uart0 {
        status = "disabled";
    };

     

Children
  • uart0 is disabled in dts. I get no build errors.  The firmware runs just fine on the board until I enter a shell command that calls bt_enable . Then the board reboots. I call bt_enable() from k_work ,not shell context. It is called long after the board boots and other functionality works without problems. Anything in my .config or dts that looks suspicious?
    Since I can't connect rtt I tried to redirect log traffic to the shell which uses cdc_acm_uart. I got nothing there.
    My current config uses Nordic Bluetooth stack but I did try Zephyr - no improvement
    Anything in my .config looks suspicious?
    Thanks

Related