0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« on: September 27, 2012, 07:15:30 pm » |
Is there a way to access the virtual handshake signals of the Leonardo CDC (virtual COM port)? I need access to RTS and CTS.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 249
Posts: 16560
Available for Design & Build services
|
 |
« Reply #1 on: September 27, 2012, 08:02:09 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« Reply #2 on: September 27, 2012, 08:09:32 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 249
Posts: 16560
Available for Design & Build services
|
 |
« Reply #3 on: September 27, 2012, 08:25:19 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« Reply #4 on: September 27, 2012, 08:31:50 pm » |
That all seems to be in regard to the HW UART, not the CDC virtual COM port.
|
|
|
|
|
Logged
|
|
|
|
|
Canada
Offline
Jr. Member
Karma: 1
Posts: 81
Frequently Befuddled
|
 |
« Reply #5 on: September 27, 2012, 08:32:27 pm » |
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!
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« Reply #6 on: September 27, 2012, 08:34:41 pm » |
I have been digging through the USB files in the core, and I haven't found anything yet.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 249
Posts: 16560
Available for Design & Build services
|
 |
« Reply #7 on: September 27, 2012, 11:02:02 pm » |
Ok - I don't know what you are referring to.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« Reply #8 on: September 27, 2012, 11:10:28 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 249
Posts: 16560
Available for Design & Build services
|
 |
« Reply #9 on: September 28, 2012, 12:13:57 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Switzerland
Offline
Faraday Member
Karma: 69
Posts: 3310
|
 |
« Reply #10 on: September 28, 2012, 10:51:29 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« Reply #11 on: September 28, 2012, 12:34:44 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Switzerland
Offline
Faraday Member
Karma: 69
Posts: 3310
|
 |
« Reply #12 on: October 01, 2012, 07:04:09 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Canada
Offline
Jr. Member
Karma: 1
Posts: 81
Frequently Befuddled
|
 |
« Reply #13 on: October 01, 2012, 11:47:40 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
|