Go Down

Topic: USB Host controller (Read 14557 times) previous topic - next topic

felis

I finished porting USB transfers. There is a new code in the repository and an article http://www.circuitsathome.com/mcu/programming/arduino-usb-host-part-3-descriptors

It took a while but I'm getting there:-). Next one will be describing talking to USB keyboard. Also, I started studying Nikon SDK to see how they implement camera control - doesn't seem too difficult.

/felis

felis

Not quite software related, but still - I recently routed a shield for MAX3421E and just received first prototype of a PCB from a boardhouse. Take a look -> http://www.circuitsathome.com/mcu/usb-host-shield-for-arduino-first-prototype
/felis

felis

Limping along, slowly but surely :-). I posted an example, demonstrating how to poll USB keyboard, take a look -> http://www.circuitsathome.com/mcu/programming/arduino-usb-host-part-4-peripherals  I'm now cobbling together a "LCD via GPIO" code so that I can actually see what I'm typing.
/felis

mowcius

Cool... I have been using the PS2 library currently but I have a mini USB keboard that I would like to use...

What capabilities does the shield have? Can it in theory read text from USB flash drives like the microSD card shield can do?

Mowcius

felis

This is standard USB host. It supports all USB 2.0 transfers, even isochronous (if device is slow enough). So in theory, working with anything that talks USB is possible - flash drives, webcams, audio, printers, etc.; limiting factor would be Arduino's program memory size.

The shield also have 16 general purpose lines - 8 inputs and 8 outputs, where inputs can also be programmed as interrupt lines. Can be used to control LCD, buttons, and such.
/felis

mowcius

Quote
This is standard USB host. It supports all USB 2.0 transfers, even isochronous (if device is slow enough). So in theory, working with anything that talks USB is possible - flash drives, webcams, audio, printers, etc.; limiting factor would be Arduino's program memory size.


Ok, even cooler... I presume that from your experience, it is easier to use old devices that don't require so much coding, such as old printers etc. I think that the limiting factor with this would be my coding experience before a lack of program memory. :D

I shouldn't have thought I would run out of space as I am just thinking of coding for a mini USB keyboard and a 'simple' USB mini printer...

From reading the pages you have written about it and the examples you have done, I presume that the arduino could be programmed to run different code depending on what device is plugged in...

Quote
The shield also have 16 general purpose lines - 8 inputs and 8 outputs, where inputs can also be programmed as interrupt lines. Can be used to control LCD, buttons, and such.



On this image, are the 16 lines the ones on the left?
Also, from the looks of it, the shield is not stackable/it has to be on the top, correct?

What configuration options are there regarding pin use?
If I have missed a page that tells me that then please just point me to it...

Mowcius

felis

Quote
Ok, even cooler... I presume that from your experience, it is easier to use old devices that don't require so much coding, such as old printers etc.


Keyboard and mouse are the easiest. They support so-called "Boot protocol" intended for use in PCs before OS loading - such as POST, BIOS config and such. In this protocol, keyboard data format is fixed - the fact that you don't need to parse report descriptor simplifies code significantly.

Quote
From reading the pages you have written about it and the examples you have done, I presume that the arduino could be programmed to run different code depending on what device is plugged in...


Current code supports single device on the bus; switching devices on the fly is possible. At present, multiple devices on the bus are supported in data structures of the USB library only; in the future, I may add code to support multiple devices or throw it away altogether to save space depending on how people would like to use the thing. The limitation is, again, Arduino resources - the keyboard polling sketch I mentioned earlier in the thread compiles into ~6500 bytes binary; this does not look like much, but, again, keyboard is the simplest of all USB devices.

Quote
On this image, are the 16 lines the ones on the left?


This is correct. Inputs are on the top, outputs on the bottom. To support 5V levels GPIO lines are also equipped with level translators (74AHC245 and 74HCT245 ), which can be mounted in the spaces provided.

Quote
Also, from the looks of it, the shield is not stackable/it has to be on the top, correct?


This is correct.

Quote
What configuration options are there regarding pin use?


There is an article about this -> http://www.circuitsathome.com/mcu/arduino-usb-host-shield-build-log-part-4

3 SPI signals are hardwired, 4 control signals have jumpers and can be re-routed.


If you have more questions, please ask.
/felis

mowcius

Quote
Keyboard and mouse are the easiest. They support so-called "Boot protocol" intended for use in PCs before OS loading - such as POST, BIOS config and such. In this protocol, keyboard data format is fixed - the fact that you don't need to parse report descriptor simplifies code significantly.


Ok, how's your project going with the LCD display showing what you type?

Quote
Current code supports single device on the bus; switching devices on the fly is possible. At present, multiple devices on the bus are supported in data structures of the USB library only; in the future, I may add code to support multiple devices or throw it away altogether to save space depending on how people would like to use the thing. The limitation is, again, Arduino resources - the keyboard polling sketch I mentioned earlier in the thread compiles into ~6500 bytes binary; this does not look like much, but, again, keyboard is the simplest of all USB devices.


That's about what I thought. Presumably a small amount of that is standard 'USB' code. I'm sure I will manage to fit the code on for the mini USB label printer I have... If not then I will just buy an arduino mega or use a serial label printer instead...

Quote
This is correct. Inputs are on the top, outputs on the bottom. To support 5V levels GPIO lines are also equipped with level translators (74AHC245 and 74HCT245 ), which can be mounted in the spaces provided.


Ok, I will mount it on the top of my stack then...


Quote
There is an article about this -> http://www.circuitsathome.com/mcu/arduino-usb-host-shield-build-log-part-4

3 SPI signals are hardwired, 4 control signals have jumpers and can be re-routed.

Ok...

felis

Quote


Ok, how's your project going with the LCD display showing what you type?


I'm playing with idea to reuse official LCD library code or at least function names/behaviour; the biggest problem is that I don't need any flexibility during initialization since I only have 8 lines out, which is just enough for 4-bit LCD mode.
/felis

mowcius

#24
Sep 29, 2009, 12:36 pm Last Edit: Sep 29, 2009, 12:44 pm by mowcius Reason: 1
I think that I would use a serial LCD display and maybe break out a pin below the USB shield to control it.

Out of interest, any reason why you did not make the shield stackable?

Mowcius

felis

Quote
Out of interest, any reason why you did not make the shield stackable?


I can make it - just request stackable headers when buying.
/felis

mowcius

Oh yes, of course it can be stacked doing that... I hadn't thought if that to be honest!

Is there any way that you can stack 2 together? You said that some of the pins are hardwired, I presume that means, only one USB host shield per arduino stack...

Can you use a 4 port hub for example, to control two keyboards for a simple multiplayer game? Any idea of how the hubs work coding wise? Could the chip support it?

Thanks,

Mowcius

Reggie

Have you looked at the ShiftReg LCD lib?  Would free up some pins for you:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1243195750


felis

Quote
Is there any way that you can stack 2 together? You said that some of the pins are hardwired, I presume that means, only one USB host shield per arduino stack...


It is possible to run two. The code needs to be modified and running 2 instances of it would be hard on memory. Using a hub would be better solution.
/felis

felis

Here is the next step - USB keyboard control with character output and LED control. Enjoy!

http://www.circuitsathome.com/mcu/programming/how-to-drive-usb-keyboard-from-arduino
/felis

Go Up