Ble and bluetooth over hci external pins with bluez

marco.rigoni
Posts: 2
Joined: Mon Feb 27, 2017 9:37 am

Ble and bluetooth over hci external pins with bluez

Postby marco.rigoni » Mon Feb 27, 2017 10:09 am

Hello everyone I'm looking for a ble modules that allow my company to develop an embedded linux device that need to have wifi,bluetooth and ble.
The esp32 seams the perfect module for us but we need to use it as a linux peripheral so we need a way to control the wifi and the bluetooth on the esp32 through a serial or spi interface.
For now the most interesting thing is the bluetooth, is it possible to connect the esp32 to a linux pc and control it via hci uart interface?
We need to use bluez stack and the esp32 as hci uart device is it possible?
Let me know.
Thanks
Marco

madscientist_42
Posts: 95
Joined: Tue Feb 21, 2017 10:17 pm

Re: Ble and bluetooth over hci external pins with bluez

Postby madscientist_42 » Tue Mar 28, 2017 2:34 pm

It's perhaps interesting that the documentation indicates that the device supports SDIO/SPI/UART standard HCI transports. If there was a modeset/pin combo/firmware around somewhere to put things into one of these modes, it'd go towards some of my day job tasks, short term, let most of us validate for ourselves that the BT silicon IS implemented as-advertised, and get us to tinkering with some semi-unusual projects that this swiss-army-knife of connectivity and IoT functionality would let us do.

madscientist_42
Posts: 95
Joined: Tue Feb 21, 2017 10:17 pm

Re: Ble and bluetooth over hci external pins with bluez

Postby madscientist_42 » Tue Mar 28, 2017 4:14 pm

Apparently, there's a bit of mode/firmware stuffle that will be offered as an IDF feature not unlike the WiFi to Ethernet bridge code that is done and in testing that DOES this, per issues in the IDF issue tracker on GitHub.

I'll be honest...if you could give me access to the thing rather than waiting until it's "solid" I could help with that guys...

First lesson of FOSS...release early and often with the understanding that you need to warn people about "early alpha" or "early beta" on the stuff.

Just a branch where we have early access to the ol' wrecking ball code would be a win.

dsiganos
Posts: 5
Joined: Sat Jun 17, 2017 9:21 pm

Re: Ble and bluetooth over hci external pins with bluez

Postby dsiganos » Sun Jun 18, 2017 11:29 am

The HCI layer appears to work. I have connected linux bluez with the esp32 vhci and it appears to work. I have not been able to find the standard bluetooth HCI transport for UART or SDIO so I made my own extremely simple one over UART, which you can find here:
https://github.com/dsiganos/vhcibridge
I used my own HCI transport layer and connected to the linux hci_vhci module and the esp32 vhci API. I had to filer out one command that kept crashing the esp32, I still don't know what the command does, but dropping it seems to have had no adverse effect. I was able to scan, pair and transfer a file with my mobile phone using that setup.

After doing that, I found this example which claims to implement standard UART HCI but I can't really understand how it does it and I don't need it anymore because I want to use SDIO anyway. This is the example I am referring to:
https://github.com/espressif/esp-idf/tr ... r_hci_uart

Regarding the wifi, I think using it as a dumb peripheral is not possible because the lower layers of the software appear to be closed source. We don't even have a function to send out layer 2 packets although that's apparently coming out imminently. So I think the only solution at the moment is to delegate all of the wifi management to the esp32 and create a layer 2 packet bridge between the esp32 and the linux host and using a PPP/SLIP like transport and creating a tun/tap device on the linux host.

Who is online

Users browsing this forum: No registered users and 128 guests