Implementing UARTE on a Bluetooth Enabled DK (ncs v1.9.1)

Hello,
im trying to implement the UARTE Driver for simultaneous Use of Bluetooth and asynchrounos Uart TX/RX on a nRF52840 and nrf9160.
The Problem is that neither RX or TX works.

While Debugging i realised it Crashes while trying to create the TXEND Event.
Im getting this Error Message.

00> [00:01:08.938,568] <err> os >>> ZEPHYR FATAL ERROR 1: Unhandled interrupt on CPU 0
00> [00:00:16.987,701] <err> os: Current thread: 0x2000c7a0 (unknown)
00> [00:00:16.993,194] [1;31m<err> fatal_error: Resetting system


relevant proj.conf snippet:
#Logging
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y

CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y

### Peripheral-UART
CONFIG_SERIAL=y
CONFIG_NRFX_UARTE=y
CONFIG_NRFX_UARTE1=y
CONFIG_UART_ASYNC_API=y
CONFIG_UART_1_NRF_HW_ASYNC=y
CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1

### Enable k_malloc/k_free
CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_MAIN_STACK_SIZE=8192


I think it might have something to do with missing KConfig Options

Any possible Solutions or Ideas would be greatly appreceated

  • I accidentally built it for the nrF9160 which explains why it didnt Compile.

    I since changed it to use "UARTE1_SPIM1_SPIS1_TWIM1_TWIS1_IRQn" as it seemed to be the only UARTE related Interrupt but using this crashes the 9160 with this Errorlog

    00> [00:01:08.228,729] <err> os: Exception occurred in Secure State
    00> [00:01:08.229,095] <err> os: ***** HARD FAULT *****
    00> [00:01:08.229,431] <err> os:   Fault escalation (see below)
    00> [00:01:08.229,797] <err> os: ***** BUS FAULT *****
    00> [00:01:08.230,133] <err> os:   Precise data bus error
    00> [00:01:08.230,468] <err> os:   BFAR Address: 0x50008158
    00> [00:01:08.230,834] <err> os: r0/a1:  0x00000000  r1/a2:  0x2000d7f4  r2/a3:  0x00000000
    00> [00:01:08.231,323] <err> os: r3/a4:  0x2000c8fc r12/ip:  0x0000000a r14/lr:  0x000106cf
    00> [00:01:08.231,842] <err> os:  xpsr:  0x61000000
    00> [00:01:08.232,177] <err> os: Faulting instruction address (r15/pc): 0x000106ce
    00> [00:01:08.232,635] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
    00> [00:01:08.233,093] <err> os: Current thread: 0x2000c7a0 (unknown)

    I then tried using the Zephyr Uart Driver on the nRF9160 an the UARTE Driver on the nRF52840.

    The Tx from 52->91 works but the Tx from 91->52 doesnt.

    Also when Tx from 52->91 the Uarte Eventhandler gets called repedeatly with the Eventtype 31.

  • Hi,

    Are you building it from non-secure for the nRF9160? 

    regards

    Jared

  • I build using the nrf9160dk_nrfn9160_ns build target.
    Also i accidentally misclicked and verified your last reply

  • You're building it in non secure mode. The error log specified register 0x50008158 which points to the UARTE0 Secure peripheral not the non secure peripheral which lies at 0x40008000. Can you double check that you're using the correct instance?

  • Hello,

    Sorry for this mess of a Help Request.

    The build from the last Error Message was the nrf52840 Build.
    That Error Message occurs when i use the KCONFIG Option

    CONFIG_UART_ASYNC_API=y
    CONFIG_UART_1_NRF_HW_ASYNC=y
    CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1

    and

    CONFIG_NRFX_UARTE=y

    together. I do not know why


    I have rewritten the Applications.

    For the nrf52840 i use

    build target is nrf52840dk_nrf52840

    IRQ_DIRECT_CONNECT(UARTE1_IRQn, 0, uart_event_handler, 0);

    For the nrf9160 i use

    build target is nrf9160dk_nrf9160_ns

    IRQ_DIRECT_CONNECT(UARTE1_SPIM1_SPIS1_TWIM1_TWIS1_IRQn, 0, uart_event_handler, 0);

    I tried tx and rx with both devices neither complete either task.
    For the nrf52:

    It "completes" the tx but repeatedly calls the uart_event_handler with a unknown event code

    00> [00:00:00.378,448] <inf> main: All Initialized
    00> [00:00:00.378,753] <inf> app_uart: app_uart_send, length:10
    00> [00:00:00.379,089] <inf> app_uart: Trying to TX
    00> [00:00:00.380,249] <err> app_uart: Unknown Case 8669
    00> [00:00:00.380,584] <err> app_uart: Unknown Case 8669

    For the nrf92:

    It does not complete the Tx and hard crashes with following LOG

    00> [00:00:00.493,865] <inf> main: All Initialized
    00> [00:00:00.494,171] <inf> app_uart: app_uart_send, length:10
    00> [00:00:00.494,537] <inf> app_uart: Trying to TX
    00> [00:00:00.495,727] <err> os: Exception occurred in Secure State
    00> [00:00:00.496,093] <err> os: ***** HARD FAULT *****
    00> [00:00:00.496,398] <err> os:   Fault escalation (see below)
    00> [00:00:00.496,765] <err> os: ***** BUS FAULT *****
    00> [00:00:00.497,070] <err> os:   Precise data bus error
    00> [00:00:00.497,375] <err> os:   BFAR Address: 0x50008158
    00> [00:00:00.497,741] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x00000000
    00> [00:00:00.498,199] <err> os: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0xffffffbc
    00> [00:00:00.498,657] <err> os:  xpsr:  0x01000000
    00> [00:00:00.498,992] <err> os: Faulting instruction address (r15/pc): 0x00010676
    00> [00:00:00.499,420] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
    00> [00:00:00.499,847] <err> os: Current thread: 0x2000c6b8 (unknown)

    If you need any other Details. Please let me know

    Also i dont know why but i cant reply to some of your replies.

    Regards

    Nick

Related