hello,
i made my esp32s3 as a proxy between my mouse and my computer and notice significant lag/stuttering when moving it. i combined the two examples esp_hid_device and esp_hid_host from esp-idf. it works like this: the esp32s3 first connects to the computer then the mouse connects to the esp32s3 and finally when the esp32s3 recieves an input event, it sends it to the computer directly. it works with bluedroid.
the issue is that there is much more lag/stuttering when moving the mouse proxied with my solution than when the mouse is connected directly to the computer and i'd like to fix this issue. i know the esp32 is very powerful and a project like mine shouldn't impact the inputs that much, as i basically just want to stream the inputs.
i've read a bit about MTU and i think reducing the size of the packets can stop the lag, but it cannot be configured in menuconfig with bluedroid, and switching to NimBLE is not possible, or would be a real hassle, also i think bluedroid can be made fast enough for input streaming. problem is i have no clue how to do it.
any thoughts?
esp32s3 BLE proxy performance
-
- Posts: 168
- Joined: Sun May 22, 2022 2:42 pm
Re: esp32s3 BLE proxy performance
BLE performance is a complex story and very hard to optimize, given there are so many layers and systems involved.
What may help you is to a) enable the BLE 5 + LE 2M PHY support in `sdkconfig` and b) make sure you update the connection parameters (in particular the connection interval and the latency values) after the GAP connection has been established.
What may help you is to a) enable the BLE 5 + LE 2M PHY support in `sdkconfig` and b) make sure you update the connection parameters (in particular the connection interval and the latency values) after the GAP connection has been established.
Re: esp32s3 BLE proxy performance
hello,
thanks for your reply, i'm still new to the field and i still don't understand a few things:
a. i turned on the ble5 in the config but i don't see any macro to enable LE 2M PHY support. however as soon as i turn off ble4.2 features (in menuconfig) the program won't compile.
b. it seem to be a few different apis to control the gap latency and interval values which looks the same. which one is the right one? from the docs:
- esp_ble_gap_set_prefer_conn_params(): before connexion, master role only
- esp_ble_gap_update_conn_params(): update connexion parameters when connexion is up
- esp_ble_gap_prefer_ext_connect_params_set(): set aux parameters
i'll try them all in the meantime.
thanks for your reply, i'm still new to the field and i still don't understand a few things:
a. i turned on the ble5 in the config but i don't see any macro to enable LE 2M PHY support. however as soon as i turn off ble4.2 features (in menuconfig) the program won't compile.
b. it seem to be a few different apis to control the gap latency and interval values which looks the same. which one is the right one? from the docs:
- esp_ble_gap_set_prefer_conn_params(): before connexion, master role only
- esp_ble_gap_update_conn_params(): update connexion parameters when connexion is up
- esp_ble_gap_prefer_ext_connect_params_set(): set aux parameters
i'll try them all in the meantime.
Re: esp32s3 BLE proxy performance
hello,
i just tried with esp_ble_gap_update_conn_params() but unfortunately, no matter what settings i enter, the function doesnt change the parameters, and the stuttering won't go away:
code:
getting output with esp_ble_get_current_conn_params() (doesn't change):
it seems like i can't use esp_ble_gap_set_prefer_conn_params() either since the mouse connects everytime with a new address.
i just tried with esp_ble_gap_update_conn_params() but unfortunately, no matter what settings i enter, the function doesnt change the parameters, and the stuttering won't go away:
code:
Code: Select all
esp_ble_conn_update_params_t conn_params = {0};
memcpy(conn_params.bda, mouse.address, 6);
conn_params.min_int = 0x06;
conn_params.max_int = 0x06;
conn_params.latency = 0x00;
conn_params.timeout = 0xA0;
ESP_ERROR_CHECK(esp_ble_gap_update_conn_params(&conn_params));
Code: Select all
W (140367) proxy: conn_params: interval=18, latency=0, timeout=600
Who is online
Users browsing this forum: No registered users and 78 guests