Comms between AVR and USB-only PC?

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

What's the best (largely defined as "cheapest") hardware to add to an AVR design to allow comms with a typical PC, one that has USB but no RS-232 ports? I have seen the FT232R family of chips used, is that the device of choice? Are there similar devices hiding under different part numbers?

Also, any other tips, tricks and/or warnings on this subject are welcome. Thanks.

Mike

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

Future Technology: FT232 http://www.ftdichip.com/FTProduc...

Silicon Labs: 210x https://www.silabs.com/products/...

Prolific: PL2303 http://www.prolific.com.tw/eng/P...

The above 3 are probably the most common, and can be found in 90% of the USB-RS232 cables out there.

If you're looking for cheap, consider buying an off the shelf cable, and then using normal RS-232 converters on your boards. Unless you absolutely need your board to have USB on it.

Another USB solution would be to use one of the USB AVR's, an implement whatever device class you want.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

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

Possibly THE cheapest way of all is to do it all in software (apart from the 12MHz crystal and USB connector):

V-USB

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

The crystal is not necessary with ATTiny85's clocked with the internal 16.5 MHz PLL calibrated against USB timing, at least for hobby use. Here's a 12 cell lithium ion battery management system on a breadboard; the IR to USB bridge is the left chip. Below is the text input to a laptop, it's rock solid.

Attachment(s): 

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

clawson wrote:
Possibly THE cheapest way of all is to do it all in software (apart from the 12MHz crystal and USB connector):

V-USB


No crystal and no connector needed. Using V-USB protocol stack on Tiny45 /w USB HID descriptor. No application driver is needed for Windows.

/RJ

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

That's a 45V, I've tried one of those and it didn't work. What is your success rate?

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

dak664 wrote:
That's a 45V, I've tried one of those and it didn't work. What is your success rate?

I didn't have any 20PU parts during early testing. Regardless, sample size is 10. Success rate is 100%.

/RJ

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

Quote:

No crystal and no connector needed. Using V-USB protocol stack on Tiny45 /w USB HID descriptor. No application driver is needed for Windows.

RJ,

Now you've got me confused. I could have sworn you started a thread the other day where 30% of your V-USB design wasn't working and the conclusion of it was that a crystal made 100% work OK. Did I just dream that?

Cliff

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

clawson wrote:
Now you've got me confused. I could have sworn you started a thread the other day where 30% of your V-USB design wasn't working and the conclusion of it was that a crystal made 100% work OK. Did I just dream that?

Cliff


I am biting my lip ... but yes, you dreamed the last bit. :D A crystal is not the *only* way to make it work 100%.

You can read updates here: https://www.avrfreaks.net/index.p...

Summary: 100% success. 64 byte transfers work fine. Next test is 128 byte transfers.

/RJ

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

You can also use FT245 in parallel mode, if you don't like serial way;)
You can get best and cheapest if you use both, together it's impossible.

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

sirurx wrote:
You can also use FT245 in parallel mode, if you don't like serial way;)
You can get best and cheapest if you use both, together it's impossible.
So FT245 is the best solution? Why?

/RJ

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

rjburke377 wrote:
sirurx wrote:
You can also use FT245 in parallel mode, if you don't like serial way;)
You can get best and cheapest if you use both, together it's impossible.
So FT245 is the best solution? Why?

/RJ


I use in simple projects FT232 but FT245 has faster transfer and R/W signals so nothing gets lost. Also in parallel mode you don't care about AVR clock frequency as there is no serial channel between usb and AVR and therefore timing is not an issue.

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

sirurx wrote:
I use in simple projects FT232 but FT245 has faster transfer and R/W signals so nothing gets lost. Also in parallel mode you don't care about AVR clock frequency as there is no serial channel between usb and AVR and therefore timing is not an issue.

How do I attach it to my Tiny45?

/RJ

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

Cheapest I can get FT245 in the UK is 2.90GBP ~ 3.00EUR

If you only need a USB 1.1 compliant low-speed device then V-USB is by far cheaper.

Works for me though I am just a hobbyist. If I was thinking of a commercial product I'd probably opt for one of the usb2 compliant FTDI chips. Or even a USB enabled AVR. :wink:

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

maximax wrote:
Cheapest I can get FT245 in the UK is 2.90GBP ~ 3.00EUR

If you only need a USB 1.1 compliant low-speed device then V-USB is by far cheaper.

Works for me though I am just a hobbyist. If I was thinking of a commercial product I'd probably opt for one of the usb2 compliant FTDI chips. Or even a USB enabled AVR. :wink:


Your posts encouraged me to continue investing time in the V-USB solution :lol: I am now quite happy.

Even a commercial solution may be price sensitive. A 3.00EUR part will add additional sunk and per unit costs and may cause a business case to fail. To use a familiar phrase "The best solution depends on the requirements."

/RJ

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

maximax wrote:
If you only need a USB 1.1 compliant low-speed device then V-USB is by far cheaper.

I would be careful here with word "compliant". It was never formally tested for USB compliance, so there's no guarantee to work in all possible conditions. Good for a hobby or an application where failure is not fatal. Note that "software USB stack" also eats up a certain amount of resources in the AVR, and imposes limitations on interrupt latencies.

maximax wrote:
Works for me though I am just a hobbyist. If I was thinking of a commercial product I'd probably opt for one of the usb2 compliant FTDI chips. Or even a USB enabled AVR. :wink:
I agree, but let's make one thing clear: people confuse "low speed (1.5Mbit/s, the V-USB falls here as do most mice and keyboards)", "full speed (12Mbits/s)" and "high speed(480Mbits/s)" for the various revisions of USB specification. This is incorrect and except for laymen, unacceptable.

JW

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

wek wrote:
Note that "software USB stack" also eats up a certain amount of resources in the AVR, and imposes limitations on interrupt latencies.
Of course, as do many other bit-banged protocols.
wek wrote:
This is incorrect and except for laymen, unacceptable.
JW
What's "this" and why do laymen find it acceptable?

/RJ

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

"this" is exchanging "USB2.0" freely for "High Speed".

It appears to be hard to explain even to those otherwise knowledgeable, so explaining it to laymen is usually waste of time (they listen - partially - only when they buy some "USB2.0" labelled equipment and get angry at how slow it is).

JW

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

wek wrote:
"this" is exchanging "USB2.0" freely for "High Speed".

It appears to be hard to explain even to those otherwise knowledgeable, so explaining it to laymen is usually waste of time (they listen - partially - only when they buy some "USB2.0" labelled equipment and get angry at how slow it is).

JW

Oh, I see. So it's best to reference the speed and the USB revision when talking about capability. Thanks for the info.

/RJ

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

wek wrote:
"this" is exchanging "USB2.0" freely for "High Speed".

It appears to be hard to explain even to those otherwise knowledgeable, so explaining it to laymen is usually waste of time (they listen - partially - only when they buy some "USB2.0" labelled equipment and get angry at how slow it is).

JW

Funny that you bring that up.

I was at the USB committee meeting where Intel, Microsoft, HP, and Compaq joined forces and killed one of my proposals to be able to distinguish between different USB 2.0 implementations.
It was so that consumers would be able to tell the difference between a "real" 2.0 device and one that was merely compatible with the USB 2.0 bus.
(It's an even bigger deal for Hubs than in Devices)

Intel and Microsoft bashed the proposal saying they didn't want to confuse people. They wanted to keep it simple and that there should only be "1" USB.
I wanted a new logo to indicate true high speed support.
(Actually its more complex than just a speed issue but in the name of simplicity I was willing to reduce the new logo down to some sort of "high speed" designation)

Intel and Microsoft were able to get the majority of voting members to vote their way. It sucked, I lost, and I think it has confused the market ever since.

At the time it literally bankrupted some small companies that had built high performance USB 2.0 products because their products cost more than the simpler slower devices and the consumer had no way of knowing the difference between them.

I tried.....

--- bill