ESP tool - programming flash MAC OS Catalina

vsubbiah
Posts: 1
Joined: Mon Feb 17, 2020 8:07 pm

ESP tool - programming flash MAC OS Catalina

Postby vsubbiah » Mon Feb 17, 2020 8:08 pm

I am using the ESP32 WROVER KIT 4.1 and I am trying to program to flash using Mac OS Catalina 10.15.1 and I am running into the error below. Looking around looks like with Catalina there are some issues to access serial port. Could somebody please confirm if the esptool work with Mac OS Catalina

VENKATs-MBP: ~/work/pp/esp/esp_ws2/esp-idf/examples/wifi/scan : idf.py -p /dev/tty.usbserial-142100 monitor
Executing action: monitor
Running idf_monitor in directory /Users/venkat/work/pp/esp/esp_ws2/esp-idf/examples/wifi/scan
Executing "/Users/venkat/.espressif/python_env/idf4.2_py2.7_env/bin/python /Users/venkat/work/pp/esp/esp_ws2/esp-idf/tools/idf_monitor.py -p /dev/tty.usbserial-142100 -b 115200 --toolchain-prefix xtensa-esp32-elf- /Users/venkat/work/pp/esp/esp_ws2/esp-idf/examples/wifi/scan/build/scan.elf -m '/Users/venkat/.espressif/python_env/idf4.2_py2.7_env/bin/python' '/Users/venkat/work/pp/esp/esp_ws2/esp-idf/tools/idf.py' '-p' '/dev/tty.usbserial-142100'"...
--- WARNING: Serial ports accessed as /dev/tty.* will hang gdb if launched.
--- Using /dev/cu.usbserial-142100 instead...
--- idf_monitor on /dev/cu.usbserial-142100 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
Exception in thread Thread-2:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/Users/venkat/work/pp/esp/esp_ws2/esp-idf/tools/idf_monitor.py", line 149, in _run_outer
self.run()
File "/Users/venkat/work/pp/esp/esp_ws2/esp-idf/tools/idf_monitor.py", line 356, in run
self.serial.open()
File "/Users/venkat/.espressif/python_env/idf4.2_py2.7_env/lib/python2.7/site-packages/serial/serialposix.py", line 268, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
SerialException: [Errno 16] could not open port /dev/cu.usbserial-142100: [Errno 16] Resource busy: '/dev/cu.usbserial-142100'

silikone
Posts: 1
Joined: Sun May 17, 2020 8:27 am

Re: ESP tool - programming flash MAC OS Catalina

Postby silikone » Sun May 17, 2020 8:29 am

Hi,

Did this get solved. I just tried the ESP32 environment for the first time, and have exactly the same problem.

/S

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: ESP tool - programming flash MAC OS Catalina

Postby ESP_Angus » Mon May 18, 2020 12:33 am

Hi vsubbhiah and silikone,

esptool is supported on MacOS Catalina. However, there are apparently issues with some USB to serial chip drivers on Catalina (the "Resource busy" error in this case is being returned to esptool by the OS when it tries to open the serial port.)

In the case of ESP-WROVER-KIT board, the USB to Serial interface chip is made by FTDI so the solution is likely related to the FTDI drivers.

If you don't have the latest version of the FTDI driver for MacOS then suggest updating:
https://www.ftdichip.com/Drivers/VCP.htm

If this isn't enough to solve then I'm afraid I don't know the exact answer, but here are some posts showing similar issues and some possible solutions:
https://www.revk.uk/2019/12/ftdi-usb-se ... ource.html
https://arduino.stackexchange.com/a/72400


Angus

bonastreyair
Posts: 2
Joined: Thu Jul 16, 2020 9:17 pm

Re: ESP tool - programming flash MAC OS Catalina

Postby bonastreyair » Thu Jul 16, 2020 10:08 pm

Starting from Mac OSX Catalina 10.15.5 and even reinstalling https://www.silabs.com/products/develop ... cp-drivers, USB appears to be busy all the time...

Did anybody find any solution?

The wierd thing is that I can flash and monitor the ESP32 using Arduino IDE but not using esptool... (so it is not cable/esp32 chip)

This may be an Apple issue or a VCP Driver issue, I know that esptool receives the OS error but I needed to ask for help and show it still happens even with the last Mac OSX Catalina 10.15.6 update recently released...

Here the error logs:

Code: Select all

idf.py flash
Executing action: flash
Choosing default port /dev/cu.usbserial-1440 (use '-p PORT' option to set a specific serial port)
Running ninja in directory /Users/bonastreyair/******/build
Executing "ninja flash"...
[1/5] cd /Users/bonastreyair/******/build/esp-idf/partition_table && ...ke -E echo "*******************************************************************************"
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
phy_init,data,phy,0xf000,4K,
ota_0,app,ota_0,0x10000,1920K,
ota_1,app,ota_1,0x1f0000,1920K,
coredump,data,coredump,0x3d0000,64K,
reserved,data,254,0x3e0000,128K,
*******************************************************************************
[2/5] Performing build step for 'bootloader'
ninja: no work to do.
[2/3] cd /Users/bonastreyair/esp/esp-mdf/esp-idf/components/esptool_py && /usr/local/Cellar/...re/build" -P /Users/bonastreyair/esp/esp-mdf/esp-idf/components/esptool_py/run_esptool.cmake
esptool.py --chip esp32 -p /dev/cu.usbserial-1440 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x8000 partition_table/partition-table.bin 0xd000 ota_data_initial.bin 0x1000 bootloader/bootloader.bin 0x10000 main.bin
esptool.py v3.0-dev
Serial port /dev/cu.usbserial-1440
Traceback (most recent call last):
  File "/Users/bonastreyair/esp/esp-mdf/esp-idf/components/esptool_py/esptool/esptool.py", line 3430, in <module>
    _main()
  File "/Users/bonastreyair/esp/esp-mdf/esp-idf/components/esptool_py/esptool/esptool.py", line 3423, in _main
    main()
  File "/Users/bonastreyair/esp/esp-mdf/esp-idf/components/esptool_py/esptool/esptool.py", line 3087, in main
    esp = chip_class(each_port, initial_baud, args.trace)
  File "/Users/bonastreyair/esp/esp-mdf/esp-idf/components/esptool_py/esptool/esptool.py", line 261, in __init__
    self._port = serial.serial_for_url(port)
  File "/Users/bonastreyair/.espressif/python_env/idf4.2_py2.7_env/lib/python2.7/site-packages/serial/__init__.py", line 88, in serial_for_url
    instance.open()
  File "/Users/bonastreyair/.espressif/python_env/idf4.2_py2.7_env/lib/python2.7/site-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 16] could not open port /dev/cu.usbserial-1440: [Errno 16] Resource busy: '/dev/cu.usbserial-1440'
CMake Error at run_cmd.cmake:14 (message):
  esptool.py failed
Call Stack (most recent call first):
  run_esptool.cmake:21 (include)
  
FAILED: CMakeFiles/flash 
cd /Users/bonastreyair/esp/esp-mdf/esp-idf/components/esptool_py && /usr/local/Cellar/cmake/3.17.3/bin/cmake -D IDF_PATH="/Users/bonastreyair/esp/esp-mdf/esp-idf" -D ESPTOOLPY="/Users/bonastreyair/.espressif/python_env/idf4.2_py2.7_env/bin/python /Users/bonastreyair/esp/esp-mdf/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32" -D ESPTOOL_ARGS="--before=default_reset --after=hard_reset write_flash @flash_args" -D WORKING_DIRECTORY="/Users/bonastreyair/******/build" -P /Users/bonastreyair/esp/esp-mdf/esp-idf/components/esptool_py/run_esptool.cmake
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
Just to mention that if I run:

Code: Select all

sudo lsof | grep /dev/cu.usbserial*
...it does not appear any program using the port.

I hope there is a quick solution since it is criticaI for me to be able to program/debug code for the esp32 in my laptop for my work.

fdfdkz
Posts: 1
Joined: Sat Aug 01, 2020 10:17 am

Re: ESP tool - programming flash MAC OS Catalina

Postby fdfdkz » Sat Aug 01, 2020 10:39 am

macOS Catalina 10.15.5

For FTDI:
  • Download and install FTDIUSBSerialDriver_v2_4_4.dmg from http://www.ftdicommunity.com/index.php?topic=505.0 (download link doesn't work with safari, but works with firefox). It still needed to be enabled in System Preferences -> Security and Privacy.
For SiLabs CP120x: (I don't know what steps are actually necessary. These just worked for me) random debugging tips:

About This Mac -> System Report -> Software -> Extensions : FTDIUSBSerialDriver (shows if the driver is loaded or not)
sudo kextutil /Library/Extensions/FTDIUSBSerialDriver.kext
codesign --verify /Library/Extensions/FTDIUSBSerialDriver.kext
sudo lsof | grep /dev/cu.usbserial* (is the port in use by some other program?)

Who is online

Users browsing this forum: No registered users and 345 guests