COM port on the Arduino Leonardo

Discussion in 'Embedded Systems and Microcontrollers' started by adam555, Aug 10, 2014.

  1. adam555

    Thread Starter Active Member

    Aug 17, 2013
    858
    39
    I can't get my Arduino Leonardo to connect with a program via the COM port; as it seems that all serial USB communications go through a virtual COM port.

    Is there any way to configure or program the Leonardo to use the hardware port for communications over USB?

    Thank you in advance...
     
  2. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,810
    834
    Have you investigated the SoftwareSerial library for the Arduino? It allows serial communication on other hardware pins. The reference page for the library is here.

    Edit: I just re-read your post and saw that you were looking for a USB connection. Nevermind.
     
  3. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,395
    497
  4. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    Check your device manager and expand the "Ports (COM & LPT)" section. This will tell you exactly which COM port the Arduino is using. I have never heard of them using virtual ports, but then again I only have an Arduino Uno and an Arduino Mega.
     
  5. Brownout

    Well-Known Member

    Jan 10, 2012
    2,375
    998
    In the many different posts I've read where you ask about this, it seems to me that you are getting COM and USB mixed up. COM refers to a simple serial interface, usually associated with the old RS-232 standard. USB is the newer interface used on most computers these days. You can't have USB go through a COM port on a microcontroller. But you can use a UBS-to-Rs-232 to communicate form your PC to the COM port on your microcontroller. If your controller doesn't have a lever converter, eg a MAX-232, they you need a USB-to-serial converter that has CMOS level signals on the serial side, eg the FTDI 232 chip.
     
  6. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    I want to say the Arduino does the conversion itself already. It connects to a COM port through a USB connection to your PC.
     
  7. Brownout

    Well-Known Member

    Jan 10, 2012
    2,375
    998
    I think the Arduino uses the FTDI chip to do comm through USB. So in that case, it makes a virtual COM port. So, in order to use it, you would program the UC to use the built in COM or serial port, and the external chip does the conversion. You never need to think about or program USB. For all your concern, you are using and programming the COM serial port.

    If the Arduino doesn't have a native serial connector, I wasn't aware of that.
     
    DerStrom8 likes this.
  8. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
  9. adam555

    Thread Starter Active Member

    Aug 17, 2013
    858
    39
    I've been reading that only 2 Arduinos have this problem, or lets say feature, the Arduino Micro and the Arduino Leonardo (the one I'm using). They have a hardware port -which is used exclusively by the bootloader on connection- and a virtual port for communications over USB. All other Arduino boards use the hardware COM port for communications.

    When you first connect one of these 2 boards, the bootloader opens the first COM port available (e.g. COM port 3 in my case), and when it finishes, creates a virtual COM port (number 4 in my case) for serial communications.

    Now, the software I'm trying to connect to receives data through the hardware COM port (I know because if I set the software to the COM 3, I see data coming when the bootloader port is open), but cannot connect to the virtual port (nothing comes in through COM port 4).

    Said that, I know that I can send and receive data over the hardware port -by simply using "Serial1" instead of "Serial", but this only transmits over Pins 0 and 1 (Pins RX1 and TX1), and not through the USB cable connection.

    What I need to do is to keep the hardware port open (the first COM port that is used by the bootloader) and send the data to that port, through the USB cable, into the COM port 3 on computer, and into the software.
     
    Last edited: Aug 10, 2014
  10. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,395
    497
    Have you tried closing Arduino IDE and using terminal program to receive data from the board?
     
  11. adam555

    Thread Starter Active Member

    Aug 17, 2013
    858
    39
    Yes, the other programs work fine; for example: with a serial monitor I can see the data in/out fine through the virtual COM port 4. It's only the software I'm targetting that requires COM port 3, and listen to this... only for input (output works fine on COM port 4).
     
Loading...