Page 1 of 1

Ble and bluetooth over hci external pins with bluez

Posted: Mon Feb 27, 2017 10:09 am
by marco.rigoni
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

Re: Ble and bluetooth over hci external pins with bluez

Posted: Tue Mar 28, 2017 2:34 pm
by madscientist_42
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.

Re: Ble and bluetooth over hci external pins with bluez

Posted: Tue Mar 28, 2017 4:14 pm
by madscientist_42
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.

Re: Ble and bluetooth over hci external pins with bluez

Posted: Sun Jun 18, 2017 11:29 am
by dsiganos
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.