Author Topic: USB Getting started  (Read 10145 times)

PatrickBJ

  • Member
  • ***
  • Posts: 1
USB Getting started
« on: February 06, 2013, 09:12:19 am »
I'm reasonably proficient in MicroSoft Visual C++, and programming my Atmel Mega AVR 8 bit micros using CodeVision's C compiler, and I have just read Jan's USB Complete 4th Edition. I have purchased the Atmel STK525 AVR USB Starter kit.
I have an application where I need to transfer data from my AVR Mega32 device to a PC window, the data is slow port bit data - 10 bits changing at < 1 Hz, and some 12 bit data from the D/A converter, also at a rate of about 1 Hz. I also want to send the device some setup data  - about 64 bits. Of course I want to use USB, but I am overwhelmed by the amount of setting up and USB transfers that have to happen before I can do this. It seems impossible to know where to start in all the reams of sample code I've seen.
Could anyone provide me with Visual C++ code and Atmel MegaAVR code sample for a similar type of project, or some getting started advice?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB Getting started
« Reply #1 on: February 06, 2013, 10:17:02 am »
This article is old but most of it still applies:

http://lvr.com/usb_on_a_budget.htm

The quickest solution is to add a USB/serial converter chip. Then you can use serial-port code on the device and host.

If your compiler includes a USB CDC-class driver, you can use that with serial-port code on the host.

To use the HID class, you can start with the mouse example, modify the HID descriptors and the code that sends data, and add code to receive data.

This website (Lvr.com) has host and device example code but not much for AVR devices.