Using ESP32-WROOM/WROVER with RPi

danergo
Posts: 19
Joined: Fri Aug 06, 2021 2:50 pm

Using ESP32-WROOM/WROVER with RPi

Postby danergo » Fri Aug 06, 2021 3:05 pm

Guys,

I'm using currently RPi4's integrated BT module (by Cypress) to communicate with other BT devices via Classic and also BLE connections.

However I'm thinking on moving towards ESP32, and I'd like you to confirm my assumptions if ESP32 is able to do my goals.

Basically I'm using "hcitool", "l2ping" and "gatttool" with my current setup.

Can I do the same with ESP32? How can I attach ESP32 to RPi? Only via USB? Or also via UART? (Keeping in mind that ESP32 needs to provide the above requirements)

Basically I need to do (in C):

Code: Select all

socket(PF_BLUETOOTH, SOCK_RAW | SOCK_NONBLOCK, BTPROTO_L2CAP);
and

Code: Select all

socket(PF_BLUETOOTH, SOCK_SEQPACKET | SOCK_NONBLOCK, BTPROTO_L2CAP);
Please confirm that (how) I can use the above system calls with ESP32. I mean how shall I attach it to RPi, and what software shall I load into ESP32 to reach those functionalities?

Thank you.

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Using ESP32-WROOM/WROVER with RPi

Postby ESP_igrr » Sun Aug 08, 2021 6:14 am

Hi danergo,

You can get esp32 to expose HCI interface over UART using this example code: https://github.com/espressif/esp-idf/tr ... r_hci_uart. On the host you will need to use hciattach command to let bluez stack work with the UART. Note that hardware flow control is required.

In case you are considering to add Wi-Fi connection to your project later, you may consider https://github.com/espressif/esp-hosted which provides Wi-Fi connection in addition to Bluetooth. If you have any problem with this project, please open an issue in the issues section on Github.

danergo
Posts: 19
Joined: Fri Aug 06, 2021 2:50 pm

Re: Using ESP32-WROOM/WROVER with RPi

Postby danergo » Sun Oct 17, 2021 7:31 am

Thank you.

I hope you could help me with my issues. ESP32 is not able to connect to random addressed BLE devices with the espidf provided hci controller sample you recommended:

https://www.esp32.com/viewtopic.php?f=13&t=23766

Also, regularly l2ping fails for a specific device. (In spite of that device is nearby).
Recovery is to do "hciconfig hci0 down;hciconfig hci0 up". After this, it works again.

Overall it feels unstable :(

I would be happy if you could take a look at my issues. You might have some ideas to try.

Thank you

danergo
Posts: 19
Joined: Fri Aug 06, 2021 2:50 pm

Re: Using ESP32-WROOM/WROVER with RPi

Postby danergo » Sun Oct 17, 2021 8:36 am

ESP_igrr wrote:
Sun Aug 08, 2021 6:14 am
Hi danergo,

You can get esp32 to expose HCI interface over UART using this example code: https://github.com/espressif/esp-idf/tr ... r_hci_uart. On the host you will need to use hciattach command to let bluez stack work with the UART. Note that hardware flow control is required.

In case you are considering to add Wi-Fi connection to your project later, you may consider https://github.com/espressif/esp-hosted which provides Wi-Fi connection in addition to Bluetooth. If you have any problem with this project, please open an issue in the issues section on Github.
Hi!
I'm quoting you to make sure you're getting notified, if you could look at my issues mentioned above it would be very nice.

Thank you,
Have a great day.

danergo
Posts: 19
Joined: Fri Aug 06, 2021 2:50 pm

Re: Using ESP32-WROOM/WROVER with RPi

Postby danergo » Tue Oct 19, 2021 6:10 am

@ESP_igrr:

Please help me with this topic. This is blocking my development efforts now, and I'm already started considering on moving over from ESP32 if we can't solve this.

This was exactly my reason of asking before utilizing ESP32, to not have these kind of problems. And now it seems I can't get any replies anywhere from literally anyone.

Thank you!
D.

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Using ESP32-WROOM/WROVER with RPi

Postby ESP_igrr » Mon Dec 06, 2021 10:53 pm

Hi danergo,

I'm sorry I didn't reply earlier, indeed the notification for your reply didn't work for some reason.

For bugs in examples provided in ESP-IDF, could you please open an issue at https://github.com/espressif/esp-idf/issues? This way it's easiest to get it assigned to the right person.
Thank you.

danergo
Posts: 19
Joined: Fri Aug 06, 2021 2:50 pm

Re: Using ESP32-WROOM/WROVER with RPi

Postby danergo » Tue Dec 07, 2021 6:26 am

Yes, thank you, already did it :)

Who is online

Users browsing this forum: No registered users and 71 guests