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

Unable to establish communication between a nRF52840-Dongle, programmed with the HCI_uart example, and a Raspberry Pi 3 B+

I am trying to use the BluePy Scanner on a Raspberry Pi 3 B+ with a nRF52840-Dongle programmed as a Bluetooth: HCI-uart.

I am able to get the Bluepy Scanner code to work with the onboard BLE, but I am so far unable to get it to communicate with the Bluetooth HCI dongle that is attached to the UART0 (/dev/ttyS0). I have connected UART0_TXD (GPIO14), UART0_RXD (GPIO15), UART0_CTS (GPIO16), and UART0_RTS (GPIO17).

How can I attach and use a nRF52840-Dongle, programmed with the HCI_uart example, with a Raspberry Pi 3 B+?

Following are my nrf52840dongle_nrf52840.overlay and proj.conf files for the HCI_uart.

nrf52840dongle_nrf52840.overlay

/* SPDX-License-Identifier: Apache-2.0 */

&uart0 {
	compatible = "nordic,nrf-uart";
	current-speed = <1000000>;
	status = "okay";
	tx-pin = <45>;
	rx-pin = <42>;
	rts-pin = <47>;
	cts-pin = <29>;
	hw-flow-control;
};

proj.conf

CONFIG_CONSOLE=n
CONFIG_STDOUT_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_BT_HCI_RAW_H4=y
CONFIG_BT_HCI_RAW_H4_ENABLE=y

CONFIG_GPIO=y
CONFIG_UART_0_NRF_FLOW_CONTROL=y
CONFIG_MAIN_STACK_SIZE=1024
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
CONFIG_BT_MAX_CONN=16
CONFIG_BT_TINYCRYPT_ECC=n
CONFIG_BT_CTLR_DTM_HCI=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y

I following DT overlays in on my Raspberry Pi, uart_ctsrts and krnbt_baudrate=1000000.

From the command line I try 

btattach -B /dev/ttyS0 -P bcm -S 1000000 -R &

and I get the following message.

Attaching Primary controller to /dev/ttyS0
Switched line discipline from 0 to 15
Device index 1 attached
Failed to open HCI user channel
No controller attached

hciconfig status returns the following for the onboard BLE

hci0: Type: Primary Bus: UART
BD Address: B8:27:EB:EE:6C:BD ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING
RX bytes:13508 acl:0 sco:0 events:562 errors:0
TX bytes:2402 acl:0 sco:0 commands:124 errors:0

However, when I use the HCI_USB example I see the hci1 entry for the dongle. I realize that the USB will auto mount, unlike ttyS0, this is just to evidence that the dongle is functional.

Parents
  • Hi Matthew,

    UART0_CTS (GPIO16)

    The P016 is not connected to anything on the nrf52dongle, ref

    So try changing it to one of the I/O that are accessible.

    Regards,
    Jonathan

  • Sorry for the confusion. I am not connecting to P0.16 on the dongle. Following are my connections.

    nRF52840-Dongle

    Raspberry Pi 3 B+

    Signal

    Pin

    Signal

    BCM Pin

    40-pin
    header pin

    RX

    P1.10

    <—->

    TXD0

    GPIO14

    8

    TX

    P1.13

    <—->

    RXD0

    GPIO15

    10

    CTS

    P0.29

    <—->

    CTS0

    GPIO16

    36

    RTS

    P1.15

    <—->

    RTS0

    GPIO17

    11

    Following is my Zephyr device tree overlay for the nRF52840-Dongle.

    /* SPDX-License-Identifier: Apache-2.0 */

    &uart0 {
        compatible = "nordic,nrf-uart";
        current-speed = <1000000>;
        status = "okay";
        tx-pin = <45>;
        rx-pin = <42>;
        rts-pin = <47>;
        cts-pin = <29>;
        hw-flow-control;
    };
  • Hi Matthew sorry for the late reply,
    What you have done seems to be correct for the dongle, but I would recommend testing whit a lower baud rate. 
    Alternatively here is a link to a blog post for Linux use. I think maybe the problem is on the RPi side of things, I don't ha a RPi to test right now but can try to get a old of one an se if i can reproduce the error. 
    Have you checked out the RPi forum to see if there are some similar cases? I vas able to find this one, maybe it helps?
    Regards,
    Jonathan

Reply Children
Related