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

Parents
  • 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

  • Hi,

    For the nRF9160 case:

    1. Are you still building the project in non secure mode? Can you share the code and prj.config for this, it seems that you're using the incorrect instance.

    For the nRF52840:

    1. A bit unsure what happens with the nRF52840. Could you also share the code and prj.config file for this one?

    regards

    Jared

  • Hello,
    Sorry for the long wait.

    I have found out what i have to do to get the UARTE Driver to work with the "normal" (Zephyr based) Async Api.

    You dont have to implement the UARTE Driver directly you just have to enable


    CONIFG_UARTE
    CONFIG_UARTE_x ( where x is youre instance etc)



    As for the Questions you had:
    1. Yes im very sure i build it for the NS Target it might hat something to do with the Fact that i just used a normal char buffer.

    2.It was identical to the other nrf91 implementation.

    In General the rewrite just made sure that it wasnt a weird Logic Fault or something,
    otherwise the new Code was very similar to the Codes and KConfigs i posted here earlier.

    This Driver also solved the Problem i had in this Ticket.https://devzone.nordicsemi.com/f/nordic-q-a/88947/isr-error-in-asynchronous-uart-rx-tx-crashing-zephyr-when-using-bluetooth-ncs-v1-9-1

    I have my implementation here for anyone maybe having the same problem.
    uart_drv.rar


    Still thank you for your help

    Regards,
    Nick

Reply Children
No Data
Related