wifi and ble not reliable on esp32-c3 port

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
puppet13th
Posts: 9
Joined: Tue May 03, 2022 9:56 am

wifi and ble not reliable on esp32-c3 port

Post by puppet13th » Tue Jul 12, 2022 7:46 am

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?

tepalia02
Posts: 99
Joined: Mon Mar 21, 2022 5:13 am

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

Post by tepalia02 » Tue Jul 12, 2022 10:52 am

Sounds abnormal. What about the other features of the board? Can you upload codes to it?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

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

Post by jimmo » 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

puppet13th
Posts: 9
Joined: Tue May 03, 2022 9:56 am

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

Post by puppet13th » Wed Jul 13, 2022 3:20 am

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.
Attachments
ble_bench2.zip
(1.67 KiB) Downloaded 362 times

puppet13th
Posts: 9
Joined: Tue May 03, 2022 9:56 am

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

Post by puppet13th » Wed Jul 13, 2022 4:04 am

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.

puppet13th
Posts: 9
Joined: Tue May 03, 2022 9:56 am

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

Post by puppet13th » Fri Jul 15, 2022 9:24 am

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'
Attachments
ble_bench4.zip
code and output example
(2.59 KiB) Downloaded 351 times

MATTYGILO
Posts: 12
Joined: Tue Apr 05, 2022 3:03 pm

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

Post by MATTYGILO » Tue Sep 05, 2023 1:24 pm

Have you found a solution to this problem I am having the same issue

Post Reply