NRF9160 DK failed to add another UART to BLE NUS example

Hello,

I am currently working on a project using the NRF9160DK and I am encountering an issue when trying to add another UART (UART3) to the BLE NUS example.

I have successfully managed to use the hci_lpuart for BLE communication and can run the BLE NUS sample. However, for my use case, I need to add UART3 to my project.

The problem arises when initializing UART3 and trying to assign a callback function for it. I receive the following error on RTT: <err> peripheral_uart: Cannot initialize UART callback.

Here is my overlay:

And relevant code for uart3 initialization:

Any guidance on how to resolve this issue would be greatly appreciated.

Thank you in advance for your help.

Best regards, Vincent

  • Hi,

     

    Could you share your build/zephyr/zephyr.dts and .config? By default, spi3 is enabled, which will create a conflict with enabling uart3.

    If that is the case, you can disable spi3:

     

    Kind regards,

    Håkon

  • I have added the spi3 disable to my overlay but the problem still persists.

    8206.nrf9160dk_nrf9160_ns.conf4087.prj.conf7776.zephyr.dts

  • Hi,

     

    In the compiled down zephyr.dts, uart3 is listed as disabled:

     

    Could you try to restructure your device tree node? Something like this?

     

    Kind regards,

    Håkon

  • I added the uart3 node to the dts file but the problem still persists.

    The uart3 is compiled as okay in the build/zephyr directory:



    Is it possible that the problem is caused by the use of lpuart/uart2 for HCI?
    Because I can enable uart3 and register a callback in a different project that does not use BLE.

  • Hi,

     

    If we look at the failing function in detail, ie. uart.h:

    https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1-2/include/zephyr/drivers/uart.h#L1246

    It does require certain settings for UART3, like "CONFIG_UART_3_ASYNC" is set. Could you share the full .config file from build-folder/zephyr/.config ? You can rename it to .txt if you have problems uploading it here.

     

    Kind regards,

    Håkon

1 2