Leonardo CDC handshake signals

Is there a way to access the virtual handshake signals of the Leonardo CDC (virtual COM port)? I need access to RTS and CTS.

One signal is available at D11, the other drives the Tx LED so you'll have to add a wire to the board. See the schematic.

So... the CDC isn't totally virtual? From the standpoint of the computer, I need RTS and CTS to be tied together, so that the state of CTS follows the state of RTS. I would like to do it all in SW if possible.

See 18.9 of the data sheet, page 203.
Up to the software to enable the hardware RTS/CTS.
I am guessing the software does not.

That all seems to be in regard to the HW UART, not the CDC virtual COM port.

I think you'd have to look through the CDC files in the Arduino core, to see if there's a way to emuluate RTS and CTS or control their virtual functionality.

Chapter 18 in the datasheet is all about the hardware serial port, and AFIK should not come into play at all with the USB side of things.

Cheers!

I have been digging through the USB files in the core, and I haven't found anything yet.

Ok - I don't know what you are referring to.

A COM (Edit: as in RS232) port has 8 signals; DCD, Rx, Tx, DTR, DSR, RTS, CTS, and RI. Obviously USB CDC supports these, because an FTDI (which uses USB CDC AFAIK) supports them. The Arduino core gives the user access to Rx and Tx, but I need access to RTS and CTS as well.

Ok, on older boards with FTDI chip, those signals did exist as part of the USB/Serial interface, and folks wrote software that let the pins be used.
Now, the USB/Serial "conversion" goes on inside the '32U4, and the signals do not come out.

If you want to use the Serial port and have those signals created to look like a full-fledged COM port, I think you will have to write the equivalent of a driver to make them do whatever they do. Perhaps search in the Playground for prior efforts that you can work from.

That part is not implemented in the CDC of Leonardo. But the information is theoretically available in the variable:

_usbLineInfo.lineState

RTS in bit 1 (value 2). I haven't found any information how the CTS line, maybe it's the BREAK signal which is in the same message type as the DCD and DSR. But on Arduino both signals are not used and therefore you wold have to implement the whole "upward" direction yourself anyway.

I've been digging through the USB and CDC core files now for several hours, and I still don't really understand exactly what needs to be changed (or how to do it).

I can read the value of _usbLineInfo.lineState, and it does indeed contain the status of DTR and RTS. However, the values only get updated when DTR changes. If the PC application (in this case a serial terminal) changes RTS, the value of _usbLineInfo.lineState will only change at the moment that DTR is changed (either made high, or made low).

Could someone with the ability please implement the handshaking signals? I'm sure I'm not the only one who wants this.

Which host OS have you tried that with? Only Windows? It's possible that the Windows driver doesn't support this functionality and sends no USB message if just RTS changes because it knows that the other end don't care (at least this was the case till the Leonardo hit the market).

I'm sure I'm not the only one who wants this.

To my knowledge you're the only one yet. For normal USB communication the handshake lines are not necessary, the only use of such a feature I currently see is using the Leonardo as a USB2Serial device.

You might want to look into Teensy (or Teensyduino) for this. Some of the serial control signals are implemented in their version of the USB CDC driver, and Teensy uses the same ATMega32u4 chip as the Leonardo.

Greetings!

Do you resolve this?

I want to tie D3 input to DCD signal - but it's seems there is no native function to do that.

I really appreciate your advice.