A3BU Xplained CDC virtual com port?

Go To Last Post
35 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK...  Apologies if this is a stupid question (and a nagging voice is telling me it will be), but I've been digging around for a few hours now and haven't found a solution.

 

I have an old 2560 A3BU Xplained kit, and would like to use the Atmel CDC USB driver.  Atmel's (Microchip's) site has a link to the driver in the online documentation (here: http://atmel.com/dyn/resources/p...), but it's a 404.  Google has turned up very few hits, with the XPLAINED_Virtual_Com_Port.inf files I've found not working - I can't get the card to show up as a com port, just a broken CDC device.

 

So - does anyone out there have a link to, or a copy of the XPLAINED_Virtual_Com_Port.inf file I need?  I'm running Win 7 x64.

 

Otherwise, could someone please tell me what driver would serve as an alternate, and point me to a quick primer on getting a USB interface up and running?  I have a working menu interface on another old card, but no driver for my current laptop.  i want to just copy over the old code and tweak it, that's why I'm looking for the same old driver.

 

Thanks a lot for any help!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you tried ASF or Start?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did try ASF - no luck.  I wondered if the problem was the company laptop and / or device driver / permissions, so I am trying my personal laptop now.  I just installed Atmel Studio 7 and the Xplained board shows up differently - I get a COM port assigned in device manager, but I can't connect to it in Putty...

 

I wiped my code and went to an Atmel Studio example project that should set it up for 115.2k, 8 bit data, and still can't connect to it.  I tried RealTerm to see if it was the terminal application, but no dice...

 

I've got to be missing something stupid...

 

Is there a setup / walkthrough for getting a CDC port implemented?  I'm also hoping to find a portable driver for the card.  At the end of the day, I need to plug this in to a machine that hopefully won't need a ton of bloat installed in order to communicate.

 

Thanks for help!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did try ASF - no luck

Care to elaborate on that?

 

So you are saying that none of the following ASF example projects worked? 

 

ASF Example projects for XMEGA A3BU Xplained

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BTW, the example projects include the *.inf file:

 

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks a lot Greg - I hadn't checked the projects in ASF.  What I meant was that I'd installed it after removing the drivers previously associated with the card, then reinstalled the card and searched the ASF directory for drivers.

 

I'll take a better look in ASF.  the problem I'm having is that my old code, and the two example projects in Atmel Studio 7 do not work as I'd expect.  I can't get a terminal to connect to the card.  It smells like a driver problem...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Even if you don't use the whole project from ASF as a separate new development surely the key thing is that one item that comes out of creating such a project is the INF file you are looking for. This should tie the VID/PID of the implementation to the standard Windows Serial USB .sys file shouldn't it?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Alright - problem solved.

 

For unknown reasons, both Putty and RealTerm were unable to connect to the com port.  I can connect with TeraTerm.

 

It looks like there were a couple problems - in earlier attempts, Windows wasn't assigning a com port to the hardware.  Uninstalling and reinstalling drivers seemed to have fixed that.  Add to that, Putty and RealTerm wouldn't connect...  Giving me the impression there was a lingering driver problem.

 

Off to work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

USB COM ports are janky on Windows... I hear that Windows 10 is better, but all the older versions have issues.

 

Not being able to connect is often because you were connected and the USB device did a surprise disconnect (i.e. reset or cable removed). For some reason the next time it connects you can't open the COM port. You have to make the app that last had it open close the COM port, then disconnect and reconnect USB before it will start working again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mojo-chan wrote:
USB COM ports are janky on Windows

I've not found that to be the case.

 

Any "jankiness" is down to janky drivers supplied with cheap-and-nasty USB converters - never had any problems with genuine FTDI.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

mojo-chan wrote:

USB COM ports are janky on Windows

 

I've not found that to be the case.

 

Any "jankiness" is down to janky drivers supplied with cheap-and-nasty USB converters - never had any problems with genuine FTDI.

 

That's because FTDI supply a special driver that fixes the jank. If you create your own CDC serial port firmware then you will have to use the standard Windows USB COM port driver, which has all these issues.

 

Well, you could clone the FTDI USB interface and hope they don't try to brick your device one day.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mojo-chan wrote:
If you create your own CDC serial port firmware then you will have to use the standard Windows USB COM port driver, which has all these issues.
FOSS libusb may be an alternative to Microsoft WinUSB.

Zadig - USB driver installation made easy

http://zadig.akeo.ie/

...

Zadig is a Windows application that installs generic USB drivers, such as WinUSBlibusb-win32/libusb0.sys or libusbK, to help you access USB devices.

It can be especially useful for cases where:

  • you want to access a device using a libusb-based application
  • you want to upgrade a generic USB driver
  • you want to access a device using WinUSB

...

WinUSB (Winusb.sys) | Microsoft Docs

https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/winusb

https://sourceforge.net/p/libusb-win32/wiki/Home/

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:

FOSS libusb may be an alternative to Microsoft WinUSB.

 

Yes. Just be aware that there are some limitations of libusb on Windows, due to it being build around the Linux driver model. They mainly affect composite devices. I submitted some patches to improve it but they have not been merged yet.

 

I'd avoid Zadig. A better option is to add WCID descriptors to your device. libusb can use the winusb.sys driver, in fact it uses WinUSB as its default backend on Windows.

Last Edited: Thu. Jul 12, 2018 - 03:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mojo-chan wrote:
A better option is to add WCID descriptors to your device.
https://github.com/pbatard/libwdi/wiki/WCID-Devices#what-is-wcid

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Microsoft's half-witted CDC driver is better on Win10.  If the device reboots you only have to close and reopen the port on the host at any time after the device reboots.

 

WinUSB is better partly because that nonsense doesn't exist.  I wrote a bunch of custom stuff for winusb for my PC GUI programs.  Is there easy to use software available that allows simple host programs to use winusb?  

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

steve17 wrote:

Microsoft's half-witted CDC driver is better on Win10.  If the device reboots you only have to close and reopen the port on the host at any time after the device reboots.

 

WinUSB is better partly because that nonsense doesn't exist.  I wrote a bunch of custom stuff for winusb for my PC GUI programs.  Is there easy to use software available that allows simple host programs to use winusb?  

Not sure exactly what you mean... There are wrappers for things like C#, or you can use libusb. You can also use HID... I recall there is a terminal app that uses HID.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:

mojo-chan wrote:
A better option is to add WCID descriptors to your device.
https://github.com/pbatard/libwdi/wiki/WCID-Devices#what-is-wcid

 

Or better yet

https://gist.github.com/kuro68k/22f1e9c691e8d1ef46d3

https://github.com/kuro68k/xmega_usb

Do you collect links or are you our resident Google Butler? ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

steve17 wrote:
Microsoft's half-witted CDC driver is better on Win10.  If the device reboots you only have to close and reopen the port on the host at any time after the device reboots.
Exar's USB CDC driver has that capability for Windows XP SP3 and subsequent for 1-channel USB UARTs.

steve17 wrote:
Is there easy to use software available that allows simple host programs to use winusb?
Python and USB CDC - pySerial

Python and USB through libusb - pyUSB

C and USB CDC - Windows code for reading from a Teensy

 


Exar | Interface | USB UARTs

https://www.exar.com/products/interface/uarts/usb-uarts

(2nd paragraph)

...

For applications where the USB interface may be disconnected and reconnected while a COM port is still open, Exar provides the XRUSB1 Windows driver that eliminates the need to close the COM port in the host application. 

...

https://pythonhosted.org/pyserial/tools.html

http://pyusb.github.io/pyusb/

PJRC

PJRC

C code for Teensy: USB Serial

https://www.pjrc.com/teensy/usb_serial.html

USB: Virtual Serial Port

...

 

(page bottom)

Transmit Bandwidth Benchmark

...

Serial read source for Windows.

...

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks!

mojo-chan wrote:
Do you collect links or are you our resident Google Butler? ;-)
smiley

I'm a pack rat wrt links and rely on my bookmarks for backing replies.

Google :

  • my Google fu is so so
  • Google's one of those legal entities that one should be leery of

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

steve17 wrote:
Is there easy to use software available that allows simple host programs to use winusb?
Windows 10?

Microsoft Windows USB Core Team Blog​

What is new with Serial in Windows 10

by George Roussos (Microsoft)

July 29, 2015

https://blogs.msdn.microsoft.com/usbcoreblog/2015/07/29/what-is-new-with-serial-in-windows-10/

...

 

2.   A Windows Runtime API for communication with Serial devices

[scenarios]

  1. USB Peripherals like Arduinos – including as a USB Accessory on new Phones and Tablets
  2. Peripherally connected USB to RS-232 Adapters
  3. UARTs inside embedded  systems like MinnowBoard Max or Raspberry Pi v2 running Windows IoT SKU

...

[link to a 46m video]

Windows 10 SDK includes two Universal SDK samples illustrating this API:

...

That API has functions for all UART discretes (so, can reset a MCU)

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mojo-chan wrote:
Not sure exactly what you mean... There are wrappers for things like C#, or you can use libusb. You can also use HID... I recall there is a terminal app that uses HID.
I'm not sure what I mean either. 

 

I wrote my PC winusb code 5 years ago and it wasn't easy.  I had to find winusb.lib in the SDK and put a link to it in my project.  Then I wrote a lot of code to interface to it.  I put that in another lib I call my_winusb.lib.  The end result works well but currently it is made to be used by my GUI.

 

For other people, I thought maybe there was an open(), read() and write() thing available off the shelf.  Maybe I could modify my stuff so a simple non-GUI program could use it.

 

I could try libusb if that makes it easier to use in a PC program.

 

When people want to use my code, they want CDC.  I think winusb is better, but I'd have to tell them how to use it on the PC.

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

steve17 wrote:

I wrote my PC winusb code 5 years ago and it wasn't easy.  I had to find winusb.lib in the SDK and put a link to it in my project.  Then I wrote a lot of code to interface to it.  I put that in another lib I call my_winusb.lib.  The end result works well but currently it is made to be used by my GUI.

 

Yeah, for reasons best known to themselves Microsoft doesn't make it easy to create WinUSB apps outside of the wizard thing in Visual Studio, and the wizard is more Ron Weasely than Hermione Granger.

 

Quote:
For other people, I thought maybe there was an open(), read() and write() thing available off the shelf.  Maybe I could modify my stuff so a simple non-GUI program could use it.

 

libusb is more or less like that, a little more complicated by not by much.

 

Quote:
When people want to use my code, they want CDC.  I think winusb is better, but I'd have to tell them how to use it on the PC.

 

My solution is to provide comms libraries for the desktop guys. Just something that wraps WinUSB or libusb and has some simple command/response or read/write functions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since there is a lot of activity in this thread - just thought I'd let everyone know that RealTerm and Putty both still will not open the CDC virtual com port.  I'm running Win10.

 

Terra Term works exactly as I'd expect.  I've rebooted, unplugged, replugged...  you name it.  This is a work machine, and I'm not an admin - I suspect there may be some underlying permissions issue, but have no idea what it'd be, or why terra term works.

 

When I get to it, I'll try connecting through VB and see where I get.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's why for low bandwidth stuff you really can't beat HID. With something like hidlib it's easy and bulletproof.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What do you mean by, "will not open the CDC virtual com port" ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Teensy's hid.h for operating systems :

int rawhid_open(int max, int vid, int pid, int usage_page, int usage);
int rawhid_recv(int num, void *buf, int len, int timeout);
int rawhid_send(int num, void *buf, int len, int timeout);
void rawhid_close(int num);

via

PJRC

PJRC

C code for Teensy: USB Raw HID - for building custom USB devices

https://www.pjrc.com/teensy/rawhid.html

...

Download Files

(un-archive RawHid Test C source code)

...

the forthcoming AVRDUDE 6.4 adds libhidapi.

http://svn.savannah.gnu.org/viewvc/avrdude/trunk/avrdude/NEWS?revision=1425&view=markup

...

10 * Major changes compared to the previous version:
11  
12 - libhidapi support (part of patch #8717)
13 - use libhidapi as (optional) transport for CMSIS-DAP compliant
14 debuggers (JTAGICE3 with firmware 3+, AtmelICE, EDBG, mEDBG)

...

HID API for Linux, Mac OS X, and Windows

http://www.signal11.us/oss/hidapi/

via https://packages.debian.org/buster/libhidapi-dev

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I mean I open putty, set it up and click open, only to see nothing at all happen (but I get the error dong).  When I set up realterm and get nothing at all in or out of the com port - there is no interaction between the PC and micro.

 

I set up LED toggles in the interrupts just to see if the board connected or received anything - nothing at all.

 

FWIW, I've used putty for years with Megas / FTDIs, and haven't seen this.  I tried TerraTerm on a whim and it's been bulletproof.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pwhitt wrote:

  I'm running Win10.

 

Terra Term works exactly as I'd expect.  

Tera Term works here also.  So does Hyperterm.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman wrote:

Teensy's hid.h for operating systems :

int rawhid_open(int max, int vid, int pid, int usage_page, int usage);
int rawhid_recv(int num, void *buf, int len, int timeout);
int rawhid_send(int num, void *buf, int len, int timeout);
void rawhid_close(int num);

This open() thing wouldn't work for my stuff because all my Xmegas have the identical code including vid and pid.  With WCID, vid and pid don't matter much.  I display the "name" (A.K.A. GUID) of each device.  Every Xmega has a unique name (GUID) so I put it in the so-called "sequence number string, which needn't be sequential or a number.  How's that for a misnomer?   I use a part of it to choose devices in the uncommon situation where I have multiple ones plugged in.  I also display the USB hub and port. 

 

 

 

Hmmm.  Can anyone explain why my two devices with identical software show up in Device Manager with different names.  I'm curious but not curious enough to investigate.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For differentiating HID devices I use the USB serial number. HIDAPI let's you query it easily.

Would need to see your code for the WCID thing but my guess would be you have a composite device.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mojo-chan wrote:

For differentiating HID devices I use the USB serial number. HIDAPI let's you query it easily.

If HID allows full speed with 64 byte low level data packets, and Microsoft's driver understands the concept of messages, I should look at it.

 

By understanding messages, I mean when the PC sends a message, the driver can allow the receiver, our device, to detect the end of the message.  In some cases that means the PC driver sends a ZLP.  The imposter Microsoft hired to write the CDC driver doesn't give us that capability.

 

While I'm on the subject of imposters, Microsoft's serial port driver could easily allow reception of a framing error/break to indicate the end of the message it is receiving. But it doesn't.  I originally thought it did, but I was wrong.  

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mojo-chan wrote:
Would need to see your code for the WCID thing but my guess would be you have a composite device.
No, none of my Xmega USB drivers do the composite thing.  Some day, I'd like to have 2 USB data channels.  One for regular data transfers, and a second one for monitoring the Xmega.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HID lets you send messages in the form of "reports". 64 bytes is fine. The report sizes are fixed by the report descriptor, so if you need variable length just use a length field in your data and discard the rest.

 

It's actually quite useful the way it is set up. You have reports that can go IN and OUT, and then you also have control packets that are separate. What I sometimes do is use the control interface for commands and the status reports for data.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I figured out why Windows calls one board "WCID Device" and the other "WCID Steve17".   When a board is plugged in for the first time, Windows adds a permanent registry entry.  It has an item called FrendlyName.  My Xmega driver originally used "WCID Device" and later I changed it to "WCID Steve17".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A good instruction for starting.

 

http://jingyan.eeboard.com/artic...

use google translator and it's all clear!