Page 1 of 1

wifi and ble not reliable on esp32-c3 port

Posted: Tue Jul 12, 2022 7:46 am
by puppet13th
i have tried using firmware version 1.18 and the latest version 1.19.1 on esp32-c3 port(currently i have ai-thinker and liligo ttgo-oi-plus). in my experience wifi and ble function not reliable.when using ble ,sometime it won't function after connect and disconnect cycle.when using utfpd on wifi connection,it can only can transfer 1kb of data and then not responding.the program i have written works flawlessly on esp32 port(tested on lolin32 lite and mh-et live board). any advice on these case?

Re: wifi and ble not reliable on esp32-c3 port

Posted: Tue Jul 12, 2022 10:52 am
by tepalia02
Sounds abnormal. What about the other features of the board? Can you upload codes to it?

Re: wifi and ble not reliable on esp32-c3 port

Posted: Tue Jul 12, 2022 11:44 am
by jimmo
puppet13th wrote:
Tue Jul 12, 2022 7:46 am
in my experience wifi and ble function not reliable.when using ble ,sometime it won't function after connect and disconnect cycle.when using utfpd on wifi connection,it can only can transfer 1kb of data and then not responding.the program i have written works flawlessly on esp32 port(tested on lolin32 lite and mh-et live board). any advice on these case?
The BLE support on ESP32C* and ESP32S* is somewhat experimental at the moment. I have recently acquired some C3 and S3 boards and will try to do some testing.

See also https://github.com/micropython/micropyt ... 1154564382

Re: wifi and ble not reliable on esp32-c3 port

Posted: Wed Jul 13, 2022 3:20 am
by puppet13th
tepalia02 wrote:
Tue Jul 12, 2022 10:52 am
Sounds abnormal. What about the other features of the board? Can you upload codes to it?
please check attached file.
error output when running the code:

Code: Select all

connection time : 1122
min: 413 mean: 1223 max: 2424 connect delay: 3000
ct: 20 cd: 19 cf: 1

connection time : 1142
min: 413 mean: 1219 max: 2424 connect delay: 3000
Traceback (most recent call last):
  File "<stdin>", line 177, in <module>
  File "uasyncio/core.py", line 1, in run
  File "uasyncio/core.py", line 1, in run_until_complete
  File "uasyncio/core.py", line 1, in run_until_complete
  File "<stdin>", line 168, in main_loop
  File "<stdin>", line 102, in disconnect_all_devices
  File "<stdin>", line 95, in disconnect
OSError: -128
>>> %Run -c $EDITOR_CONTENT
ct: 1 cd: 0 cf: 1

ct: 2 cd: 0 cf: 2

ct: 3 cd: 0 cf: 3
when restarting the code,ble does not functioning at all(esp32-c3 port).need to hard reset the board to have it running again.
the code run flawlessly on esp32 though.

Re: wifi and ble not reliable on esp32-c3 port

Posted: Wed Jul 13, 2022 4:04 am
by puppet13th
jimmo wrote:
Tue Jul 12, 2022 11:44 am
puppet13th wrote:
Tue Jul 12, 2022 7:46 am
in my experience wifi and ble function not reliable.when using ble ,sometime it won't function after connect and disconnect cycle.when using utfpd on wifi connection,it can only can transfer 1kb of data and then not responding.the program i have written works flawlessly on esp32 port(tested on lolin32 lite and mh-et live board). any advice on these case?
The BLE support on ESP32C* and ESP32S* is somewhat experimental at the moment. I have recently acquired some C3 and S3 boards and will try to do some testing.

See also https://github.com/micropython/micropyt ... 1154564382
there is no issues when running the code on esp32 port.
aioble looks interesting,i will try i later. please test my code on your C3 board.

Re: wifi and ble not reliable on esp32-c3 port

Posted: Fri Jul 15, 2022 9:24 am
by puppet13th
updated test code to better describe the problem i mentioned about ble.
as for uftpd module and wifi,look like there is some error/glitch on uftpd module side.

output from esp32 port before i stopped the execution(no issue):

Code: Select all

- - - = = = 805 = = = - - -
b'f3f06b581563' connected! [(0, b'f3f06b581563', 1)]
min: 24 mean: 1395 max: 15974 current: 3924
b'f3f06b581563' disconnected!
try: 805 connected: 805 failed: 0 missmatch: 0
output from esp32-c3 port:

Code: Select all

- - - = = = 675 = = = - - -
b'f3f06b581563' connected! [(0, b'f3f06b581563', 1)]
min: 16 mean: 900 max: 5162 current: 467
try: 675 connected: 675 failed: 0 missmatch: 0
b'f3f06b581563' connected! [(0, b'f3f06b581563', 1), (0, b'f3f06b581563', 1)]
ble crashed!!!
try: 675 connected: 676 failed: 0 missmatch: 0
now this is weird part,from above output we can see that there is two 'b'f3f06b581563' connected!' and it should not happen.this event occurred randomly(please check attached file) and does not occurr in esp32 port.
maybe there is some glitch on ble_irq when combined with uasyncio.

please edit this part accordingly to your setup:

Code: Select all

from machine import Pin
led_pin = 3
led = Pin(led_pin,Pin.OUT,value=0)

ble_addr_type = 1
ble_mac_addr = b'f3f06b581563'

Re: wifi and ble not reliable on esp32-c3 port

Posted: Tue Sep 05, 2023 1:24 pm
by MATTYGILO
Have you found a solution to this problem I am having the same issue