Pages: [1]   Go Down
Author Topic: Leonardo CDC handshake signals  (Read 1602 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 127
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Brattain Member
*****
Karma: 517
Posts: 26301
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 127
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Brattain Member
*****
Karma: 517
Posts: 26301
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 127
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Canada
Offline Offline
Jr. Member
**
Karma: 1
Posts: 81
Frequently Befuddled
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Full Member
***
Karma: 0
Posts: 127
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Brattain Member
*****
Karma: 517
Posts: 26301
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 127
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Brattain Member
*****
Karma: 517
Posts: 26301
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
_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 Offline
Full Member
***
Karma: 0
Posts: 127
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).

Quote
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 Offline
Jr. Member
**
Karma: 1
Posts: 81
Frequently Befuddled
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: