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

HCI commands not communicated properly when the hci_uart example is used from Zephyr RTOS Project for the nrf52_pca10040 board( nrf52832 DK)

Hi,

In our project we want to use nRF52832 chip using HCI Command interface.
We are trying to use Zephyr RTOS project for geting HCI interface through UART. We are using hci_uart example provided.

Below is the configuration which we are using for building Zephyr

nrf5.config file:
CONFIG_CONSOLE=n
CONFIG_STDOUT_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_0_NRF_FLOW_CONTROL=y
CONFIG_MAIN_STACK_SIZE=512
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_BT_MAX_CONN=16
CONFIG_BT_TINYCRYPT_ECC=n
CONFIG_BT_CTLR_DTM_HCI=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y

nrf52_pca10040.overlay file:
&uart0 {
compatible = "nordic,nrf-uart";
current-speed = <1000000>;
status = "okay";
};


Example directory in Zephyr project : "zephyrproject\zephyr\samples\bluetooth\hci_uart".
Build commad through cmd prompt after going to example directory:  "west build -b nrf52_pca10040 "
Flash command: "west flash"

The project was successfully flashed without any errors
We have connected the nrf52832 development kit to PC via USB to UART.
We have connected the uart0 (RX-pin 8, TX-pin 6, RTS- pin 5, CTS- pin 7) of nrf52 DK to WIndows PC through a usb to uart FTDI converter.
When we try to send a HCI_Reset command (01 03 0C 00) we are not getting any HCI Command Response nor any logs.

We tried to change the configuration to below, even then we dont see any HCI command complete response form the nrf52 board through uart

modoified nrf5.config file:
CONFIG_CONSOLE=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_LOG=y
CONFIG_UART_CONSOLE=y
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_0_NRF_FLOW_CONTROL=y
CONFIG_MAIN_STACK_SIZE=512
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_BT_MAX_CONN=16
CONFIG_BT_TINYCRYPT_ECC=n
CONFIG_BT_CTLR_DTM_HCI=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_LOG_BACKEND_UART=y

modified nrf52_pca10040.overlay file:
&uart0 {
compatible = "nordic,nrf-uart";
current-speed = <115200>;
status = "okay";
};


Now we are seieng below logs coming from the same UART

***** Booting Zephyr OS build v2.0.0-rc3-11-g4b3f89646d4f *****
[00:00:00.004,852] [0m<dbg> hci_uart.hci_uart_init: [0m
[00:00:00.004,882] [0m<dbg> hci_uart.main: Start[0m
[00:00:00.005,126] [0m<inf> bt_hci_raw: Bluetooth enabled in RAW mode[0m
[00:00:04.799,926] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[1;31m--- 13 messages dropped ---
[0m[00:00:04.799,926] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,926] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,926] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,957] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,957] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,957] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,957] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,957] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,957] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,987] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,987] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,987] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,987] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,987] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.799,987] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.800,018] [0m<dbg> hci_uart.h4_read: read 1 remaining 1[0m
[00:00:04.800,018] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.800,018] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.800,018] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.800,048] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.800,048] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.800,079] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.800,079] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.800,079] [0m<dbg> hci_uart.h4_read: Got zero bytes from UART[0m
[00:00:04.800,109] [0m<dbg> hci_uart.h4_read: read 1 remaining 0[0m
[00:00:04.800,109] [0m<dbg> hci_uart.h4_cmd_recv: len 0[0m
[00:00:04.800,140] [0m<dbg> hci_uart.bt_uart_isr: need to get 0 bytes[0m
[00:00:04.800,140] [0m<dbg> hci_uart.bt_uart_isr: received 0 bytes[0m
[00:00:04.800,140] [0m<dbg> hci_uart.bt_uart_isr: full packet received[0m
[00:00:04.800,872] [0m<dbg> hci_uart.h4_send: buf 20004228, 0x2000534c type 1 len 6[0m

Even when the logs are enabled we dont see any HCI command complete response form the nrf52 board through uart

Related