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

nRF52840-DK as HCI-UART based on zephyr issue

There are two boards, Raspberry PI4 and nRF52840-DK. The task is for the nRF52840-DK on zephyr hci-uart firmware:

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/bluetooth/hci_uart/README.html

to operate in HCI-UART (HCI only driver) mode, and Raspberry PI4 to operate in host mode. On the host side, the version 5.50 BlueZ is installed. The boards are connected via UART interface, at 921600Kb/s speed. After connecting and initializing nRF52840 using the hciattach command, the device initializes and connects and even scans (hcitool lescan) and sees other LE devices, but when trying to connect to them or get information about them (leinfo), an error occurs for the first time:

Could not create connection: Connection timed out

An error occurs during further attempts:

Could not create connection: Input/output error

There is a similar problem with setting the device name. An error occurred while trying to read or set the name (hciconfig hci* name):

Can't read local name on hci1: Input/output error (5)

At the same time, the oscillograph shows that the exchange between the devices is in both directions… There were also attempts to change speed and flow control - but, they did not give results.

As a result, we have: you can scan and watch visible devices, but you can't get anything, connect or change anything. Only scan and device list - that's all.

Boards Connection:

RPI4 (PIN27) <-> NRFDK (P0.08); RPI4(PIN28) <-> NRFDK (P0.06); RPI4 (GND) <-> NRFDK (GND)

 

Raspberry PI4 board configuration and params:

OS: Raspbian (32bit), V: 1.4

BlueZ: 5.50

UART: UART2

TXD -> GPIO0 -> PIN27

RXD -> GPIO1 -> PIN28

UART Speed: 1000000 / 921600 / 115200 Kb/s (variants of test)

Flow Control: None

RX/TX TTL Voltage: 3.3V

 

nRF52840-DK board configuration and params:

FW: HCI-UART (Zephyr Bluetooth: HCI UART sample)

nRF Connect SDK: 1.5.0

Project name: hci-uart

Build: zephyr.elf

UART: UART0

UART Speed: 1000000 / 921600 / 115200 Kb/s (variants of test)

Flow Control: None

 

Bluez device attach command string (for variant of 921600Kb/s):

sudo hciattach -t 5 -s 921600 /dev/ttyAMA1 any 921600 noflow nosleep

Parents
  • Hi,

     

    You shall use flow control with H4, as described in the description of the sample:

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/bluetooth/hci_uart/README.html#overview

     

    The baudrate of 921k6 is quite inaccurate, and you should rather use 1M baud. Here's the actual baudrate, as per the comment from nrf52_bitfields.h:

    #define UART_BAUDRATE_BAUDRATE_Baud921600 (0x0EBED000UL) /*!< 921600 baud (actual rate: 941176) */

     

    sudo hciattach -t 5 -s 921600 /dev/ttyAMA1 any 921600 noflow nosleep

     hciattach is a deprecated tool, you should use btattach instead (with hwfc).

     

    Kind regards,

    Håkon

  • Hi,

     

    Could you try following the guide here?

    https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/nrf5x-support-within-the-zephyr-project-rtos

     

    From chapter "Using the BLE Controller with Linux's BlueZ" shows how to interface the hci device using newer bluez tools.

     

    Kind regards,

    Håkon

    I also tried this option, the whole difference in only one line in the command "sudo hciconfig hci0 version...":

    hci0:   Type: Primary  Bus: UART
            BD Address: 00:00:00:00:00:00  ACL MTU: 27:7  SCO MTU: 0:0
            HCI Version:  (0xb)  Revision: 0x0
            LMP Version:  (0xb)  Subversion: 0xffff
            Manufacturer: not assigned (1521)
        
    Attempting to set local name:
    pi@raspberrypi:~ $ sudo hciconfig hci0 name xxx
    Can't change local name on hci0: Input/output error (5)

    --------------------------------------------------------------------

    Build on nordic NRF SDK:
    hci0:   Type: Primary  Bus: UART
            BD Address: 00:00:00:00:00:00  ACL MTU: 27:7  SCO MTU: 0:0
            HCI Version:  (0xb)  Revision: 0x1190
            LMP Version:  (0xb)  Subversion: 0x1190
            Manufacturer: Nordic Semiconductor ASA (89)
        
    Attempting to set local name:
    pi@raspberrypi:~ $ sudo hciconfig hci0 name xxx
    Can't change local name on hci0: Input/output error (5)

  • Hi,

     

    There's several tools that are deprecated by bluez, as shown in the first link:

    There's a number of utilities in the upstream bluez bluetooth package that have long been deprecated with their functionality replaced by the core bluetoothctl utility. They're no longer receiving updates and at some point may be removed. Move these utilities to a dedicated sub package to indicate their upstream support status.
    
    The list of utilities being moved are: ciptool gatttool hciattach hciconfig hcidump hcitool rfcomm sdptool

    some features of those tools might not work with newer versions of bluez. newer tools are prefixed with "bt".

    Please use newer tools. 

     

    AlexandrX said:
    Attempting to set local name:
    pi@raspberrypi:~ $ sudo hciconfig hci0 name xxx
    Can't change local name on hci0: Input/output error (5)

    if you setup a terminal with btmon, you can see the debug information.

    This particular response isn't responded to on my end.

     

    Try using btmgmt --index <your index>

    Then issue:

    power on

    find -l

    You should get:

    Discovery started
    hci1 type 6 discovering on

     

    and a list of discovered LE devices in your area.

     

    AlexandrX said:
    hci0:   Type: Primary  Bus: UART
            BD Address: 00:00:00:00:00:00  ACL MTU: 27:7  SCO MTU: 0:0
            HCI Version:  (0xb)  Revision: 0x0
            LMP Version:  (0xb)  Subversion: 0xffff
            Manufacturer: not assigned (1521)

      Similar output here, it seems your manufacturer lookup table is old. that one belongs to the linux foundation.

    $ hciconfig hci1 version
    hci1:	Type: Primary  Bus: USB
    	BD Address: 00:00:00:00:00:00  ACL MTU: 27:7  SCO MTU: 0:0
    	HCI Version: 5.2 (0xb)  Revision: 0x0
    	LMP Version: 5.2 (0xb)  Subversion: 0xffff
    	Manufacturer: The Linux Foundation (1521)
    

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    There's several tools that are deprecated by bluez, as shown in the first link:

    There's a number of utilities in the upstream bluez bluetooth package that have long been deprecated with their functionality replaced by the core bluetoothctl utility. They're no longer receiving updates and at some point may be removed. Move these utilities to a dedicated sub package to indicate their upstream support status.
    
    The list of utilities being moved are: ciptool gatttool hciattach hciconfig hcidump hcitool rfcomm sdptool

    some features of those tools might not work with newer versions of bluez. newer tools are prefixed with "bt".

    Please use newer tools. 

     

    AlexandrX said:
    Attempting to set local name:
    pi@raspberrypi:~ $ sudo hciconfig hci0 name xxx
    Can't change local name on hci0: Input/output error (5)

    if you setup a terminal with btmon, you can see the debug information.

    This particular response isn't responded to on my end.

     

    Try using btmgmt --index <your index>

    Then issue:

    power on

    find -l

    You should get:

    Discovery started
    hci1 type 6 discovering on

     

    and a list of discovered LE devices in your area.

     

    AlexandrX said:
    hci0:   Type: Primary  Bus: UART
            BD Address: 00:00:00:00:00:00  ACL MTU: 27:7  SCO MTU: 0:0
            HCI Version:  (0xb)  Revision: 0x0
            LMP Version:  (0xb)  Subversion: 0xffff
            Manufacturer: not assigned (1521)

      Similar output here, it seems your manufacturer lookup table is old. that one belongs to the linux foundation.

    $ hciconfig hci1 version
    hci1:	Type: Primary  Bus: USB
    	BD Address: 00:00:00:00:00:00  ACL MTU: 27:7  SCO MTU: 0:0
    	HCI Version: 5.2 (0xb)  Revision: 0x0
    	LMP Version: 5.2 (0xb)  Subversion: 0xffff
    	Manufacturer: The Linux Foundation (1521)
    

     

    Kind regards,

    Håkon

Children
No Data
Related