I am pleased to announce that the first ARM processor is now supported by the USB Host library. It is the Teensy 3.0 which features an 32 bit Cortex-M4 ARM processor running at up to 96MHz. This is a huge increase in speed if you are used to the Arduino Uno running at 16MHz.
The Teensy 3.0 is created by the Paul Stoffregen which is also a dedicated contributor to the Arduino IDE. If you are looking for a ARM based board for your next project, I recommend taking a look at the Teensy 3.0. A more detailed overview can be found at the official page.
To use the Teensy 3.0 with the library I recommend using the Mini variant of the USB Host Shield as it is much more compact and a bit cheaper too. Since the Teensy 3.0 is running at 3.3V no logic conversion is needed.
Note it is very important than you do not connect a 5V microcontroller to the Mini variant of the USB Host Shield, as this might damage the board. If you are planning to use a 5V microcontroller like the Arduino Uno I recommend getting the full sized version of the shield.
In order to use the Teensy 3.0 you will need to connect the Teensy 3.0 to the USB Host shield like so:
USB Host Shield | Teensy 3.0 |
---|---|
RESET | 3.3V |
GND | GND |
INT | 9 |
SS | 10 |
MOSI | 11 |
MISO | 12 |
SCK | 13 |
3.3V | 3.3V |
GND | GND |
The images to the right shows both the pinout for the Teensy 3.0 as well as the Mini USB Host Shield.
Furthermore I recommend cutting the VBUS jumper and then soldering a wire from the provided pad on the USB Host shield. This wire can then be connected to the VIN on the Teensy 3.0. The USB Host shield will then get powered directly from the same USB port as the Teensy 3.0 and the VBUS will be 5V as required by most devices – note that you might need a separate 5V regulator depending on which device you are using with the shield, as it might draw too much current.
More information about how to modify the shield can be found at the hardware manual.
Also take a look at the guide for the other Teensy boards, as the wiring is almost the identical.
Hopefully this is just the first of many ARM based boards that is going to be supported by the USB Host shield library.
If you got any questions or comments, then feel free to write a comment below and I will answer as fast as possible.
Update
Both the Teensy 3.1 and Arduino Due is now also supported by the library.
This is fantastic! I actually needed this for a project of my own and was looking into converting the libraries a couple weeks before this came together, but was a bit discouraged by the sheer volume of code.
Thank you. Yes the code might seem a bit overwhelming at first ๐
Adapter board design is done. It works for me, and a DYI version will be published on this thread.
Is there a way to change the interrupt and SS pins?
Yes, you can change them here: https://github.com/felis/USB_Host_Shield_2.0/blob/41f9979a25c38a7a994f456425e9574f297c3a98/UsbCore.h#L18-L28.
Note that things work even faster when using spi4teensy3, written by me.
SPI runs at the fastest speed that the max chip can take, and no longer becomes the bottleneck. It is available
here
With good media attached (I tested A Lexor 2GB Premium 80x CF), you can get some really nice speeds.
Is it possible to use the Mini USB Host Shield with an Arduino Uno? My Arduino Pro Micro fizzled out on me and I want to try using the shield with my Uno. Is it possible?
No. You need to level shift all logic signals or use full-size shield.
Since a couple level shifters are a bit cheaper than a full shield, I think I’ll give it a shot. I just want to confirm all the channels that will need to be shifted. MOSI, MISO, SCK, SS(10), INT(9), correct? I’d power the board with the 3.3V pin, connect RAW to the 5V in case my VBUS needs 5V for a device, and obviously connect grounds. Does that sound right? Is there anything else that I will need to ensure compatibility?
Thanks for your help.
Take a look at the schematic for the full size shield: http://www.circuitsathome.com/wp/wp-content/uploads/2011/02/UHS_20.pdf. There you can see what needs to be level shiftet. Anyway reset needs to be level shiftet as well.
Ok. So I level shifted pins 9 through 13 and the “reset” pin from my arduino uno down to 3.3V and connected them to the usb host shield mini.
The usb host mini only uses pins 9, 10, SCK, MISO, MOSI, and reset correct?
Are any of the remaining through-holes on the perimeter necessary?
Also, do i connect the “reset” pin on my uno to the “reset” pin on the usb host shield mini?
Yes both reset pins should be connected together via the level shifter ๐
When I connect the reset pins via the level shifter, the arduino uno behaves as if the reset button on the board is continuously held down. the โLโ LED is constant yellow and the board cannot be reset via the button. What might be going wrong? the board resets as soon as i disconnect the pins.
Iโm using the serial monitor at 57600 baud to try and see activity, but there is only gibberish.
Thanks for your help.
Also, the comment reply feature is a bit buggy. Couldn’t reply to your latest comment.
Try to connect a pullup resistor to the reset pin. Also make sure that you have connected the Arduino reset pin to an input on the level shifter and not an output.
Adding the pullup resistor fixed the reset problem. Now the board_qc sketch is throwing this error message.
Any idea what may be causing this error?
Here is a diagram of my circuit.
http://i.imgur.com/922DySR.png
Whoops. I made a mistake in the other image that I posted.
Here is the accurate diagram of my circuit.
http://i.imgur.com/Fm3Lxxk.png
If wires are long you may have issues with noise. Try to make them shorter, especially SCK.
The jumper wires are only 10cm long. I don’t think I can cut them any shorter. I ordered a full size shield last week, so hopefully that one will operate correctly.
I’ve been trying to use the Teensy 3.0 with the example xbox controller code and it is not playing nice at all. I’ve been able to get the code to run using an Arduino Pro Mini, but I need it to run a bit faster. I’m really not an object oriented programming guy so some of this is over my head. Has anyone gotten the xbox controller working with the Teensy 3.0?
Are you talking about the wired or wireless example?
I have used a wireless controller just fine. Remember that you might need to connect 5V to the VBUS.
Great news, that library is compatible with cortex family uCPU. I was wander how difficult it would be to port a library on tha maple (stm32F103RB) ? Have anyone already tried?
I have a wired AfterGlow Xbox 360 controller (blue looks really cool). The VID is the same as the MadCatz controller, but the PID is 0xF900 which is the only change I’ve made to the code. The controller is receiving a constant 5V and I checked the line for droops just in case I was not supplying enough current, but it’s fine. Code works great with the Pro Mini, but locks up on the Teensy. I get a few characters out on the serial port and then it just stops. My guess was that I messed something up in the library so I did a fresh install of arduino and the Teensy software as well as the USB Host Lib and same behavior. Know what’s going on?
Hmm that is strange. Have you got any other device you could test it with? For instance a USB mouse or keyboard?
Ran the keyboard example and it worked just fine. Probed it with an digital oscilloscope with an SPI decoder and the communication looks fine. It’s definitely not a hardware issue. I don’t have the wireless receiver for the wireless xbox controller otherwise I would just test that.
Figured it out! I did yet another clean install and this time installed none of the teensy libraries and it worked the first try! Not sure where the conflict is or why it’s not working with those libraries installed. I was able to replicate the problem by installing the extra libraries.
Okay. If you can figure out which of the Teensy libraries that is causing the problem, then it would be great. Then I will contact Paul and hopefully he will fix it for the next release.
Hi
Very nice, thank you!
I’m trying to connect a 3G dongle that needs to be USB mode switched. When powered up, the dongle will declare itself as a mass storage device (containing the Windows software). It must be USB mode switched to become a modem device.
For more info see:
http://www.draisberghof.de/usb_modeswitch/
I looked at the way this is done in Linux, analysing usb_modeswitch.c and the required setting for my modem, which I think can be determined by looking at the device reference file.
It seems that in the case of my modem the mode switch is “simply” initiated by sending one raw bulk message to the first bulk output endpoint (find_first_bulk_output_endpoint).
I tried to mimik this, using USB_desc as a starting point. I got this output from the original sketch:
01
--
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 12D1
Product ID: 1446
Revision ID: 0000
Mfg.string index: 03
Prod.string index: 02
Serial number index: 00
Number of conf.: 01
Configuration descriptor:
Total length: 0037
Num.intf: 02
Conf.value: 01
Conf.string: 01
Attr.: E0
Max.pwr: FA
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 02
Intf. Class: 08
Intf. Subclass: 06
Intf. Protocol: 50
Intf.string: 00
Endpoint descriptor:
Endpoint address: 81
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 01
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Interface descriptor:
Intf.number: 01
Alt.: 00
Endpoints: 02
Intf. Class: 08
Intf. Subclass: 06
Intf. Protocol: 50
Intf.string: 00
Endpoint descriptor:
Endpoint address: 02
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 82
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Addr:1(0.0.1)
Taking the Vendor/Product code and looking at the device reference file I got the follwing match:
########################################################
# Huawei E270+ (HSPA+ modem)
# Huawei E1762
# Huawei E1820
#
# Contributor: Paranoid Paranoia
DefaultVendor= 0x12d1
DefaultProduct= 0x1446
TargetVendor= 0x12d1
TargetProduct= 0x14ac
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
Taking the first bulk output endpoint which according to USB_desc is at address 01 and the above MessageContent I inserted the following code to the USB_desc loop:
Usb.ForEachUsbDevice(&PrintAllDescriptors);
Usb.ForEachUsbDevice(&PrintAllAddresses);
// ok now modeswitch
// http://www.draisberghof.de/usb_modeswitch/device_reference.txt
// MessageContent="55534243123456780000000000000011060000000000000000000000000000"
uint8_t msg[] = { 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
Serial.print("\r\nswitching mode - sending msg of length ");
Serial.println(sizeof(msg));
uint8_t ret = Usb.outTransfer(0x01, 0x01, sizeof(msg), msg);
Serial.print("Usb.outTransfer() returned ");
Serial.println(ret, HEX);
delay(1000);
Serial.println("\r\nprobing again");
Usb.ForEachUsbDevice(&PrintAllDescriptors);
Usb.ForEachUsbDevice(&PrintAllAddresses);
while( 1 ); //stop
However, I got 0xDB (USB_ERROR_EP_NOT_FOUND_IN_TBL) as a return value. So I guess I misunderstand the meaning and usage of the device and/or end point address (or some setting up is required?).
I tried several different things.
Address 0x00, endpoint 0x00 sets up the adress OK but returns 0x0D (hrJERR) on outTransfer.
Address 0x01, endpoint 0x00 sets up the adress OK but returns 0x04 (hrNAK) on outTransfer.
I tried to find documentation and to understand other code before posting this. If I missed something obvious, please point me there.
I found the following post that suggests it should work with microcontrollers (but no code available):
http://myjowen.blogspot.ch/2012/11/getting-tplink-ma180-to-work-on.html
This poster has a similar problem:
http://forum.arduino.cc/index.php/topic,146603.0.html
Thank you for all your help.
– Mark
USB Desc doesn’t configure a device; generally, a device must be in a configured state to answer requests on non-zero endpoints. I suggest experimenting with Andrew’s mass storage code instead (look in xxxajk branch).
Hi
I finally got around to implement your suggestion. Thank you!
Short recap: I’d like to run these inexpensive 3G/4G modem dongles on a Teensy 3.1 (see initial post).
I created a USBModeSwitch class with the sole purpose to switch the device over as described in my original post. This seems to work. After sending the message, the device is automatically released and a new device presents itself including an interface of class 0A (CDC).
01
--
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: EF
Device Subclass: 02
Device Protocol: 01
Max.packet size: 40
Vendor ID: 12D1
Product ID: 1436
Revision ID: 0000
Mfg.string index: 04
Prod.string index: 03
Serial number index: 00
Number of conf.: 01
Configuration descriptor:
Total length: 00C9
Num.intf: 07
Conf.value: 01
Conf.string: 02
Attr.: E0
Max.pwr: FA
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 03
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 81
Attr.: 03
Max.pkt size: 0040
Polling interval: 05
Endpoint descriptor:
Endpoint address: 82
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 01
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Unknown descriptor:
Length: 08
Type: 0B
Contents: 0102020000000904
Interface descriptor:
Intf.number: 01
Alt.: 00
Endpoints: 01
Intf. Class: 02
Intf. Subclass: 06
Intf. Protocol: FF
Intf.string: 00
Unknown descriptor:
Length: 05
Type: 24
Contents: 0010010D24
Unknown descriptor:
Length: 0D
Type: 24
Contents: 0F010000000000060100000524
Unknown descriptor:
Length: 05
Type: 24
Contents: 0601020705
Endpoint descriptor:
Endpoint address: 83
Attr.: 03
Max.pkt size: 0040
Polling interval: 05
Interface descriptor:
Intf.number: 02
Alt.: 00
Endpoints: 02
Intf. Class: 0A
Intf. Subclass: 00
Intf. Protocol: 00
Intf.string: 00
Endpoint descriptor:
Endpoint address: 84
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 02
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 03
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 85
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 03
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 04
Alt.: 00
Endpoints: 02
Intf. Class: FF
Intf. Subclass: FF
Intf. Protocol: FF
Intf.string: 00
Endpoint descriptor:
Endpoint address: 86
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Endpoint descriptor:
Endpoint address: 04
Attr.: 02
Max.pkt size: 0040
Polling interval: 20
Interface descriptor:
Intf.number: 05
Alt.: 00
Endpoints: 02
Intf. Class: 08
Intf. Subclass: 06
Intf. Protocol: 50
Intf.string: 00
Endpoint descriptor:
Endpoint address: 87
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 05
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Interface descriptor:
Intf.number: 06
Alt.: 00
Endpoints: 02
Intf. Class: 08
Intf. Subclass: 06
Intf. Protocol: 50
Intf.string: 00
Endpoint descriptor:
Endpoint address: 06
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Endpoint descriptor:
Endpoint address: 88
Attr.: 02
Max.pkt size: 0040
Polling interval: 00
Next I tried to include the cdcacm class to talk to the modem. However the interface has only two endpoints (in/out), no interrupt endpoint. There seem to be no explicit references to ACM::epInterruptInIndex in the code, however I don’t yet understand how the USB/MAX3421e classes work internally.
Nevertheless I temporarily modified ACM::Init to be happy without the interrupt endpoint. Now the ACM initializes but it immediately runs into a hrSTALL error on SetLineCoding() and hrBUSY errors when I remove that.
The Linux usb_modeswitch.c includes calls to
SHOW_PROGRESS(output,"Reset response endpoint 0x%02x\n", ResponseEndpoint);
ret = libusb_clear_halt(devh, ResponseEndpoint);
if (ret)
SHOW_PROGRESS(output," Could not reset endpoint (probably harmless): %d\n", ret);
SHOW_PROGRESS(output,"Reset message endpoint 0x%02x\n", MessageEndpoint);
ret = libusb_clear_halt(devh, MessageEndpoint);
if (ret)
SHOW_PROGRESS(output," Could not reset endpoint (probably harmless): %d\n", ret);
which I tried to translate using
// clear halt
rcode = pUsb->ctrlReq(bAddress, epInfo[ epDataInIndex ].epAddr, USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_STANDARD,
USB_REQUEST_CLEAR_FEATURE, USB_FEATURE_ENDPOINT_HALT, 0x0000, 0x0000, 0x0000, 0x000, NULL, NULL);
Serial.print("pUsb->ctrlReq(in) clear halt returned ");
Serial.println(rcode, HEX);
// clear halt
rcode = pUsb->ctrlReq(bAddress, epInfo[ epDataOutIndex ].epAddr, USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_STANDARD,
USB_REQUEST_CLEAR_FEATURE, USB_FEATURE_ENDPOINT_HALT, 0x0000, 0x0000, 0x0000, 0x000, NULL, NULL);
Serial.print("pUsb->ctrlReq(out) clear halt returned ");
Serial.println(rcode, HEX);
but to no avail.
Now I’m stuck. Any suggestions?
I’d be glad to contribute the code, once it’s finished.
Thank you for all the good work and your help.
-Mark
Try to post this in the issue tracker here -> https://github.com/felis/USB_Host_Shield_2.0/issues .
Is Teensy 3.1 supported also? Thanks
Yes it is.
Yes !! I have Teensy 3.1 matched up with your “Mini”
USB host shield. And it all seems to be working fine,
with a USB keyboard plugged into your board.
VERY VERY nice to see it operating as intended.
BUT of course I have a question: I am using your
USBHIDBootKbd sketch to prove the hardware
lashup is working OK. But this sketch is complex,
and hard for an Arduino neophyte like myself to
understand and modify easily.
What I really want to do is extremely simple: Just
cause the Teensy to light a red LED if I type an ‘r’
on the attached USB keyboard, and a green LED
if I type a ‘g’. Very simple.
Is there an existing example sketch that is more
appropriate for a beginner like me to modify for this
simple operation? Something more straightforward
than USBHIDBootKbd (which I don’t really understand
at all) ?
you need to modify this method -> https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino#L91 . It gets called when a key is pressed. A ‘key’ parameter contains ASCII code of the key being pressed. Just check if it were ‘r’ or ‘g’ and do what needs to be done. I can’t think of a simpler way.
Simply add the following in top of the USBHIDBootKbd code:
Then add this to the KbdRptParser class:
And then modify OnKeyPressed like so:
This should allow you to control the pins.
Lauszus, Looks good ! Thanks very much.
I will get to work on it.
Cheers – Bob Nelson
I have just uploaded to my github area the needed bits to allow you to use the storage part of the library in an unobtrusive way on the teensy 3.0 and 3.1. This is done by using my xmem2 memory management library, and provides you with ISR safe libc memory management, aka malloc/free/new/delete, etc.
At present the preemptive multitasking of XMEM2 is not available on the Teensy 3.x products, or any other micro-controller that lacks banked memory at this time. This is because the IntervalTimer class for the Teensy 3.x is just perfect for polled tasks, such as what is used in the UHS library.
Right now the only module available is xmemUSBFS. More will be written as time permits. Please consider contributing extra modules, even if they only work on the Teensy 3.x, or the AVR micro-controllers with the extra memory. I’ll be happy to complete them to support the board you don’t have.
You will need the following libraries to take advantage of this and the upcoming ‘modules’:
https://github.com/xxxajk/spi4teensy3 This gives you the high speed you want on SPI!
https://github.com/xxxajk/RTClib This is to support timestamps on the filesystem, even if you lack an RTC on the i2c buss, it will use the one on the Freescale chip…
https://github.com/xxxajk/generic_storage This is for the FAT filesystem.
https://github.com/xxxajk/xmem2 This is for memory management.
https://github.com/xxxajk/xmemUSB This is to place USB out of your way, behind the scenes so you don’t have to think about it!
https://github.com/xxxajk/xmemUSBFS Ditto for the FAT filesystem
Unfortunately the Arduino IDE does not allow you to do any manual defines for a build, so you will need https://github.com/xxxajk/Arduino_Makefile_master so you can compile everything with the correct options.
Hi, I noticed that Teensy 3.1 has USB-OTG support–can one use the USB Host Library on it without the usb host shield?
No this is not supported.
I finally got USBhost to work ! Great product. Now here is my problem – I am interfacing to a Hokoyu LIDAR over USB. I need to send a command to turn scaning on then I can just receive data every 28ms. I used the acm-terminal example as a starting point and it works quite well – but – When I power up the LIDAR and the Arduino MEGA2560, the LIDAR does not turn on when the start command is sent. Even when it is sent every 10s in a loop. However if I press the reset button on the USB host shield, the command goes through immediatly and the the LIDAR starts up and I can receive data just fine. I built a circuit using a teensy3.1 and the mini USB host shield. Same problem. If I upload the program to the teensy long after the LIDAR is powered sometimes it will start scanning. The reset seems to always work but this is not an elegant solution. Any ideas on what might be going on ? What exactly does the reset button do ? Does it only reset the shield or also the arduino ? Is that the same on the mini ? It seems like the shield is not sending out the start commmand after power up but somehow magically does it after reset.
Hi
Thank you, I think I found the problem. The modem is a multiport device. It exposes three cdc interfaces. The first one is the “normal” one (as used under Linux) but the other two seem to generate some diagnostic output from time to time. When they “babble” I need to clear/halt the endpoint to prevent hrSTALL / hrBUSY errors.
I solved this by just blindly issuing clear/halts to these endpoints in Poll(). I borrowed and extended the ClearEpHalt() code from massstorage.
Is this the correct way? Or is there some way to get notified when an endpoint is pent-up?
It seems to work for now, albeit with heavy SPI traffic of course. Will not be a problem in my app but might be in others.
Next problem: ppp. Will try to port LwIP to Teensy 3.x.
Will post code as soon as possible.
Sorry the above post should be a reply to this.
-Mark
Trying to add support for the Digispark Pro. I am a neewbie.
First thing trying to tackle is avrpins.h. How do I know what the value the board name will be?
I am also assuming that the pin names are defined based on the digispark pinout diagram available here.
http://digispark.s3.amazonaws.com/DigisparkProDiagram2.png
Hi, Iยดm trying to use the USB HOST SHIELD with my Teensy 3.1, but I get this error message when compiling:
Arduino: 1.6.3 (Linux), TD: 1.22, Board: “Teensy 3.1, Serial, 72 MHz optimized, US English”
In file included from /home/raziel/arduino-1.6.3/libraries/USB_Host_Shield/Usb.h:36:0,
from /home/raziel/arduino-1.6.3/libraries/USB_Host_Shield/usbhub.h:20,
from board_qc.ino:6:
/home/raziel/arduino-1.6.3/libraries/USB_Host_Shield/usbhost.h: In member function ‘uint8_t MAX3421e::regRd(uint8_t)’:
/home/raziel/arduino-1.6.3/libraries/USB_Host_Shield/usbhost.h:257:9: error: ‘SPI’ was not declared in this scope
SPI.transfer(reg);
^
Error compiling.
This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
can someone help me pls?
You need to include the SPI library in your .ino file because of a bug in the Arduino IDE. Please see: https://github.com/felis/USB_Host_Shield_2.0#boards.
Thank you for your fast response! I have downloaded the spi4teensy3.h library and included it. My header looks like this:
I do not know what this Hack should do, because I do not have such a folder. Anyway the error message from above is with spi4teensy3.h and the header below!
Please help!
#ifdef dobogusinclude
#include
#include // Hack to use the SPI library
#include // Hack to use the SPI library
#endif
I can’t see your include statements, as they got deleted. Please see the examples: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3BT/PS3BT.ino#L11-L14 on how to include both libraries.
Also please see the guide from Adafruit: https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use.
Hi, is there any way to use the Teensy 3.1 with the USB-Host Shield 2.0 library and the small USB-Host shield with the following pinout:
Teensy3.1 port – function
14-SCK
15-SS
12-MISO
11-MOSI
8-INT
Simply modify the following lines: https://github.com/felis/USB_Host_Shield_2.0/blob/5db356282f44121689097805391d23ebfaa35aa9/UsbCore.h#L43 and https://github.com/felis/USB_Host_Shield_2.0/blob/5db356282f44121689097805391d23ebfaa35aa9/usbhost.h#L95. Also set: https://github.com/felis/USB_Host_Shield_2.0/blob/5db356282f44121689097805391d23ebfaa35aa9/settings.h#L71 to 0.
You will also need to do change SCK from 13 to 14. Please see: https://www.pjrc.com/teensy/td_libs_SPI.html#altpins.
Thank you very much!
Hi Lauszus, sorry to bother you again. I was able to sucessfully run the board_qc sketch with Teensy 3.1 and USB-Host Shield Nano, but when I try to run PS3BT I always get the error “OSC did not start”. Do I have to uncomment a line in avrpins.h?
What is the output when you run board_qc?
Here is my board_qc output and again, I used different pins for every SPI pin as mentioned above!
Circuits At Home 2011
USB Host Shield Quality Control Routine
Reading REVISION register… Die revision 03
SPI long test. Transfers 1MB of data. Each dot is 64K……………. SPI long test passed
GPIO test. Connect GPIN0 to GPOUT7, GPIN1 to GPOUT6, and so on
Test failed. Value written: 00 Value read: FF
Press any key to continue…
GPIO test passed.
PLL test. 100 chip resets will be performed
Resetting oscillator
Reset number 0 Time to stabilize – 1391 cycles
Reset number 1 Time to stabilize – 1391 cycles
Reset number 2 Time to stabilize – 1391 cycles
Reset number 3 Time to stabilize – 1391 cycles
Reset number 4 Time to stabilize – 1391 cycles
Reset number 5 Time to stabilize – 1391 cycles
Reset number 6 Time to stabilize – 1390 cycles
Reset number 7 Time to stabilize – 1388 cycles
Reset number 8 Time to stabilize – 1392 cycles
Reset number 9 Time to stabilize – 1392 cycles
Reset number 10 Time to stabilize – 1390 cycles
Reset number 11 Time to stabilize – 1390 cycles
Reset number 12 Time to stabilize – 1391 cycles
Reset number 13 Time to stabilize – 1392 cycles
Reset number 14 Time to stabilize – 1391 cycles
Reset number 15 Time to stabilize – 1390 cycles
Reset number 16 Time to stabilize – 1391 cycles
Reset number 17 Time to stabilize – 1391 cycles
Reset number 18 Time to stabilize – 1391 cycles
Reset number 19 Time to stabilize – 1389 cycles
Reset number 20 Time to stabilize – 1390 cycles
Reset number 21 Time to stabilize – 1392 cycles
Reset number 22 Time to stabilize – 1392 cycles
Reset number 23 Time to stabilize – 1391 cycles
Reset number 24 Time to stabilize – 1389 cycles
Reset number 25 Time to stabilize – 1390 cycles
Reset number 26 Time to stabilize – 1391 cycles
Reset number 27 Time to stabilize – 1391 cycles
Reset number 28 Time to stabilize – 1392 cycles
Reset number 29 Time to stabilize – 1389 cycles
Reset number 30 Time to stabilize – 1391 cycles
Reset number 31 Time to stabilize – 1391 cycles
Reset number 32 Time to stabilize – 1392 cycles
Reset number 33 Time to stabilize – 1390 cycles
Reset number 34 Time to stabilize – 1391 cycles
Reset number 35 Time to stabilize – 1392 cycles
Reset number 36 Time to stabilize – 1391 cycles
Reset number 37 Time to stabilize – 1391 cycles
Reset number 38 Time to stabilize – 1390 cycles
Reset number 39 Time to stabilize – 1391 cycles
Reset number 40 Time to stabilize – 1392 cycles
Reset number 41 Time to stabilize – 1392 cycles
Reset number 42 Time to stabilize – 1391 cycles
Reset number 43 Time to stabilize – 1390 cycles
Reset number 44 Time to stabilize – 1391 cycles
Reset number 45 Time to stabilize – 1392 cycles
Reset number 46 Time to stabilize – 1391 cycles
Reset number 47 Time to stabilize – 1391 cycles
Reset number 48 Time to stabilize – 1393 cycles
Reset number 49 Time to stabilize – 1391 cycles
Reset number 50 Time to stabilize – 1391 cycles
Reset number 51 Time to stabilize – 1390 cycles
Reset number 52 Time to stabilize – 1390 cycles
Reset number 53 Time to stabilize – 1391 cycles
Reset number 54 Time to stabilize – 1392 cycles
Reset number 55 Time to stabilize – 1391 cycles
Reset number 56 Time to stabilize – 1390 cycles
Reset number 57 Time to stabilize – 1390 cycles
Reset number 58 Time to stabilize – 1391 cycles
Reset number 59 Time to stabilize – 1391 cycles
Reset number 60 Time to stabilize – 1393 cycles
Reset number 61 Time to stabilize – 1391 cycles
Reset number 62 Time to stabilize – 1391 cycles
Reset number 63 Time to stabilize – 1391 cycles
Reset number 64 Time to stabilize – 1391 cycles
Reset number 65 Time to stabilize – 1390 cycles
Reset number 66 Time to stabilize – 1389 cycles
Reset number 67 Time to stabilize – 1392 cycles
Reset number 68 Time to stabilize – 1391 cycles
Reset number 69 Time to stabilize – 1391 cycles
Reset number 70 Time to stabilize – 1389 cycles
Reset number 71 Time to stabilize – 1391 cycles
Reset number 72 Time to stabilize – 1392 cycles
Reset number 73 Time to stabilize – 1392 cycles
Reset number 74 Time to stabilize – 1391 cycles
Reset number 75 Time to stabilize – 1389 cycles
Reset number 76 Time to stabilize – 1391 cycles
Reset number 77 Time to stabilize – 1391 cycles
Reset number 78 Time to stabilize – 1391 cycles
Reset number 79 Time to stabilize – 1390 cycles
Reset number 80 Time to stabilize – 1392 cycles
Reset number 81 Time to stabilize – 1391 cycles
Reset number 82 Time to stabilize – 1391 cycles
Reset number 83 Time to stabilize – 1390 cycles
Reset number 84 Time to stabilize – 1390 cycles
Reset number 85 Time to stabilize – 1391 cycles
Reset number 86 Time to stabilize – 1393 cycles
Reset number 87 Time to stabilize – 1393 cycles
Reset number 88 Time to stabilize – 1390 cycles
Reset number 89 Time to stabilize – 1390 cycles
Reset number 90 Time to stabilize – 1391 cycles
Reset number 91 Time to stabilize – 1392 cycles
Reset number 92 Time to stabilize – 1391 cycles
Reset number 93 Time to stabilize – 1391 cycles
Reset number 94 Time to stabilize – 1392 cycles
Reset number 95 Time to stabilize – 1391 cycles
Reset number 96 Time to stabilize – 1391 cycles
Reset number 97 Time to stabilize – 1390 cycles
Reset number 98 Time to stabilize – 1390 cycles
Reset number 99 Time to stabilize – 1391 cycles
Checking USB device communication.
Waiting for device…
Reset complete. Waiting for the first SOF…
Getting device descriptor
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: E0
Device Subclass: 01
Device Protocol: 01
Max.packet size: 40
Vendor ID: 0A12
Product ID: 0001
Revision ID: 5276
Mfg.string index: 00
Prod.string index: 00
Serial number index: 00
Number of conf.: 01
All tests passed. Press RESET to restart test
BTW, the USB device of the test is my Bluetooth stick
Okay if that works, then I see no reason why PS3BT wouldn’t even initialize?
๐
Is it possible to program a pro mini with this host shield? If so, how do I do it? I feel like this is a dumb question but I can’t seem to find anyway to do it. When I put the arduino and shield together then plug it into my computer, it receives power but the computer does not even know it is there.
Have you installed the necessary drivers needed? Also make sure that you are using the 3.3V version of the Pro Mini.
I am new to the pro mini but i did install all the drivers on my pc and it is a 3.3v arduino. Do i need to use the 6 pins on the side in order to program it or should it work by just using the shield on the arduino? Also, i have tried to plug it in to differnt computers and all of them give it power but it isnt recognized.
This is not the right place to ask questions about how to use Arduino. I would recommend that you ask at the official Arduino forum: http://forum.arduino.cc/.
@Chad-
You can NOT program the Arduino Pro Mini ‘through’ the USB Host (mini) Shield..
You need to connect the wires/cable [+v/GND/RX/TX] directly to the board itself.
I’m trying to get this work and I’m wondering how any of you got this working with 3.3V since it’ll be sending that 3.3V to USB as well when it should be 5V. So it needs dual voltage (reference design has built-in 3.3V regulator).
Has someone got this really working with just 3.3V? I’m trying with Teensy 3.2 @ 3.3V and so far I’ve gotten the USB-lib init okay but no USB device gets recognized. I haven’t debug more when I noticed that the Voltage to USB was only 3.3V
Okay, reading again that description it actually says to do the modification that I was planning on doing.
Hi,
I’m currently working on a project that needs to use a USB magnetic card reader for a access point and I was hoping that your shield would be of use.I know what you’re probably thinking and rightfully so but this is for a legitimate use.Lets face it there are enough how to write ups around on using non USB readers to accomplish nefarious things if that was my goal.
With that said,is there existing code for a USB reader that works as HID device?Ideally I’d like to be able to go with Bluetooth but that is later on as right now I just need a working example.Would you be willing to help with the code?I’d be buying 12-15 shields min for my demo prototype and making a donation to the site wouldn’t be a issue.Lastly my goal isn’t in the hardware end of things but it is a hurdle I need to overcome and any help is greatly appreciated.
Thanks Robert
It will properly just show up as a usb to serial adapter. Please run the following example: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/USB_desc/USB_desc.ino and post the output.
Note that I am not the owner of this site. If you want to hire me, then please email me at: kristianl@tkjelectronics.dk.
Hello
Any USB wifi dongle are supported ? and which ones ?
Any USB 2 High speed Hub ?
Any rtos to stream I2C/SPI…. data to usb wifi ?
Br
Jp
Unfortunately USB Wifi is not supported.
USB Hub?
Are there any reference designs to using this to making a USB hub?
I’m hoping to make a fancy hub with some data logging capabilities with the total number of bytes sent and received and average and max bytes per second.
Is the USB Host Shield suitable for this?
@Lauszus Is the teensy 3.2 supported yet? I see the 3.1 is, and it should be drop in, but I just wanted to make sure before I beat my head too much. I cannot get my shield to work with Teensy 3.2, but it works great with an UNO. I will say, I’m using the same shield, so I had to take advantage of the solder pads provided so I could run directly off of 3.3 without the level translaters, and I’m just started to look at the SPI signals, which don’t look great.
Anyways, like is said, before i continue to debug this, is the Teensy 3.2 supported and tested?
Thanks,
Josh
The only difference between the Teensy 3.1 and 3.2 is just a more powerful 3.3V regulator: https://www.pjrc.com/teensy/teensy31.html, so yes the Teensy 3.2 is supported.