Problem bringing up custom board with custom board file

On a new board based on nRF9160 I am having trouble figuring out how to bring up the board.

I am using Azure IoT hub and can successfully build an application that can connect using the nRF9160DK_NRF9160 Non Secure board files. This is working both on the DK board and on my custom hardware board.

I have copied the nRF9160DK_NRF9160 board to my own board and renamed files and definitions to match my own board.

I can see that when using the DK board package I get a nrf9160dk_nrf9160_ns.conf file with some configuration that I do not find I my board files. I have copied these definitions into my prj.conf file.

When debugging my board using my custom board files (NS) I get this output on J-Link RTT:

00> *** Booting nRF Connect SDK v3.5.99-ncs1 ***
00> I: Starting bootloader
00> I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
00> I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
00> I: Boot source: none
00> I: Image index: 0, Swap type: none
00> I: Bootloader chainload address offset: 0x10000
00> I: Jumping to the first image slot

But when using the board definition for nRF9160DK_NRF9160 Non Secure I get this:

00> *** Booting nRF Connect SDK v3.5.99-ncs1 ***
00> [00:00:16.895,935] <inf> azure_iot_hub_sample: Azure IoT Hub sample started
00> [00:00:16.895,965] <inf> azure_iot_hub_sample: Bringing network interface up and connecting to the network
00> [00:00:17.124,908] <inf> nrf_modem_lib_trace: Trace thread ready

.... connecting and running.

What am I missing for my own board definition. I am working in the same project file with just the above two build definitions...

Parents
  • I am currently again at continues reboot: 


    00> *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    00> I: Starting bootloader
    00> I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Boot source: none
    00> I: Image index: 0, Swap type: none
    00> I: Bootloader chainload address offset: 0x10000
    00> I: Jumping to the first image slot
    00> *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    00> I: Starting bootloader
    00> I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Boot source: none
    00> I: Image index: 0, Swap type: none
    00> I: Bootloader chainload address offset: 0x10000
    00> I: Jumping to the first image slot
    00> *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    00> I: Starting bootloader
    00> I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Boot source: none
    00> I: Image index: 0, Swap type: none
    00> I: Bootloader chainload address offset: 0x10000
    00> I: Jumping to the first image slot
    00> *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    00> I: Starting bootloader
    00> I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Secondary image:

    I am experimenting with uart settings but do not find any setting where I can use a serial port for rs485 modbus and optionally another one for console (not in current hardware, but pins are free).

    I have the following in the pinmux, and this is not changed during experimenting:

        uart_rs485_default: uart_rs485_default {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 9)>;
            };
            group2 {
                psels = <NRF_PSEL(UART_RX, 0, 10)>;
                bias-pull-up;
            };
        };

        uart_rs485_sleep: uart_rs485_sleep {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 9)>,
                        <NRF_PSEL(UART_RX, 0, 10)>;
                low-power-enable;
            };
        };  
        uart_console_default: uart_console_default {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 29)>;
            };
            group2 {
                psels = <NRF_PSEL(UART_RX, 0, 28)>;
                bias-pull-up;
            };
        };

        uart_console_sleep: uart_console_sleep {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 29)>,
                        <NRF_PSEL(UART_RX, 0, 28)>;
                low-power-enable;
            };
        };

    Then experimeting with dtsi and config settings. Current test that causes continous reboot is caused by: 

        chosen {

            zephyr,console = &uart0;
            zephyr,shell-uart = &uart0;
            zephyr,uart-mcumgr = &uart0;
            ncs,at-host-uart = &uart0;
        };

    &uart2 {
        status = "okay";
        current-speed = <9600>;
        pinctrl-0 = <&uart_rs485_default>;
        pinctrl-1 = <&uart_rs485_sleep>;
        pinctrl-names = "default", "sleep";
        modbus0 {
            compatible = "zephyr,modbus-serial";
            status = "okay";
            de-gpios = < &gpio0 8 GPIO_ACTIVE_HIGH>;
        };      
    };

    &uart0 {
        status = "okay";
        current-speed = <115200>;
        pinctrl-0 = <&uart_console_default>;
        pinctrl-1 = <&uart_console_sleep>;
        pinctrl-names = "default", "sleep";
    };
    Some serial things from config:
    # Enable uart driver
    CONFIG_SERIAL=y

    # enable console
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=n
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_LOG=y
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_LOG_DEFAULT_LEVEL=4
    # Modem
    CONFIG_NRF_MODEM_LIB_TRACE=n
    #CONFIG_AT_HOST_LIBRARY=y
    CONFIG_MODEM_KEY_MGMT=y
    # Modbus and serial
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_UART_LINE_CTRL=n
    CONFIG_TFM_LOG_LEVEL_SILENCE=y

    CONFIG_MODBUS=y
    CONFIG_MODBUS_ROLE_CLIENT=y

    CONFIG_PINCTRL=y
    CONFIG_UART_USE_RUNTIME_CONFIGURE=y
    And in my application I am opening modbus port with the following:
    #define MODBUS_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_modbus_serial)
    #define MODBUS_STACK_SIZE 1024
    #define MODBUS_PRIORITY 5


    K_THREAD_DEFINE(modbus_tid, MODBUS_STACK_SIZE,
                    ModbusClientThread, NULL, NULL, NULL,
                    MODBUS_PRIORITY, 0, 0);

    static int init_modbus_client(void)
    {
        const char iface_name[] = {DEVICE_DT_NAME(MODBUS_NODE)};

        client_iface = modbus_iface_get_by_name(iface_name);

        return modbus_init_client(client_iface, client_param);
    }
Reply
  • I am currently again at continues reboot: 


    00> *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    00> I: Starting bootloader
    00> I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Boot source: none
    00> I: Image index: 0, Swap type: none
    00> I: Bootloader chainload address offset: 0x10000
    00> I: Jumping to the first image slot
    00> *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    00> I: Starting bootloader
    00> I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Boot source: none
    00> I: Image index: 0, Swap type: none
    00> I: Bootloader chainload address offset: 0x10000
    00> I: Jumping to the first image slot
    00> *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    00> I: Starting bootloader
    00> I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Boot source: none
    00> I: Image index: 0, Swap type: none
    00> I: Bootloader chainload address offset: 0x10000
    00> I: Jumping to the first image slot
    00> *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    00> I: Starting bootloader
    00> I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    00> I: Secondary image:

    I am experimenting with uart settings but do not find any setting where I can use a serial port for rs485 modbus and optionally another one for console (not in current hardware, but pins are free).

    I have the following in the pinmux, and this is not changed during experimenting:

        uart_rs485_default: uart_rs485_default {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 9)>;
            };
            group2 {
                psels = <NRF_PSEL(UART_RX, 0, 10)>;
                bias-pull-up;
            };
        };

        uart_rs485_sleep: uart_rs485_sleep {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 9)>,
                        <NRF_PSEL(UART_RX, 0, 10)>;
                low-power-enable;
            };
        };  
        uart_console_default: uart_console_default {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 29)>;
            };
            group2 {
                psels = <NRF_PSEL(UART_RX, 0, 28)>;
                bias-pull-up;
            };
        };

        uart_console_sleep: uart_console_sleep {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 29)>,
                        <NRF_PSEL(UART_RX, 0, 28)>;
                low-power-enable;
            };
        };

    Then experimeting with dtsi and config settings. Current test that causes continous reboot is caused by: 

        chosen {

            zephyr,console = &uart0;
            zephyr,shell-uart = &uart0;
            zephyr,uart-mcumgr = &uart0;
            ncs,at-host-uart = &uart0;
        };

    &uart2 {
        status = "okay";
        current-speed = <9600>;
        pinctrl-0 = <&uart_rs485_default>;
        pinctrl-1 = <&uart_rs485_sleep>;
        pinctrl-names = "default", "sleep";
        modbus0 {
            compatible = "zephyr,modbus-serial";
            status = "okay";
            de-gpios = < &gpio0 8 GPIO_ACTIVE_HIGH>;
        };      
    };

    &uart0 {
        status = "okay";
        current-speed = <115200>;
        pinctrl-0 = <&uart_console_default>;
        pinctrl-1 = <&uart_console_sleep>;
        pinctrl-names = "default", "sleep";
    };
    Some serial things from config:
    # Enable uart driver
    CONFIG_SERIAL=y

    # enable console
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=n
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_LOG=y
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_LOG_DEFAULT_LEVEL=4
    # Modem
    CONFIG_NRF_MODEM_LIB_TRACE=n
    #CONFIG_AT_HOST_LIBRARY=y
    CONFIG_MODEM_KEY_MGMT=y
    # Modbus and serial
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_UART_LINE_CTRL=n
    CONFIG_TFM_LOG_LEVEL_SILENCE=y

    CONFIG_MODBUS=y
    CONFIG_MODBUS_ROLE_CLIENT=y

    CONFIG_PINCTRL=y
    CONFIG_UART_USE_RUNTIME_CONFIGURE=y
    And in my application I am opening modbus port with the following:
    #define MODBUS_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_modbus_serial)
    #define MODBUS_STACK_SIZE 1024
    #define MODBUS_PRIORITY 5


    K_THREAD_DEFINE(modbus_tid, MODBUS_STACK_SIZE,
                    ModbusClientThread, NULL, NULL, NULL,
                    MODBUS_PRIORITY, 0, 0);

    static int init_modbus_client(void)
    {
        const char iface_name[] = {DEVICE_DT_NAME(MODBUS_NODE)};

        client_iface = modbus_iface_get_by_name(iface_name);

        return modbus_init_client(client_iface, client_param);
    }
Children
Related