USB UART to CDC Modem Host Bridge?

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

Hi guys.....

Looking for some info on using an Atmel to create a USB Host device to act as a bridge to a CDC communications device.  Basically the Atmel will replace a PC to enumerate and pass data back and forth.  I have played around with the FTDI Vinculum II chips and can not get them to work.  The closest I could get was it to send me a data dump of the device descriptors, but I can't "handshake" any data back and forth in "terminal mode".  They(FTDI) are saying my CDC communication device is not "standard".  The device manufacture comes up as "Freescale Semiconductor inc" and the product description as "MQX Virtual Com Demo"....VID = 0x2504 and PID = 0x300.  There are 3 end points...0x81 in/interrupt, 0x82 in/Bulk and 0x83 out/Bulk.  I can provide a full device descriptor data dump if required.

 

Can anyone point me to an Atmel App note that may describe creating such a "data bridge"   AVR 280 is looks to be EXACTLY what I need (CDC Host application).  Which micro do I use?  What about the code?  I currently use ImageCraft AVR to write and compile my code.  Any help I can get will be appreciated.       

 

Thanks.....

Paul Mateer, AA9GG

Elan Engineering Corporation

                                                                    

Last Edited: Mon. Jan 30, 2017 - 04:37 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Tutorial" is the wrong forum for this but until I know what micro you are talking about it's difficult to know which forum to move it to.

 

I assume you cannot really mean an 8bit AVR as the only two models that have anything approaching "host" mode are AT90USB647 and 1287 which offer "OTG". Do you mean AVr32 (UC3) or Cortex?

 

Moderator

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

aa9gg wrote:
AVR 280

You mean this: http://www.atmel.com/Images/doc7... ?

 

Which micro do I use? 

 

AVR 280 wrote:
using the STK525 or USBKEY starter kit

http://www.atmel.com/tools/AT90U...

 

See also: http://www.atmel.com/tools/avrus...

 

aa9gg wrote:
What about the code?

See: http://www.atmel.com/tools/avrus...

 

 

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

AVR280 says: "the Host CDC software can run on STK525 or USBKEY (which are AT90USB647/1287)"  So I guess that means 8-bit?

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

Ok so moved to "Tiny/Mega" as I guess it is the OTG mode in an AT90USB1287 you are going to use then.

 

You probably know this already but that almost inevitably means your final solution is going to involved Dean Camera's LUFA too.

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

Is this the time to throw in the option of an RPi  as an inexpensive, purpose specific, PC for this application?

Obviously this doesn't answer your question of building a bridge with a USB Host micro from scratch, but it is always nice to have a Plan B.

 

JC

 

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

Some ready-to-go chips/modules here: http://www.hobbytronics.co.uk/us...

 

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

DocJC wrote:
Is this the time to throw in the option of an RPi  as an inexpensive, purpose specific, PC for this application?
... or a router? (alternate Plan B)

Some routers are able to power cycle a USB host port; handy for when a modem is stuck.

OpenWrt and DD-WRT are some of the embedded Linux distributions for routers.

MediaTek and Seeed Studio partnered on an inexpensive module that runs OpenWrt.

 


Of Modems and Men

Bringing Routers and Modems Together in Style

Supported Routers and Modems

http://ofmodemsandmen.com/supported.html

...

Router Model, USB Power Toggling

...

TP-Link WR720N, Yes

...

Raspberry Pi 2, No

...

http://www.dd-wrt.com/site/support/router-database 

https://www.seeedstudio.com/LinkIt-Smart-7688-p-2573.html

 

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

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

aa9gg wrote:

 The device manufacture comes up as "Freescale Semiconductor inc" and the product description as "MQX Virtual Com Demo"....VID = 0x2504 and PID = 0x300.  There are 3 end points...0x81 in/interrupt, 0x82 in/Bulk and 0x83 out/Bulk.  I can provide a full device descriptor data dump if required.

 

Can you ask Freescale for info on examples of talking to this ?

If it really is not standard, you may have to hand-craft some  workarounds..

 

aa9gg wrote:

.. I have played around with the FTDI Vinculum II chips and can not get them to work.  The closest I could get was it to send me a data dump of the device descriptors, but I can't "handshake" any data back and forth in "terminal mode".  They(FTDI) are saying my CDC communication device is not "standard".  

 

There is also now FT51A and FT9xx series parts from FTDI, you could look into CDC examples there ?

 

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

DocJC wrote:

Is this the time to throw in the option of an RPi  as an inexpensive, purpose specific, PC for this application?

Obviously this doesn't answer your question of building a bridge with a USB Host micro from scratch, but it is always nice to have a Plan B.

 

That's a good idea, as it gives another reference point for CDC hosting, and may be easier to 'pare back' to get info on what the MCU needs to do.

If the volumes are small, the OP may be able to simply stay with a RPi.

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

"Some ready-to-go chips/modules here: http://www.hobbytronics.co.uk/us..."

 

 

I have a few of these and it ALMOST works!  I have been working with their tech support trying to get it to go.  We can make it enumerate, but can not get the data bridge to work.  He won't give me a copy of the source code and I can't send him my CDC device for him to debug the USB port.  Both he and the guys from FTDI are telling me that they way this USB is setup is not standard.  I can communicate to it via PC but not thru these devices for some reason. 

 

Last Edited: Tue. Jan 31, 2017 - 11:53 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

....again what I am trying to do is connect 2 micro comports together.  Unfortunately one of them is USB and the other a TTL UART ( Atmel atMega328).  So....I need a device that will convert the USB port back to a TTL UART.  The one with the USB port is classified as a CDC Communications Device.

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

aa9gg wrote:

....again what I am trying to do is connect 2 micro comports together.  Unfortunately one of them is USB and the other a TTL UART ( Atmel atMega328).  So....I need a device that will convert the USB port back to a TTL UART.  The one with the USB port is classified as a CDC Communications Device.

 

Isn't that what the CH340G does?

 

Ross McKenzie ValuSoft Melbourne Australia

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

valusoft wrote:

aa9gg wrote:

 

....again what I am trying to do is connect 2 micro comports together.  Unfortunately one of them is USB and the other a TTL UART ( Atmel atMega328).  So....I need a device that will convert the USB port back to a TTL UART.  The one with the USB port is classified as a CDC Communications Device.

 

Isn't that what the CH340G does?

 

 

Nope...won't work.  You still need a USB Host (PC) in the picture.  This is basically the same as the FTDI RS232 converters

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

aa9gg wrote:
They(FTDI) are saying my CDC communication device is not "standard". The device manufacture comes up as "Freescale Semiconductor inc" and the product description as "MQX Virtual Com Demo"....VID = 0x2504 and PID = 0x300.

 

That often happens when a heap/lazy vendor takes the demo app and turns it into a product, as a result uses someones else's VID. It is quite likely to be non-standard, as the vendor is clearly not bothering with USBIF compliance. It may be that they are just relying on a quirk of the Windows USB driver, but they may not even be using the Windows driver. If they provide their own, they could be running anything.

 

You will probably need to sniff the USB device when it is talking to a PC, and reproduce that.

 

Unfortunately, CH340 and similar provide a USB device for the PC, I think the OP wants something to replace a USB Host, which is a lot harder.

 

Bob.

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

donotdespisethesnake wrote:

 

You will probably need to sniff the USB device when it is talking to a PC, and reproduce that.

 

 

I used USB Tree View and found it uses windows usbser.inf for the driver info and installs usbser.sys as the driver

I'm still a little clueless on  all this USB stuff, but will probably be an expert when I'm done. 

 

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

Curious. When I want to find out what a USB device is from the VID/PID I usually consult this list:

 

http://www.linux-usb.org/usb.ids

 

That does not actually have a VID entry for 0x2504 ??

aa9gg wrote:
I used USB Tree View
But that's not a protocol sniffer? I guess you want to use something like:

 

https://wiki.wireshark.org/Captu...

 

though there may be better USB protocol analysers than Wireshark. It may also be possible to somehow "watch" a USB dialog at the boundary between host and guest in a VM system like Virtualbox or VMWare.

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

What gets me is when I was playing around with FTDI's Vinculum II chip ( http://www.ftdichip.com/Products... ), I was able to get to to connect and dump the device descriptor info (see attached file), but could not get it to simply pass data back and forth...

Attachment(s): 

Last Edited: Tue. Jan 31, 2017 - 04:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

aa9gg wrote:

What gets me is when I was playing around with FTDI's Vinculum II chip ( http://www.ftdichip.com/Products... ), I was able to get to to connect and dump the device descriptor info (see attached file), but could not get it to simply pass data back and forth...

At least that is some sign of life - confirms a working USB link, and some portion of communication.

 

You may need to connect to a PC, and capture the packets, to see if some init/setup (eg of baud and handshake) is needed before it can accept data

There may also be limits on how the data can be sent, and even some pause dictates between data.

Do freescale give you examples ?

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

aa9gg wrote:

valusoft wrote:

aa9gg wrote:

 

....again what I am trying to do is connect 2 micro comports together.  Unfortunately one of them is USB and the other a TTL UART ( Atmel atMega328).  So....I need a device that will convert the USB port back to a TTL UART.  The one with the USB port is classified as a CDC Communications Device.

 

Isn't that what the CH340G does?

 

 

Nope...won't work.  You still need a USB Host (PC) in the picture.  This is basically the same as the FTDI RS232 converters

 

I thought you were using the "OTG mode in an AT90USB1287"...

 

Ross McKenzie ValuSoft Melbourne Australia

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

valusoft wrote:

 

I thought you were using the "OTG mode in an AT90USB1287"...

 

 

 

No...my main micro is a Mega328p

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

Now I'm confused. In #2 I said that if this were AVR8 it had to be 647/1287 because they are the only ones with OTG. AVR280 was mentioned and so in #3 Andy confirmed that it relates to either USBKEY or STK525, both of which are boards that either come with or carry a 1287. So how could a solution with 328p work? Are you talking about with Vinculum? If so, then yes, that may work as the FTDI is delivering what the 1287 might also do. But if you are looking to use an AVr8 only solution you have a choice of two. It must be 647 or 1287 as they are the only two AVR8 that have "OTG" which is the only thing that might offer any hope of acting as a (limited) USB host.

 

As I see it the potential solutions here are:

 

1) a very simple micro and a very fancy FTDI chip

2) a very simple micro and some other fancy USB host chip (Cypress etc)

3) an AVR8 but it has to be AT90USB647 or 1287 because of 300+ AVR they are the two with OTG

4) some form of "complete PC" and into that category fall Linux Single Board Computers (SBCs) such as BeagleBone or Raspberry Pi etc though it could be a "complete PC with a Pentium and everything if you want to go to the top end of the scale).

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

clawson wrote:

Now I'm confused...... So how could a solution with 328p work?

 

The 328p is the micro in the unit I need to connect to the CDC communication device.

 

clawson wrote:

 But if you are looking to use an AVr8 only solution you have a choice of two. It must be 647 or 1287 as they are the only two AVR8 that have "OTG" which is the only thing that might offer any hope of acting as a (limited) USB host.

 

As I see it the potential solutions here are:

 

1) a very simple micro and a very fancy FTDI chip

2) a very simple micro and some other fancy USB host chip (Cypress etc)

3) an AVR8 but it has to be AT90USB647 or 1287 because of 300+ AVR they are the two with OTG

4) some form of "complete PC" and into that category fall Linux Single Board Computers (SBCs) such as BeagleBone or Raspberry Pi etc though it could be a "complete PC with a Pentium and everything if you want to go to the top end of the scale).

 

I wanted to build stand alone unit that is the USB host / data bridge using an Atmel.  What sucks is those 2 parts are 64 pin TQFP (can you say OVERKILL!!)  I was also looking at MicroChip (who now own Atmel) parts like the PIC24FJ64GB002.  At least it is only 28 pins and has full-speed OTG USB.

 

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

I've faced this before. Atmel don't make an 8bit with USB in DIP and especially not one with host facility. But if this is a "one off" just get an AT90USBKEY. Last time I looked they were $25 which is amazing value for a board including an AT90USB1287 and some "toys" dotted around it. (Dean developed most of "LUFA" on one of those I believe).

 

When I was looking for "cheap and cheerful" USB (not host) in DIP then the Microchip offerings do stand out - of course that was back in the days when "Microchip" was a rude word around these parts!

 

(just checked - £25 not $25 - but if the pound carries on as it is they'll soon be the same anyway!)

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

clawson wrote:

 But if this is a "one off"....

/quote]

 

I would say at least 50 - 100 of them to start

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

at least 50 - 100 of them to start

That's a good thing, for multiple reasons.

 

That is also all the more reason to try the  AT90USBKEY that Cliff mentioned, as a prototyping platform with which to get the basic functionality up and running.

 

Once it works, then spin a custom PCB with the micro, interfaces, etc., and farm it out to have 100 of them made.

 

One would think that your time should be spent on system design, while a pick and place machine quickly, accurately, and reproducibly makes the boards for you.

 

JC

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

clawson wrote:

 

3) an AVR8 but it has to be AT90USB647 or 1287 because of 300+ AVR they are the two with OTG

 

Any particular reason why it has to be an AVR8?

 

There are plenty of ARM Cortex-M (both Atmel & otherwise) with USB Host/OTG.

 

But I would agree that the AT90USBKEY and AVR280 App Note does look like an obvious starting point ...

 

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

awneil wrote:

 

Any particular reason why it has to be an AVR8?

 

There are plenty of ARM Cortex-M (both Atmel & otherwise) with USB Host/OTG.

 

 

I don't really don't want a part with a million pins and mega capabilities to do such a simple(?) task.  It's times like this when I yern for the old days of simple RS-232 interfaces...

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

NXP Kinetis K20 series comes in low pin count packages. As for mega capabilities etc for a 'simple task' - USB host is not a simple task. Plus with the ARM devices there's more choice of development tools, examples etc. The cost per chip is competitive. There's probably a working example on MBED.

 

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

Cortex-M are not "mega capabilities" - certainly not M0 & M3 - and are widely available in modest pin counts (48 or even less).

 

The world's smallest wireless IMU - ARM Cortex M0+ 256KB, up to 48MHz. Wireless mesh, Zigbee, 9-DoF IMU, temperature, altimeter.

https://hackaday.io/project/5823...

https://www.kickstarter.com/proj...

 

 

USB is not trivial - M0/M3 capabilities are probably more in line for USB work that AVR8 ... ?

 

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

awneil wrote:
Some ready-to-go chips/modules here: http://www.hobbytronics.co.uk/us...

 

Those devices use PIC 24, but without access to the software it's pot luck with non-standard devices. I guess that USB host is a fairly niche requirement with not many ready solutions around, which is why Hobbytronics can charge a decent premium for a pre-programmed chip.

 

Unfortunately USB was designed to be asymmetric, so a lot of work is done in the host (PC), but the devices (keyboard, mouse) can be relatively simple. USB was designed by a committee of Intel and Microsoft guys, and it shows. Consequently as a "RS232 replacement" it sucks. The old days are gone. *sigh*.

 

Whether you use AVR or M0, you will still need to sniff interfaces and reverse engineer the protocol, if you have to interface with devices you did not design. There is a little option but to become a "USB expert".

Bob.

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

donotdespisethesnake wrote:
I guess that USB host is a fairly niche requirement

Not so nowadays, as all the "easy" interfaces - like RS232, PS/2, etc - are being replaced by USB.

 

This is great for the mass market, where Android/Windows/Linux can easily handle it - but not so good for small microcontrollers.

 

see also: http://www.avrfreaks.net/forum/c...http://www.avrfreaks.net/forum/w...

 

with not many ready solutions around

Again, there are now plenty of Cortex-M class processors which do have USB Host capability

 

Hobbytronics can charge a decent premium for a pre-programmed chip.

I guess they started in the days when USB Host on microcontrollers was rare - probably a diminishing market now.

 

Whether you use AVR or M0, you will still need to sniff interfaces and reverse engineer the protocol

Certainly if - as seems to be the case here - it's a non-standard profile

 

 

Last Edited: Sun. Feb 5, 2017 - 02:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

 

with not many ready solutions around

Again, there are now plenty of Cortex-M class processors which do have USB Host capability

 

Yeah, whatever. Capability != solution.

 

 

Bob.

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

donotdespisethesnake wrote:
Capability != solution

Very true - but 'capability' is a very important part of 'solution'!