Page 1 of 1
Understanding AVR-USB
Posted: Thu Aug 30, 2007 3:58 am
by GeorgeFace
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.
Posted: Thu Aug 30, 2007 4:02 am
by GeorgeFace
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.
Posted: Fri Aug 31, 2007 12:17 am
by ksz
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..
Posted: Fri Aug 31, 2007 5:04 pm
by GeorgeFace
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.
Posted: Sun Sep 02, 2007 11:11 am
by ksz
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
Posted: Wed Sep 05, 2007 3:05 am
by GeorgeFace
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.
Question on AVR USB
Posted: Wed Oct 24, 2007 5:35 pm
by jippi
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
Re: Question on AVR USB
Posted: Wed Oct 24, 2007 6:40 pm
by ksz
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..
Posted: Wed Oct 31, 2007 1:44 pm
by christian
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).