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);
    }
  • Are you able to build a project with this error for a Development Kit?
    If so, I could test it on my end.

  • azure_iot_hub_2.zippmi8004a1_nrf9160.zipYes - I does not compile directly to DK because the modbus is missing in the device tree for the DK. My my board definition can be loaded into the DK and seems to do same but of course modbus is not available but can be compiled in and activated.
    I will attach both my board and my project.

  • I was able to reproduce the issue, and observe the following log from TF-M

    FATAL ERROR: Platform external interrupt (IRQn): 0x00000003
    Platform Exception: SPU Fault
    

    When I remove everything but the CONFIG_MODBUS and CONFIG_BOOTLOADER_MCUBOOT I also get this error.

    The error is specifc for your boards build target, and not for the nRF9160dk.

    Here is the modified project:

    azure_iot_hub_2_urd.zip

    When I put your board inside the project like that, you can build it from the project by selecting the board in VS Code from "Custom boards".

    This is as far as I go now.
    Next up, you should compare board files for nRF9160DK and your custom board until you find which difference causes the issue.

  • I had to leave the problem for a while.Now I'm back and really needs this device to run.

    Since it seems that it is the board configuration, I restarted with a new copy of the nrf9160_dk_nrf9160 board, and slowly adopted to my hardware, removing unused declarations and adding new.

    I am testing on the nrf9160_dk hardware.

    When I introduce uart2 in the dts file the applications fails.

     The difference betwwen an application running or not running is this dts statement: When this is added application wont run.

    &uart2 {
        status = "okay";
        current-speed = <9600>;
        pinctrl-0 = <&uart_rs485_default>;
        pinctrl-1 = <&uart_rs485_sleep>;
        pinctrl-names = "default", "sleep";
    };

    The application fails to start hanging in an assertion. I will fail in this function on the first ASSERT_HIGH (this is from uarts_stdout.c):
    void stdio_init(void)
    {
        int32_t ret;
        ret = STDIO_DRIVER.Initialize(NULL);
        ASSERT_HIGH(ret);

        ret = STDIO_DRIVER.PowerControl(ARM_POWER_FULL);
        ASSERT_HIGH(ret);
    The application I am running is without any modifications to the sample, except configuration values for DPS. I am running same application with nrf9160_dk_nrf9160 board and my modified version of the same.
Reply
  • I had to leave the problem for a while.Now I'm back and really needs this device to run.

    Since it seems that it is the board configuration, I restarted with a new copy of the nrf9160_dk_nrf9160 board, and slowly adopted to my hardware, removing unused declarations and adding new.

    I am testing on the nrf9160_dk hardware.

    When I introduce uart2 in the dts file the applications fails.

     The difference betwwen an application running or not running is this dts statement: When this is added application wont run.

    &uart2 {
        status = "okay";
        current-speed = <9600>;
        pinctrl-0 = <&uart_rs485_default>;
        pinctrl-1 = <&uart_rs485_sleep>;
        pinctrl-names = "default", "sleep";
    };

    The application fails to start hanging in an assertion. I will fail in this function on the first ASSERT_HIGH (this is from uarts_stdout.c):
    void stdio_init(void)
    {
        int32_t ret;
        ret = STDIO_DRIVER.Initialize(NULL);
        ASSERT_HIGH(ret);

        ret = STDIO_DRIVER.PowerControl(ARM_POWER_FULL);
        ASSERT_HIGH(ret);
    The application I am running is without any modifications to the sample, except configuration values for DPS. I am running same application with nrf9160_dk_nrf9160 board and my modified version of the same.
Children
Related