| Author |
Message |
|
|
Posted: Jan 22, 2012 - 09:14 PM |
|

Joined: Apr 07, 2011
Posts: 38
|
|
Hi all!
I recently managed to implement an USB powered device using ATtiny2313 and V-USB library. As a beginner, I needed several evenings of research prior to the project so I decided to compile a tutorial covering the steps for building a simple USB device:
http://codeandlife.com/2012/01/22/avr-attiny-usb-tutorial-part-1/
This first part covers the basics of getting USB connector to breadboard and using it to power a simple LED circuit. It can be extended to any USB-powered project.
http://codeandlife.com/2012/01/25/avr-attiny-usb-tutorial-part-2/
The second part goes through rest of the test breadboard setup, including wiring the ATtiny2313 to the USB with proper pullups for a low-speed device on D+ and D-, as well as enabling the 12 MHz crystal.
http://codeandlife.com/2012/01/29/avr-attiny-usb-tutorial-part-3/
The third part is the longest of the three and contains both device side and host side code, as well as a chapter on creating Windows drivers for V-USB devices using libusb-win32's INF-wizard.
http://codeandlife.com/2012/02/04/avr-attiny-usb-tutorial-part-4/
Fourth part details how to send data from and to your device. It also wraps up the tutorial series and contains the source code and schematic as well as needed libraries and drivers for Windows in one neat package.
I'm using quite a lot of pictures so I put the tutorial to my blog, but would appreciate any comments, feedback and discussion here. The spark for my electronics hobby started here in AVRfreaks tutorial section, so I felt it was time to contribute something.
Update: Two new parts have been added, first for making a HID mouse, and second which goes through adapting the tutorial for use with zener diodes to run the AVR at 5 volts, as well as switching to ATtiny85 (45 and 25 probably work just as well) and using internal oscillator instead of external crystal!
http://codeandlife.com/2012/02/11/v-usb-tutorial-continued-hid-mouse/
http://codeandlife.com/2012/02/22/v-usb-with-attiny45-attiny85-without-a-crystal/
Update2: Due to some requests, I've continued the tutorial with treatment of HID keyboards, too:
http://codeandlife.com/2012/06/18/usb-hid-keyboard-with-v-usb/ |
Last edited by jokkebk on Jun 18, 2012 - 05:00 PM; edited 5 times in total
|
| |
|
|
|
|
|
Posted: Jan 25, 2012 - 08:48 PM |
|

Joined: Apr 07, 2011
Posts: 38
|
|
| Second part is now also up. I felt that the breadboard connections, reprogramming the fuse bits for 12 MHz crystal & testing was suitably long already so I'll cover the V-USB in part 3. Stay tuned! |
|
|
| |
|
|
|
|
|
Posted: Jan 27, 2012 - 05:16 PM |
|


Joined: Jan 19, 2009
Posts: 14
Location: Stockholm
|
|
Seems to be quite some nice tutorials there, will surely check back for part 3!  |
|
|
| |
|
|
|
|
|
Posted: Jan 27, 2012 - 05:26 PM |
|

Joined: Sep 15, 2011
Posts: 131
Location: Israel
|
|
I'm glad someone is doing V-USB tutorial. I was too lazy to figure it out by my self.
Waiting for the critical 3rd part : ) |
|
|
| |
|
|
|
|
|
Posted: Jan 29, 2012 - 04:27 PM |
|

Joined: Apr 07, 2011
Posts: 38
|
|
Part 3 is now finally up, thanks for all the comments so far. This is the longest and most detailed part, I may yet do some housekeeping work on the article, add one zip file for all the source code and insert proper copyright and license notices in the beginning of the files.
There will be part 4 with some additional techniques shortly, at least sending and receiving short buffers of data will be covered then. |
|
|
| |
|
|
|
|
|
Posted: Jan 29, 2012 - 06:41 PM |
|


Joined: Jan 19, 2009
Posts: 14
Location: Stockholm
|
|
| Will go through it when I hit the bed tonight on my TV-pc, will be fun to read it. Good job jokkebk! |
|
|
| |
|
|
|
|
|
Posted: Feb 04, 2012 - 05:00 PM |
|

Joined: Apr 07, 2011
Posts: 38
|
|
Fourth and so far final part is now released. It will explain transferring data from a to device in more detail, and I zipped everything up in one package so you don't have to cut-and-paste so much if you don't want to.
Planning to do a simple 7 segment multiplexing tutorial and a brief bit on driving LCDs directly with MCU when I get some free time.  |
_________________ http://codeandlife.com
|
| |
|
|
|
|
|
Posted: Feb 11, 2012 - 10:27 AM |
|

Joined: Apr 07, 2011
Posts: 38
|
|
|
|
|
|
|
Posted: Jun 18, 2012 - 05:03 PM |
|

Joined: Apr 07, 2011
Posts: 38
|
|
I've received several questions regarding USB HID keyboards, and decided to continue the tutorial with a new post on that subject.
This should enable all kinds of data logger and interaction projects, especially since the type of keyboard I cover can also receive caps/scroll/num lock state changes from PC and react to them.  |
_________________ http://codeandlife.com
|
| |
|
|
|
|
|
Posted: Jun 23, 2012 - 04:11 AM |
|

Joined: Jun 21, 2012
Posts: 1
|
|
| Awesome effort..!! However I had a question. Can this method be employed for making a USB programmer for Atmega 8,16,32,64 or 128? |
|
|
| |
|
|
|
|
|
Posted: Jun 23, 2012 - 05:54 AM |
|

Joined: Apr 28, 2012
Posts: 70
|
|
|
|
|
|
|
Posted: Jan 19, 2013 - 10:21 PM |
|


Joined: Dec 11, 2010
Posts: 166
|
|
Hi, Joonas...
Based on trying to assist someone in this 'V-USB Command line client' thread, I was looking at your tutorial and realized that, unless I'm missing something, you're attempting to drive an ATTiny2313 MCU at 12 MHz but only on 3.3V. If all of my datasheets are correct, then that is beyond the specifications of that MCU! If you want to run it (within spec) over 10 MHz, you must use 4.5V - 5.5V.
I reviewed all of the comments on that page but I see nobody ever mentioning that MCU spec violation.
I do see where you (wisely) modified that design for your ATTiny85 V-USB tutorial to power the MCU from +5V, but the ATTiny2313 tutorial is still using 3.3V.
Am I missing something?
Regards,
Bill |
|
|
| |
|
|
|
|
|
Posted: Jan 22, 2013 - 07:25 AM |
|

Joined: Apr 07, 2011
Posts: 38
|
|
Hi Bill,
You are correct, when I did the tutorial I was not aware of the frequency limitation. In practice, I've never had any problems "undervolting" the ATtiny2313 @12MHz. But it is possible that some problems people have had might be connected to this.
I'll add a note in the tutorial and advice people to try out the zener diode configuration if they continue to have problems. If I have the time, I might even do an additional post with new power supply and diagrams.
Thanks for the feedback!
Joonas |
_________________ http://codeandlife.com
|
| |
|
|
|
|
|
Posted: Feb 22, 2013 - 06:11 AM |
|

Joined: May 21, 2012
Posts: 71
|
|
| ya thank you, i learned most of things of usb from this tutorial then i want to learn ethernet programming if guys know about ethernet communication, you can teach to lot of peoples also give details for beginners. |
|
|
| |
|
|
|
|
|
Posted: Feb 22, 2013 - 08:29 AM |
|


Joined: Feb 22, 2013
Posts: 384
Location: Ab Pakhsh , Bushehr , Iran
|
|
|
|
|
|
|