-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ESP32 as Bluetooth controller #28872
Comments
@Cimex97 Hard to reproduce w/o the matching HW. Can you enable CONFIG_BT_DEBUG_HCI_DRIVER ? |
Here is the output with
|
@Cimex97 genuine question: ESP32 is supported on Zephyr as a WIFI controller, but is that supposed to work in BLE mode ? |
Zephyr don't support the ESP32 with BLE mode. This wrote @carlescufi in this issue. But in my case, zephyr doesn't run on the ESP32. |
@Cimex97 ok, so we can close this issue then, right ? |
Maybe not. I want to use a nucleof411re board as a Bluetooth host and the ESP32 as a Bluetooth controller. The ESP32 is connected over UART to the nucleof411re and I want to use the hci_uart interface to have Bluetooth support on this board. |
So maybe it could work, but in that case, since there is no official support for that, this is not a bug but a feature request and might require some development. |
Is there a build that acts as a controller over UART for the ESP32? Or can you make one? If you can come up with one, then using Zephyr as the Host is trivial and requires only configuration. |
@Cimex97, would you mind providing mode information on the sample configurations you're using (native_posix_64 vs nucleo_f411re). Right now I don't have ESP32, so I can't test and see what does (/not) happen. I'm sorry for asking these questions, but w/o available HW to reproduce, my ability to support is limited. |
I'm sure that the ESP32 need hw-flow-control. This is required for the ESP32 as a UART HCI controller. I tested it with the This is the configuration of the sample:
I build and flash it onto the nucleo_f411re and I got the error message above. If I build it for native_posix_64, then I can start the application with |
@Cimex97, please note that BT_HCI_ACL_FLOW_CONTROL, is HCI level flow control, which is different from the RTS/CTS uart level flow control. What I'm proposing is to have a try w/o the UART level flow control ( |
Ok I tried to disable the hw-flow-controll. On the nucle_f411re I get now a lot of this error messages: Note: I have to connect the CTS pin from the ESP32 to the RTS-pin. I don't know why. |
That's how CTS/RTS works.
Can you try to increase BT_RX_STACK_SIZE, say CONFIG_BT_RX_STACK_SIZE=2048 ? |
Than I get this message again:
|
ok, txs. |
Hey @erwango, |
Hi @Cimex97, sorry finally I haven't got a chance to find a ESP32 (was a ESP8266, so no bt...). I need to order one. |
Okay, thank you for your answer. |
Hey @carlescufi, |
Hey, I update now to master. I got the same error. |
@Cimex97 that failing |
I traced it with the logic analyzer and realized that the ESP32 does not answer. After I enable the hw-flow-control and set the CTS/RTS pins in the device tree it just works. Many thanks for your support.
Note: I have to disable BT_HCI_ACL_FLOW_CONTROL. Maybe the ESP32 does not support that. |
@Cimex97 Thanks for this news! Let me know if I can close the issue. |
@Cimex97 I think flow control is supported by ESP32. However there are (at least) 2 issues that prevent it from working:
With these 2 solved we probably could get the flow control working but I still have no idea what's wrong with case 2. |
btattach with ESP32 in HCI mode always works fine for me. Zephyr's HCI driver also works with HCI mode ESP32, but ACL flow control is currently broken. |
Thanks for confirming. Zephyr's HCI driver over UART or USB? We are trying to make it work over UART, but it seems communication stucks at one end: BlueZ is trying to initiate the connection, but Zephyr's driver doesn't passes it correctly to HAL, therefore no response arrives back from HAL. (assumption) |
UART and USB should work. Which firmware do you flashed onto the ESP32? |
I have disabled, yes, but it doesn't work, hci0 is not coming up. |
Do you check are the RX, TX, CTS, RTS pins are connected correctly? |
Yes, of course. Also tried esp-idf's sample called "controller_hci_uart" and it works almost perfectly (only massive stresstest of So wiring is surely OK. Unfortunately USB is not an option, as I don't have a free USB on the host :/ |
I had some trouble using the ESP32 as a controller without connected to USB. The ESP32 restarted permanently. I think this caused due to bad power supply. So can you try it to be sure that isn't the error? |
I'm not sure, but you can't use Zephyr as your Bluetooth controller firmware because of that the ESP32 isn't fully supported by Zephyr |
UART. OG ESP32 doesn't even have USB hardware. |
@Cimex97: I'm kind of lost now :)
then:
So now which one is true? :) |
Sorry for the mistake. |
Ah, I see. Thank you. ESP's implementation has a bug which bothers me, so I'm gonna search further. |
Can it (by now)? I'm sorta lost about whether I can use an ESP32 on linux using basic HCI or not by today. |
You don't need zephyr, you can just use esp's hci_uart_sample (or similar,
its in their repo). I could fine-tune it and proved to work for quite a
long time already.
…On Sun, 11 Dec 2022, 06:58 Mirko Vogt, ***@***.***> wrote:
Ah, I see. Thank you. ESP's implementation has a bug which bothers me, so
I'm gonna search further. I thought Zephyr can also work as a HCI
controller firmware :)
Can it (by now)? I'm sorta lost about whether I can use an ESP32 on linux
using basic HCI or not by today.
—
Reply to this email directly, view it on GitHub
<#28872 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACZKPOHFHM24DWFEONPSRDDWMU7OJANCNFSM4SBYB6SA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Interesting, thanks! Didn't realise they implemented the HCI stack complete enough to be usable with blueZ. |
I don't know, I'm using it with full featured UART to SPI chips, as HCI
needs proper CTS, RTS, and of course RX and TX and GND.
…On Sun, 11 Dec 2022, 14:53 Mirko Vogt, ***@***.***> wrote:
You don't need zephyr, you can just use esp's hci_uart_sample (or similar,
its in their repo). I could fine-tune it and proved to work for quite a
long time already.
Interesting, thanks! Didn't realise they implemented the HCI stack
complete enough to be usable with blueZ.
Does it work with a normal cheap node-mcu pcd and their CH9102X UART<->USB
bridges? Asking, because I read that RTS/CTS is a necessity for attaching
it as UART driven BLE-HCI peripheral.
—
Reply to this email directly, view it on GitHub
<#28872 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACZKPOF5Z4KRY3TFAMYKQ4DWMWXCJANCNFSM4SBYB6SA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Describe the bug
I want to build the samples/bluetooth/peripheral_hr as a host only with an extern esp32 as a controller.
For this I use the nucleo_f411re board.
To Reproduce
I add hw-flow-control to the dts, the PINMUX functions for RTS/CTS pins of the UART_1 and set the configuration BT_UART_ON_DEV_NAME="UART_1".
Steps to reproduce the behavior:
Expected behavior
I expected that I can use Bluetooth specific APIs in my application if I connect an external Bluetooth controller, like the esp32.
Impact
I can't implement my application, because I want to use Zephyr, instead of the esp-idf for the hardware independent.
Logs and console output
Here is logic analyzer trace:
I see that there is a communication, but I don't know why the RTS/CTS pins don't change the state.
Environment (please complete the following information):
Additional context
On the ESP32 run this sample which make a uart_hci interface available. This works fine with a raspberry pi 2b+.
I used here the BlueZ and attach the device via:
btattach -B /dev/ttyAMA0 -P h4 -S 115200
The text was updated successfully, but these errors were encountered: