AVR USB

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

Hello!
i want to try a real usb relashionship between avr and pc. i mean, avr with internal usb module like at90usb1286.
There's some tutorial with a simple usb communication for newbies?

some like this
http://www.waitingforfriday.com/...

but for avr :)
i think the at90usb1286 is the most used for simple projects.

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

Google "LUFA AVR" and all your prayers will be answered.

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

i want to send and receive simple byte from pc.
the difficult part is the "pc program"
what i'll need for that? some dll?

i'll try in visual studio

LUFA projects its for avr part, right?

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

at90usb1286 is little expensive

i'm between AT90USB162 and atmega32u2

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

It's funny how the same threads keep happening here!

Anyway your first choice is what class of USB device you are going to implement. There are many to choose from such as generic, HID, CDC-ACM, MSD, Printer, MIDI, etc.

What yoyu have to do on the AVR side and what you have to do ont he PC side will differ according to which one you choose.

The choice may be dictated by the kind of data to be exchanged and the frequency (bandwidth) of doing so.

For an easy life a lot of people choose CDC-ACM as a first choice (that's why there are even dedicated chips like FT232 and PL2303 that can also do it) because by choosing this the PC side becomes very easy to "drive". The USB device will look like a virtual COM port to the PC so you may not even need to write special software to drive it but will often find that a terminal like Hyperterminal/Brays/realterm/TeraTerm is all you need and even if you do plan to write your own interface software you will likely find during development that you can test from the PC side just using one of those programs. This makes development much easier as you aren't working on both the PC side and the AVR side at the same time so can isolate the faults to one end.

Another easy to use device class is MSD - it's a bit complicated at the AVR end but at the PC end it's possibly the easiest as the device will look like a disk drive (think "USB memory stick"). Because it looks like a drive then exchanging data can be as simple as opening what appears to be a file on the drive and reading/writing it. To test you might even find that drag/drop of files in Windows Explorer is all you need and you wouldn't need to run anything "special" at all on the PC end. The price you pay though, as I say, is that the AVR end can be more complex to implement.

So first pick your device class.

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

in the pc side the program it will collect data (simple bytes) in array and it will prints in screen
also the pc program it will send simple commands in avr to do something.

i have achieved this with ft232 and atmega32 through uart and i want now to do this in native usb.
for hobby!

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

Quote:

i have achieved this with ft232

In that case the choice is clear: CDC-ACM. It's exactly what the FT232 was doing so it will work almost identically except that instead of m32+FT232 you effectively have everything inside the single USB1286.

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

what is m32?

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

shorthand for "atmega32" you said you were currently using.

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

ok! yes that is my mcu.

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

hello again!
i decided to continue with avr-usb.
i have achieved a simple communication with USB via FT232RL with Visual C#. (ftd2xx_net.dll)
A simple windows form program sends and receive bytes to/from ftdi chip with atmega32.
so i have done a simple program which give me the result of analog convertion to my form.

now i want to buy AVR with buit-in USB controller
i think this is ok
http://www.ebay.com/itm/19087963...

but as i see, there's no isp connection.
so, how can i program it with my stk500?

Last Edited: Sun. Aug 10, 2014 - 07:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

so, how can i program it with my stk500?

Open up the data sheet for the ATmega32U4. Locate the section on serial programming. Read about what pins are used. Go to the beginning of the document and locate the pinout diagrams. Use the pin names you got earlier and translate them to the pin numbers your specific package uses.

Next, get the schematics for the module you've found on EBay. Follow the signal lines from the ATmega32U4 to the pins on the PCB.

Now you know the pins on the PCB that you need to use for ISP programming.

Alternatively, if the module comes with the mega32U4 pre-programmed with a DFU bootloader, use that (utilizing the USB connection) rather than ISP.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

JohanEkdahl wrote:
Quote:

so, how can i program it with my stk500?

Open up the data sheet for the ATmega32U4. Locate the section on serial programming. Read about what pins are used. Go to the beginning of the document and locate the pinout diagrams. Use the pin names you got earlier and translate them to the pin numbers your specific package uses.

Next, get the schematics for the module you've found on EBay. Follow the signal lines from the ATmega32U4 to the pins on the PCB.

Now you know the pins on the PCB that you need to use for ISP programming.

Alternatively, if the module comes with the mega32U4 pre-programmed with a DFU bootloader, use that (utilizing the USB connection) rather than ISP.

to understand,
if my mcu (mega32u4) isn't pre-programmed, can i program it once (to install DFU bootloader) with these pins and after that to use only usb connection.

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

Quote:

if my mcu (mega32u4) isn't pre-programmed, can i program it once (to install DFU bootloader) with these pins and after that to use only usb connection

I'm going on what I read only, not on actual experience (with the mega32U4 specifically).. But as far as I can tell: Yes.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

giorgos3924 wrote:

to understand,
if my mcu (mega32u4) isn't pre-programmed, can i program it once (to install DFU bootloader) with these pins and after that to use only usb connection.

You should be able to program the board without having to install the DFU bootloader - just use avrdude with the already installed arduino bootloader.

Here are a couple of posts from clawson:

(Link) Aug 16, 2013 - clawson wrote:

I guess the real question is "why do you think it's advantageous to put DFU in the chip?" (personally I cannot think of any good reason to do it as you are about to destroy a perfectly working Arduino!).

(BTW Flip is the name of the PC software, the bit that goes in the AVR is called DFU - named after the USB Device Firmware Upgrade (DFU) class).

(Link) Aug 17, 2013 clawson wrote:
Quote:

I don't like Arduino language and I just want to be able to burn my own .hex files from AVR Studio.

Then leave the board exactly as it is now. Build your code using AS6, when you have a .hex file use avrdude to talk to the existing bootloader and program the code into the chip. There are many many tutorials about how to use an Arduino board in this way.

Forget Flip/DFU it's got nothing to do with what you are trying to achieve here (you can't run Flip from inside AS6 anyway).

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

avrdude is "programmer software" which used to load hex into AVR?
or compiler?

- for compiler i want to use avr studio 6.1

.
.

This is comming with pre-installed arduino bootloader??
http://www.ebay.com/itm/Leonardo...

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

giorgos3924 wrote:
avrdude is "programmer software" which used to load hex into AVR?
or compiler?

- for compiler i want to use avr studio 6.1

.
.

This is comming with pre-installed arduino bootloader??
http://www.ebay.com/itm/Leonardo...

From my post above:

Quote:
Build your code using AS6, when you have a .hex file use avrdude to talk to the existing bootloader and program the code into the chip.

So yes, avrdude is programming software.

And yes, the board should have the arduino bootloader installed.

Also, see this post (Link):

Jun 14, 2014 XNor_01 wrote:
Thanks for that, I managed to get it working :)

I have enabled the verbose option for arduino IDE and this is the command it uses:

$ avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -V -Uflash:w:./main.cpp.hex:i

But I would like to point out for other people that might have the same problem that I still had to do the trick explained here:
http://nicholaskell.wordpress.co...

That is, first of all, connect to the board using 1200 bauds "to kick the chip into bootloader" :)

Cheers!

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

Hope this is good
http://m.ebay.com/itm?itemId=310...
What do you think

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

mega32U, USB, programmable as purchased.
http://www.pjrc.com/teensy/index...

also ARM board, low cost.

Great "Teensyduino" library for both MCUs.

Don't buy that crap from China.

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

Quote:

What do you think

Your link doesn't work for me but this does:

http://www.ebay.co.uk/itm/310634...

I assume that's the same thing (same item number)?

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

yes.
i buy it!

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

I buy atmega32u4 (not arrived yet).

Reading some blogs about usb avr, like this: http://www.waitingforfriday.com/...

I thought, if the avr with built-in usb controller is the same with a pair ftdi-avr.
which way is the best? and whats the difference between them? I think speed may be some difference.

until now i make a simple program with ftd2xx_net.dll in VC#. ftdi dll give us direct access to the USB controller.
So, an AVR with built-in USB controller what more can it give us?

- Thanks

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

What is FIFO?
I saw tis on FT245

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

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

How can I work with ft245?
It using same drivers and same dll right?

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

After reading data the buffer goes empty? For example
I write 10 byte and read 5, there's 5 bytes left in the buffer or lefted whole 10 bytes until complete buffer size? In ft245 how can i activate txe# and rxf#?
If I want only write or only read?

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

How can i get more of 230,4kbps in a pair AVR-FTDI?
in my atmega32-ft232rl i have 230,4kbps baudrate (UART) and i want more speed for real time monitoring projects.

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

How can i make an event which indicated me if there's available unreaded data, only when AVR sends data to FTDI buffer and ONLY then. Whithout forcing my program to making loops for checking available data. For my purpose, i want to do the mcu to sends data only when he wants, and the PC must to knows when there's new data in FTDI buffer's chip.
The event it'll enabled only when ftdi's buffer contains New unreaded data.
Iam using FTD2XX_NET.DLL

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

I know that It's impossible for the pc to know when AVR sending data to the FTDI. But this which I mean it's that I need some way for my program to know if FTDI have New unreaded data to it's own buffer