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

lpuart fails if cellular modem is used

HW: nRF9160 DK

SDK: nRF Connect SDK v 1.4.2

Hello, this is to report a buggy behavior I encountered when trying to implement a BLE-LTE gateway on nRF9160 DK

First, I wasn't able to reliably run the  `lte_ble_gateway` sample: sometimes ble scan wouldn't start, and often random reboots occured.

Then, I checked `aws-iot` and zephyr's `bluetooth/central_hr` samples (with `hci_lpuart` sample running on nrf52). They both worked fine. 

So i tried to craft my own gateway from these 2 samples. I noticed that:

  • If I initialize bluetooth first, it works until I initialize the modem and try connecting to AWS. Then application crashes
  • If I initialize AWS first, it also works fine, until I try to initialize bluetooth. Then, application crashes

So networking and HCI bluetooth were working fine separately, but not together.

Most of the time application crashed silently without any logging, but sometimes I got assertion fails such as

`ASSERTION FAIL [(data->rx_state != RX_ACTIVE) && (data->rx_state != RX_IDLE) && (data->rx_state != RX_OFF)] @ WEST_TOPDIR/nrf/drivers/serial/uart_nrf_sw_lpuart.c:437`

or

`ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:375  k_sem_take failed with err -11`

After some trial and error, I was able to solve it by reducing lpuart speed from 100000 to 115200 in both `hci_lpuart` and my application. The `lte_ble_gateway` sample also started to work after this tweak. 

So I suppose there's some incompatibility between LTE and UART drivers in Zephyr, seems like network routines has higher priority over UART so UART driver sometimes don't have time left to process incoming data if it arrives at high speed. This is just my speculation though, I didn't dig too deep, hope this info will reach zephyr developers.

Parents Reply Children
No Data
Related