PlatformIO Community

PlatformIO choses wrong upload-Port for Arduino Nano on Ubuntu but correct one in Windows

I have a small Project with an Arduino Nano and up to now I did all the coding with PIO under Windows where it worked fine.

Now I’d like to work on the project under Ubuntu. But here PIO fails to upload to the Nano. I see the following message:

  • Building .pio/build/nanoatmega328/firmware.hex
  • Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
  • RAM: [== ] 16.2% (used 332 bytes from 2048 bytes)
  • Flash: [== ] 21.7% (used 6680 bytes from 30720 bytes)
  • Configuring upload protocol…
  • AVAILABLE: arduino
  • CURRENT: upload_protocol = arduino
  • Looking for upload port…
  • Auto-detected: /dev/ttyACM0
  • *** [upload] could not open port /dev/ttyACM0: [Errno 16] Device or resource busy: ‘/dev/ttyACM0’

When I open the serial monitor I get the following:

  • — Available ports:
  • — 1: /dev/ttyACM0 ‘Sierra Wireless EM7345 4G LTE - Sierra Wireless EM7345 4G LTE’
  • — 2: /dev/ttyUSB0 ‘USB2.0-Serial’

So it seems like the wrong port for the upload is chosen.

Now if I put the following Line:

  • upload_port = /dev/ttyUSB0

to the platformio.ini everything works fine.

But I would prefer that PIO choses the correct port automatically as it does under Windows.