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

  • Hi,

    Instead of going straight to the full example, I suggest that you start by testing with the Hello World sample and then testing incrementally more complicated samples up to your app.

    Regards,
    Sigurd Hellesvik

  • The initial problem was caused by the following lines being removed from the DTS file.

        chosen {

            zephyr,console = &uart0;
            zephyr,shell-uart = &uart0;
            zephyr,uart-mcumgr = &uart0;
        };
    I need a uart for modbus communication and the declaration of the uart continues to cause problems. After reinserting the above I can start the application. As long as I am not trying to use a uart for my application I can connect to Azure.
    I have found that uart1 should not be used as it is used internally for TF-M. So I was declaring uart0for use by modbus with the following DTS:
    &uart0 {
        status = "okay";
        current-speed = <115200>;
        pinctrl-0 = <&uart0_default>;
        pinctrl-1 = <&uart0_sleep>;
        pinctrl-names = "default", "sleep";
        modbus0 {
            compatible = "zephyr,modbus-serial";
            status = "okay";
            de-gpios = < &gpio0 8 GPIO_ACTIVE_HIGH>;
        };      
    };
    In an application that is not connecting using modem this is an OK declaration, and the modbus is working.
    But when building an application that also uses modem, I get into trouble. Declaring my application uart to use uart 2 or 3 does work either.
    When keeping the "chosen" section above and starting the uart0 using modbus the application stops. Propably caused by a conflict.
    How can I use an uart for my application modbus in an application that also uses the modem function?
  • Thomas said:
    I have found that uart1 should not be used as it is used internally for TF-M. So I was declaring uart0for use by modbus with the following DTS:

    You can turn of TF-M logging with CONFIG_TFM_LOG_LEVEL_SILENCE. Then TF-M will no longer use any UART.

    Thomas said:
    But when building an application that also uses modem, I get into trouble.

    It is odd that UART communication and modem functionality crashes.
    Let us debug that.

    Do you do anything from UART callbacks? It is usually a good idea to not do a lot in interrupt context, as this may mess up timing requirements from other parts of the system, such  as the modem.

    How do you mean that you get trouble using modem and modbus at the same time? Any  specific errors?

  • I have done some many test that I need to walk through all declarations.... Also to pinpoint what exact combinatios that cause problems.

    I am using Segger J-Link and need the modem and a uart for mobus. I do not have a uart for console but can declare one on unused pins if neede.

    It seems I am getting into trouble declaring a second uart.

    If I configure some unused pins as a uart2 and use this DTS I am back in the situation where my device does not boot.

        chosen {

            zephyr,console = &uart2;
            zephyr,shell-uart = &uart2;
            zephyr,uart-mcumgr = &uart2;
        };

    I am using J-Link RTT and get then this output instead of my device booting:

    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

  • Any help is greaty appreciated. I am so much in trouble with this project...:-(

Related