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.

  • If i set the uart2 to status disabled, the application will run and connect.

    &uart2 {
        status = "disabled";
    };
  • Could it be related to the use of Segger RTT. In the project I really do not want to use any uart for console or logging. But since uarts kept on causing problems, I have kept uart0.

    I have the following in prj.conf that shoud stop console on uart and use RTT instread.

    # Logging
    CONFIG_LOG=y
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_UART_CONSOLE=n
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_NRF_MODEM_LIB_TRACE=n
  • The problem that I am stuck at, seems to be that the function stdio_uart() are called more than one time as soon as I declare more that one uart. It does not matter if it is uart1 or uart2 that are added.

    Both call are initializeing uart0

    I have just tried to swap the usage of uart0 and uart2, same result still an assertion.

    This ASSERT in line 94 of uart_stdout.c is causing the problem, the error is NRFX_ERROR_INVALID_STATE returned internally by nrtx_uarte_init().

    Both calls to stdio_uart() are initializing uart0.... through the Driver_USART.c module.

  • The problem that I am stuck at, seems to be that the function stdio_uart() are called more than one time as soon as I declare more that one uart. It does not matter if it is uart1 or uart2 that are added.

    Both call are initializeing uart0

    I have just tried to swap the usage of uart0 and uart2, same result still an assertion.

    This ASSERT in line 94 of uart_stdout.c is causing the problem, the error is NRFX_ERROR_INVALID_STATE returned internally by nrtx_uarte_init().

    Both calls to stdio_uart() are initializing uart0.... through the Driver_USART.c module.

    Looking on the call stack. 

    The first call is comming from main().
    But the second call is originating from SPU_IRQHandler() through dump_error....

  • Thomas said:
    The problem that I am stuck at, seems to be that the function stdio_uart() are called more than one time as soon as I declare more that one uart.

    How do you declare your uarts?

    What do you intend to use the uarts for?

    Could you share your uart code?

Reply Children
No Data
Related