简体   繁体   中英

Could not find COM port and port list is empty

Hey i would like to connect my eclipse programs written in Java with an Arduino. Previously i used Processing but now i am working on something more difficult: I will connect a Leap to an Arduino, but i get the following message when i try to connect to my port.

I am using a Mac and the port i used in processing was tty.usbserial-AM01VBFC

However this does not work with the given example from: http://playground.arduino.cc/interfacing/java

I changed this to match my port:

private static final String PORT_NAMES[] = { 
        "/dev/tty.usbserial-AM01VBFC", // Mac OS X
                    "/dev/ttyACM0", // Raspberry Pi
        "/dev/ttyUSB0", // Linux
        "COM3", // Windows
};

and the result is:

Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
Could not find COM port.
Started

The port list is empty in my opinion because:

portEnum.hasMoreElements()

is false.

The full code can be found in the link above the only thing i changed is the port name for Mac OS X.

I have found only one guy with the same problem and he found a solution for ubuntu i do not understand: http://forum.arduino.cc/index.php?topic=73350.0;wap2

Hoping for some help, Georgi

I found a solution for the problem:

System.setProperty("gnu.io.rxtx.SerialPorts", "/dev/tty.usbArduino");

the line above has to be commented out and you have to delete your lock files for a "fresh" USB connection!

Thanks to all the answers that lead me to the right way!

edit: it was "/dev/tty.usbArduino" because i made a symlink of my ports! I deleted the symlink afterwards

Follow Tim's advice and print the ports, running:

ls /dev/tty.*

in Terminal. This should allow you to double check if "/dev/tty.usbserial-AM01VBFC" is actually the correct name.

If nothing prefixed by tty.usbserial while your device is connected try this:

  1. Install the FTDI VCP driver
  2. Only if 1 doesn't work and you're using Mavericks try to unload Apple's FTDI driver: sudo kextunload -b com.apple.driver.AppleUSBFTDI (note that this need to be done once per OSX boot)

There are two types of cable:

  1. Charging Cable
  2. Data Transfer Cable

So, try changing cable if you have tried every usb driver and port.

Else, install driver using this link, http://www.wch.cn/download/CH341SER_MAC_ZIP.html

After installing if it doesn't work then change cable.

It worked for me after changing the cable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM