BLE Active Exception problem

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
User avatar
Walkline
Posts: 14
Joined: Wed Feb 19, 2020 4:44 pm

BLE Active Exception problem

Post by Walkline » Sat Feb 29, 2020 5:51 pm

I have been reinstalled Windows 10 (build 1909), and installed the lastest version of VS Code with RT-Thread plugin, I'm facing a new issue, when I paste the code to repl it will cause exception

Code: Select all

paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== import ubluetooth as bt
=== ble=bt.BLE()
=== ble.active(True)
Exception in thread REPL_serial_to_stdout:
Traceback (most recent call last):
  File "threading.py", line 926, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "cli.py", line 479, in repl_serial_to_stdout
  File "site-packages\serial\serialutil.py", line 590, in inWaiting
  File "site-packages\serial\serialwin32.py", line 257, in in_waiting
serial.serialutil.SerialException: ClearCommError failed (PermissionError(13, 'Access Denied 
。', None, 5))
It looks like serial problem, is there any one got this issue?

User avatar
Walkline
Posts: 14
Joined: Wed Feb 19, 2020 4:44 pm

Re: BLE Active Exception problem

Post by Walkline » Sun Mar 01, 2020 8:46 am

Update exception information...

Code: Select all

>>> import ubluetooth as bt
>>> ble=bt.BLE()
>>> ble.active(True)
I (24440) BTDM_INIT: BT controller compile version        [5aed448]
I (49208) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
W (49218) phy_init: failed to load RF calibration data (0x1102), falling back to full calibration
Exception in thread REPL_serial_to_stdout:
Traceback (most recent call last):
  File "threading.py", line 926, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "cli.py", line 479, in repl_serial_to_stdout
  File "site-packages\serial\serialutil.py", line 590, in inWaiting
  File "site-packages\serial\serialwin32.py", line 257, in in_waiting
serial.serialutil.SerialException: ClearCommError failed (PermissionError(13, 'Access Denied', None, 5))

fstengel
Posts: 55
Joined: Tue Apr 17, 2018 4:37 pm

Re: BLE Active Exception problem

Post by fstengel » Sun Mar 01, 2020 9:21 am

As far as I can tell, the exception is not thrown by MicroPython, but by the part that is used by VS and its plugin to communicate with your ESP32.

One possible reason for your issue is your chip resetting because of a brownout due to the RF part of the chip being activated. I had that problem with an USB powered ESP32 and it was solved by:
  • Having less components drawing current from your chip (LEDs, NeoPixels etc.), or powering them externally.
  • Changing the cable (I used a much shorter one).
  • Using a USB port capable of reliably providing more than 500mA at 5V. Using a powered hub helped a lot.

User avatar
Walkline
Posts: 14
Joined: Wed Feb 19, 2020 4:44 pm

Re: BLE Active Exception problem

Post by Walkline » Sun Mar 01, 2020 9:29 am

fstengel wrote:
Sun Mar 01, 2020 9:21 am
[*] Using a USB port capable of reliably providing more than 500mA at 5V. Using a powered hub helped a lot.[/list]
As you said....I try to unplug the cable from a usb hub and replug to notebook usb port, and then problem solved, that's sooooo funny~ :lol: :lol: :lol:

Thanks a lot, fstengel

Post Reply