This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF9160 custom board uart0 debug printk and program use secure fault

Shalom!

 I have a custom nRF9160 board with uart0 connected to the outside world by RS232. I set the uart0 as the printk() debug output. I also need to write and read binary data through uart0.

When using the nRF9160-DK I was able to configure everything and it worked well through a single virtual com. If I turn off the printk() output I can use the uart without problems but I want to see the Zephyr and Nordic debug information that helps in problem solving.

Now on our custom board, I get to z_arm_secure_fault() when I try to set the callback by ret = uart_callback_set(uart_dev, uart_CB, (void *) &tx_aborted_count);.

What conf and overlay defines must I use to make this possible?

It seems that the system may already use a callback.

I set in my boardns.overlay

&uart0 {
    status = "okay";
    current-speed = <115200>;
    tx-pin = <1>;
    rx-pin = <0>;
};

I set in my boardns.conf file:

# UART
CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y # Enable Async API
CONFIG_UART_INTERRUPT_DRIVEN=y

#Enable RTT Console for prints()
CONFIG_USE_SEGGER_RTT=n
CONFIG_RTT_CONSOLE=n

# Enable UART console, for printk() CONFIG_UART_CONSOLE=y ?!? changed to n
CONFIG_CONSOLE_HANDLER=n
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Async
CONFIG_UART_0_ASYNC=y
CONFIG_UART_0_NRF_HW_ASYNC=y
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=1
CONFIG_NRFX_TIMER=y
CONFIG_NRFX_TIMER1=y

# Trusted execution
CONFIG_TRUSTED_EXECUTION_NONSECURE=y

In my board_common.dts file I have:

    chosen {
        zephyr,console = &uart0;
        zephyr,shell-uart = &uart0;
        zephyr,uart-mcumgr = &uart0;
    };

&uart0 {
    status = "okay";
    current-speed = <115200>;
    tx-pin = <1>;
    rx-pin = <0>;
};


Related