BLE UART

We have an NRF52833 connected to the host board(runs LINUX) through UART can anyone help us with the code that goes in the NRF module that can make it work as a transceiver module(just like BLE adaptor) like sending data received from BLE to UART and data received from the host board to BLE

The final solution we are looking for is as follows: Using python on the host board we should be able to use NRF as a BLE adaptor and connect to BLE devices like sensors and receive data from them. All the connection and scanning and reading data code should be controlled or written in python and NRF should act like a transceiver module 

Can it be done? or are we looking in the wrong direction? 

Parents
  • Hi,

    There are several possible approaches here, which is best depends on your use case.

    1. You can use Bluetooth: HCI UART on the nRF device to run the Bluetooth controller there, and use HCI over UART. On the LInux side, use BlueZ as the Bluetooth host layer. This way the nRF will seem like a generic Bluetooth dongle from Linux and you can use it with standard Bluetooth APIs. This will only work with hosts that support HCI, so Linux, but not Windows or Mac, for instance.

    2. You can also use the Bluetooth shell form zephyr/tests/bluetooth/shell/ on the nRF, and interact with it from a script that sends shell commands and parse the output.

  • Option 1 looks fine as we are using Linux. 

    To implement it: 

    1) for Bluez we can use pybluez - https://github.com/pybluez/pybluez

    2) " HCI UART on the nRF device to run the Bluetooth controller "- Can you suggest an example code to start with? 

  • from your reply -> Yes, you are right. I don't have a serial port on my computer. I am using the onboard debugger on a DK as a USB-UART bridge.

    we also did the same thing, loaded the hci_uart sample onto the DK and connected to our Linux computer 
    using DK USB_UART bridge. It worked i got the MTU as 27.7 and was able to scan and connect using bluetoothctl

    Now if it works with USB-UART bridge why it fails with jumper wires on TX(P0.06) and RX(P0.08) pins connected to our jetson UART pins (cross-connection rx-tx and tx-rx).

    we thought our jumper wires are damaged but no we replaced them with a new set of wires many times still haciattach doesn't give an MTU reading to start with its always 0.0

    can you tell us a way to change the tx rx pins of nrf in zephyr to make sure if the pins 6 and 8 are damaged for some reason?

    our current overlay file is 

    &uart0 {
        compatible = "nordic,nrf-uarte";
        current-speed = <1000000>;
        status = "okay";
        hw-flow-control;
    };




  • Hi,

    I see you have HW flow control enabled for uart0 in your overlay. Is that intentional? If so, you must connect the HW flow control pins to the serial port on the computer as well, and that must be configured to use flow control. To change UART pins etc you can create an overlay where you change the pinctrl configuration. See an example here.

  • that is not intentional we directly loaded the sample, can we disable HW flow control and test the whole setup? 

  • with flow control turned on we connected RTS CTS pins to jetson RTS CTS pins and ran hciattach.
    1) a device can be found in hciconfig with MTU 27.7
    2) it was DOWN we used btmgmt to set static-address
    3) ran power on command successfully 
    4) now hciconfig shows a device UP and running with MTU 27.7

    but scanning in btmgmt is not working and also bluetoothctl cannot see any controller when we type SHOW or LIST

    I think we are almost there and one step away from getting it fully working  

  • Hi,

    I am glad to hear you have made progress. As you see the device up from hciconfig and got it working on the same Linux device with a USB-UART bridge all the basics should be in place, so I do unfortunately not have any specific suggestions at the moment.

    Can you share what you have from bluetoothctl with show (though I understand it does not list any controllers) and hciconfig?

Reply Children
No Data
Related