Understanding AVR-USB

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
GeorgeFace

Understanding AVR-USB

Post by GeorgeFace » Thu Aug 30, 2007 3:58 am

Is it possible to have a microcontroller that basically functions as normal, but can send data to a computer via USB when needed?

For example, is it possible for say, the microcontroller to receive a transmission via infrared, process that data and then send that to the computer. The microcontroller would also take readings from a temperature sensor and send that data to the computer.

Thanks for any help.

GeorgeFace

Post by GeorgeFace » Thu Aug 30, 2007 4:02 am

Or would I have to have a separate chip doing like USB-RS232 conversion and the main microcontroller would communicate with this one.

It just seems that you can only change set values on the ports from the host computer for turning LEDs on and off, etc.

ksz
Rank 1
Rank 1
Posts: 26
Joined: Tue Jan 09, 2007 9:10 pm
Location: Poland

Post by ksz » Fri Aug 31, 2007 12:17 am

Both are possible.. It depends what you want to do.. I mean how much 'non USB' work AVR has to do and how you'll make it work :)
If 'other jobs' for uC are frequently, then there can be problem with iterrupts (USB host sends packets to device every 1ms as I remember)..
I've had such a problem with my project, finally I've made it on two uC's connected via usart - one for USB, one for IR. You'll get more info and some source here.
If USB communication would be occasional, then it can be done in one chip..

GeorgeFace

Post by GeorgeFace » Fri Aug 31, 2007 5:04 pm

Great, thanks a lot.

Are you or anyone else able to point me to a good beginner's guide in IR transfer with AVR chips. I don't really understand how to make it work without using the USART.

ksz
Rank 1
Rank 1
Posts: 26
Joined: Tue Jan 09, 2007 9:10 pm
Location: Poland

Post by ksz » Sun Sep 02, 2007 11:11 am

GeorgeFace wrote:Great, thanks a lot.

Are you or anyone else able to point me to a good beginner's guide in IR transfer with AVR chips. I don't really understand how to make it work without using the USART.


If you don't need a HID class device, than you can make it on one AVR. Some example (non AVR-USB, author wrote his own driver):
http://www.xs4all.nl/~dicks/avr/usbtiny/. But on host side there must be some software to receive it.

PS. sorry for my english :wink:

GeorgeFace

Post by GeorgeFace » Wed Sep 05, 2007 3:05 am

OK, I've had a good read of various projects. The ones of interest all seem to be able to receive infrared. What I'm wondering is if the AVR can be connected to the computer via USB and receive AND transmit ir signals/data.

jippi
Posts: 1
Joined: Wed Oct 24, 2007 5:29 pm

Question on AVR USB

Post by jippi » Wed Oct 24, 2007 5:35 pm

Hello at all

I have a question on AVR USB:

Is it possible to read also data from a controller over USB
with this projekt or is it only possible to programm a controller??

lg jippi :)

ksz
Rank 1
Rank 1
Posts: 26
Joined: Tue Jan 09, 2007 9:10 pm
Location: Poland

Re: Question on AVR USB

Post by ksz » Wed Oct 24, 2007 6:40 pm

jippi wrote:Hello at all

I have a question on AVR USB:

Is it possible to read also data from a controller over USB
with this projekt or is it only possible to programm a controller??

lg jippi :)

Of course it is possible..
The AVRDoper, USBasp and other similar programmers are based on AVR-USB driver (there is AVR uC inside), so they're communicating with PC via USB :)
Please, see the PowerSwitch project - most basic AVR-USB implementation for example..

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Wed Oct 31, 2007 1:44 pm

Regarding the original question whether the controller can send data to the host or only receive data from the host:

On the physical layer, all data transfers are initiated by the host. If the controller should transfer data to the host, it must be polled in regular intervals. On a logical layer, USB introduces interrupt and bulk endpoints for this purpose. These types of endpoints are polled at regular intervals by the driver, without software intervention.

On the application layer, it looks as if the controller would send data spontaneously to the host. But on the physical layer, the host polls for data regularly.

This is not a limitation of AVR-USB, it's a design concept of USB (all versions of USB).

Post Reply