-1

Does anyone know how the data in data packet looks like when the USB is initialized as COM port?

I have a Arduino Mega 2560. I have initialized COM port with a baud rate of 9600. I know that there are four types of USB packets as

  1. Token Packet (Commonly used for device identification and transaction initiation.)
  2. Data Packet (Contains the data that needs to be transferred from host to client or vice-versa.)
  3. Acknowledgement Packet (Acknowledgement for error-free data reception.)
  4. Special Packets (Hub to hub communication and speed differential.)

The payload in data packet is formatted as

DATA1 >> PAYLOAD >> CRC16 ; DATA2 >> >> PAYLOAD >> CRC16 ; etc.

Till this point I am clear about whats happening.

Now all I want to know is

  • How the data is structured in the PAYLOAD section, when USB is initialized as COM port?
  • How the baud rate comes into picture i.e how a particular baudrate is achieved in this type of communication?
  • How is communication in terms of packet sequence? Does the sequence of packets change? (Like token>>data>>ack>>data>>ack>>...)

I really need to know this urgently as I am working on program that has to connect with 3 MEga2560 boards through a USB hub. I want to fix my design constraints depending on what is the maximum baud rate that I can achieve for all boards.

  • What you are looking for is a reference on the CDC/ACM scheme (or where applicable older vendor-unique schemes such as that of the ftdi chips). You might find it interesting to either read the relevant linux kernel driver, some of the Android USB host code that is out there, or the firmware of the 8u2 chip. However, normally an application would not pay any attention to this, and the let the operating system handle it. – Chris Stratton May 21 '14 at 13:55
  • The user-visible baud rate has no effect on the USB (which is probably 12MB/s), it is just a configuration parameter passed through for the 8u2-Mega2560 serial channel. What you do have to watch out for on USB is latency - regardless of "serial" baud rate it can take longer than on a true serial link to a send byte or two and get a response, as the USB portion of the connection is limited to packets sent at fixed intervals no matter how small. – Chris Stratton May 21 '14 at 13:59
-1

Once the USB connection is initialized as a COM port, it no longer utilizes traditional USB packets (only internally). It acts as a regular COM port. This layer of abstraction is created by 8u2 chip on Arduino side and by the driver on the PC side.

If you need to use the USB without the COM port abstraction, you have to probably configure the 8u2 chip to behave this way. I think it should be possible to configure to act as some HID device for example. You would also need to take care about the PC side and you might have to write your own driver.

For a guide on hacking and configuring the 8u2 chip on Mega, see following link:

http://arduino.cc/en/Hacking/DFUProgramming8U2

  • Can you suggest me any link where I can read more about this:- "it no longer utilizes traditional USB packets" . This would be really helpful. – Damon May 21 '14 at 12:17
  • The first sentence here is not very accurate. There is no difference between initialization and operation - it is still a USB device on the wire, and a serial device to client programs downstream of the ttyACM driver (or whatever your operating system choses to call it). – Chris Stratton May 21 '14 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.