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...

  • In current testing I am ending up in an assertion in tfm_hal_platform_common_init that is calling stdio_init().

    Event though I was just thinking that I would not do anything with uart1 (that was supposed to be used by TFM), it seems to have influence. So I will try the suggested CONFIG_FTM_LOG_LEVE_SILENCE...

  • Using the CONFIG_TFM_LOG_LEVEL_SILENCE brings me into an assertion. The following line 76 in uart_deprecated_async.c:

        err = pinctrl_apply_state(PINCTRL_DT_DEV_CONFIG_GET(UART1_NL), PINCTRL_STATE_DEFAULT);
        __ASSERT_NO_MSG(err == 0);
    It is being called from nrf_modem_lib_trace_init().
  • Ah, looks like modem trace uses UART1.
    You could try to disable it if not not needed usingCONFIG_NRF_MODEM_LIB_TRACE.

    From Enabling tracing in the application:
    "

    By default, the nRF Connect SDK’s modem library uses the UART1 peripheral for trace output. This means that you cannot use UART1 for other purposes in your application. If this does not work for your application, you must update the configuration and code of the modem library to use a different UART peripheral for trace output.

    "

  • It is fine for me not to use uart1. I have kept the following in the device tree:

    /* Disable UART1, because it is used by default in TF-M */

    &uart1 {
        status = "disabled";
    };
    In my prj.conf file I have 
    CONFIG_TFM_LOG_LEVEL_SILENCE=y
     
    Now I am trying with CONFIG_NRF_MODEM_LIB_TRACE=n, I found this in the source code following the call stack.
  • Trying to figure out why I have so many conflicts with the uart, I have remove use of it in my application.

    I have removed decaration of uart0 from the DTS.

    In DTS I have also removed the use of uart0

        chosen {
    /*      
            zephyr,console = &uart0;
            zephyr,shell-uart = &uart0;
            zephyr,uart-mcumgr = &uart0;
    */      
        };
    And in prj.conf got:
    CONFIG_TFM_LOG_LEVEL_SILENCE=y
    CONFIG_NRF_MODEM_LIB_TRACE=n
    So I am trying to remove all use of uart0...
    I now cannot compile because of at_host.c where uart0 is used in 
    #if DT_HAS_CHOSEN(ncs_at_host_uart)
    static const struct device *const uart_dev = DEVICE_DT_GET(DT_CHOSEN(ncs_at_host_uart));
    #else
    static const struct device *const uart_dev = DEVICE_DT_GET(DT_NODELABEL(uart0));
    #endif
    How do I prevent this use of uart0
    -------------------------
    It is not really that I need uart0 to be unused. But my problems seems to come from uart usage conflict.
    It would be nice to have uart0 as a console and for all the default and uart2 for my modbus port. But I am unable to figure out a DTS and configuration that can work with that.
Related