PlatformIO Community

Resource busy: '/dev/cu.usbserial-210292AD33E90'

I got a question, which said, “could not open port ‘/dev/cu.usbserial-210292AD33E90’: [Errno 16] could not open port /dev/cu.usbserial-210292AD33E90: [Errno 16] Resource busy: '/dev/cu.usbserial-210292AD33E90”
The detail is as follows:
image
I tried changing to another USB port but it didn’t work.
SW and HW: Mac OS Big Sur, VSCode, Nexys A7 FPGA
Any answer will be appreciated!

Usually that’s an indication of another serial monitor being opened somewhere. Try and abort that instance (Ctrl+C). Otherwis you can try to re-plugin the USB serial adapter to free it up.

I did not use another serial monitor and I also tried re-plugining the USB serial adapter, but it still don’t work.
Is there another solution? emmm

Which USB-serial converter is on the adapter? CH340? Maybe it’s a driver issue. Are the are any other “usbserial” devices in /dev/?

Execute the lsof command:

user@MacBook project % lsof /dev/cu. usbserial-210292AD33E90 
COMMAND   PID           USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
Application  15820 user   10u   CHR   22,7      0t2 4989 /dev/cu.usbserial-210292AD33E90

Whatever is shown in place of Application is the process that has the serial connection open. If nothing is shown, then it could be a driver problem indeed. Did you install any drivers?

I executed the command you suggested, and there is nothing shown indeed. So, what driver should I install in this case? :slightly_smiling_face:

I just discovered that my command contained an incorrect space (after /dev/cu.). Did you run the command with the correct device name?

Can you also run the command ls -l /dev/cu.* and show the output?

When it comes to drivers, the most likely problem is that you have two drivers installed for the same device. As far as I can tell, your development board has an FTDI chip for the serial communication. macOS provides the required FTDI chip out of the box. So if you have installed an additional driver, you should uninstall it. If the additional driver is needed for JTAG debugging, then the possible workarounds are to either deactivate the Apple driver for FTDI or - if possible - use the other serial device in /dev for serial communication. Your output will tell more.

Yeah, I ran the command with the correct device name.
Here is the output:
image
So, where is the problem? emmm

This looks fine. The bottom two devices are likely the two serial ports of the FTDI chip.

Have you tried to use /dev/cu.usbserial-21029AD33E91 instead? The first port might be blocked by JTAG.

Are you able to upload firmware to your board? If so, what tool are you using?

You can also run systemextensionsctl list to check for old kernel-mode system extension (as opposed to the newer user-mode extensions).

I used /dev/cu.usbserial-21029AD33E91 as you suggested:
image
BUT it still didn’t work with the same error info as mentioned above.

What kind of firmware should I upload?

I executed systemextensionsctl list, but it showed 0 extension(s).

I guess your are developing some software and want to upload it to your board. You haven’t specified your setup so far. But it seems you have an FPGA implementing a RISC-V core. And are probably writing RISC-V code and want to or have uploaded it to your board. That’s the firmware I’m referring to. Was that successful?

In the original error message, the “Resource busy” error is shown related to the monitor command, i.e. PlatformIO opening the serial port for displaying text output. In the above excerpt from platformio.ini however you have specified the upload_port, which is for uploading software/firmware. I’m not familiar with the upload methods in this FPGA / RISC-V setup. This setting might not even have any effect.

  • Is it correct that you are able to upload your software?
  • Is it correct that you are stuck with displaying the text output from your software?

If so, try the below setting:

monitor_port = /dev/cu.usbserial-210292AD33E90

And please stop pasting images of files and output and instead paste real text. This is important so Google can properly index these discussions and other people can find it if they run into the same problem.

HI! I tried this command: monitor_port = /dev/cu.usbserial-210292AD33E90, but it also showed resource busy with the same error info.
Yes. The software can be uploaded to the board.
Yes. I’m stuck with displaying the text output from the software.
Okay, I won’t paste images.
Is there another approach? :sweat_smile:

Sorry, I of course meant (difference is last digit):

monitor_port = /dev/cu.usbserial-210292AD33E91

The idea is to check the second port on your board.

The board seems to have an FTDI chip with multiple serial ports. Isn’t there any documentation what port should be used?

1 Like

Hi! This command: monitor_port = /dev/cu.usbserial-210292AD33E91 was added to my platformIO.ini configuration file, and it really worked!
Thanks a lot!
Cheers~

I have a similar problem. When I try to build and upload, I get:

Looking for upload port…
Auto-detected: /dev/cu.usbserial-0232CD6C
Uploading .pio/build/esp32doit-devkit-v1/firmware.bin
esptool.py v3.1
Serial port /dev/cu.usbserial-0232CD6C
Traceback (most recent call last):
File “~/.platformio/penv/lib/python3.7/site-packages/serial/serialposix.py”, line 322, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
OSError: [Errno 16] Resource busy: ‘/dev/cu.usbserial-0232CD6C’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “~/.platformio/packages/tool-esptoolpy/esptool.py”, line 4582, in
_main()
File “~/.platformio/packages/tool-esptoolpy/esptool.py”, line 4575, in _main
main()
File “~/.platformio/packages/tool-esptoolpy/esptool.py”, line 4076, in main
before=args.before)
File “~/.platformio/packages/tool-esptoolpy/esptool.py”, line 120, in get_default_connected_device
_esp = chip_class(each_port, initial_baud, trace)
File “~/.platformio/packages/tool-esptoolpy/esptool.py”, line 313, in init
self._port = serial.serial_for_url(port)
File “~/.platformio/penv/lib/python3.7/site-packages/serial/init.py”, line 90, in serial_for_url
instance.open()
File “~/.platformio/penv/lib/python3.7/site-packages/serial/serialposix.py”, line 325, 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-0232CD6C: [Errno 16] Resource busy: ‘/dev/cu.usbserial-0232CD6C’
*** [upload] Error 1

The correct serial port, I believe, is /dev/cu.SLAB_USBtoUART. I have modified my platformio.ini file to be:

[env:esp wrover kit]
platform = espressif32
framework = arduino
board = esp-wrover-kit
monitor_speed = 115200
build_flags =
	; https://docs.espressif.com/projects/esp-idf/en/latest/get-started/get-started-wrover-kit.html#rgb-led
	-D LED_BUILTIN=2
monitor_port = /dev/cu.SLAB_USBtoUART

[env:esp32doit-devkit-v1]
platform = espressif32
framework = arduino
board = esp32doit-devkit-v1
monitor_speed = 115200
monitor_port = /dev/cu.SLAB_USBtoUART

Yet those ports seem to be ignored. Maybe it is because that is the monitor port and not the upload port. How do I force the upload port?

Those ports I’m using are the ones that Arduino IDE uses to upload. (No, the Arduino IDE is not running at the same time; i thought that might be the problem).

Any clues?

using upload_port instead of monitor_port, seems to have fixed this issue (I have others now. Great).

I had the same issue when I started with platformio and did not realize that the Arduino IDE was still open. Closing it resolved the thing…