I am currently trying to upload a sketch/program to my esp01, from my mac, but are having issue with its port being busy?
Not sure why?
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 16] could not open port /dev/cu.usbserial-1420: [Errno 16] Resource busy: '/dev/cu.usbserial-1420'
I tried to locate the application that makes it busy, but i seem to be unable to locate it it.
I’ve seen cases where two drivers are installed for the USB-to-serial chip (probably a CH340 in your case). The device then appears under two names: one is working, the other one isn’t.
Either the serial is also non-functioning and the other should be used (with some additional fix?) or there is a problem with the physical connection to the ESP01.
Have you made sure it’s in bootloader mode (GPIO0 to GND and reset)? How did you connect everything with respect to power, UART and reset?
You can sanity check the UART connection by using a terminal program to open the serial at 74880 baud and reset the ESP01 in bootloader mode. Then, some text shoud appear.
So you have two drivers installed for the WCH CH340 chip. I recommend uninstalling the one from WCH (old kernel mode driver) in favour of the one from Apple (new user mode driver):
If you are running macOS Catalina, your Mac has probably already complained about this driver on each restart. As far as I know, they no longer work in the upcoming macOS Big Sur.
As for the timeout: It usually helps to reduce the upload speed:
upload_speed = 460800
Or:
upload_speed = 230400
If it doesn’t help, check the wires. Do you use a dedicated USB-to-Serial adapter? If so, TX and RX could be swapped (or rather not). The correct setup is to connect adapter RX to ESP TX, and adapter TX to ESP RX.