Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB.Init() function looping forever #402

Open
ghost opened this issue Aug 15, 2018 · 21 comments
Open

USB.Init() function looping forever #402

ghost opened this issue Aug 15, 2018 · 21 comments

Comments

@ghost
Copy link

ghost commented Aug 15, 2018

Hi all,

I'm using a Teensy 3.2 along with the USB Host Shield Mini. I installed both the USB_Host_Shield_2.0 library and spi4teensy3 library. I tried running the XBOXUSB example, as I have a wired Xbox 360 controller plugged in the Shield.

This example, aswell as the USB_desc example both get stuck on the USB.Init() line ( https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Xbox/XBOXUSB/XBOXUSB.ino#L23 )
I have also set ENABLE_UHS_DEBUGGING in settings.h to 1 ( https://github.com/felis/USB_Host_Shield_2.0/blob/master/settings.h#L42 )
and
uncommented EXTRADEBUG and PRINTREPORT in XBOXUSB.cpp ( https://github.com/felis/USB_Host_Shield_2.0/blob/master/XBOXUSB.cpp#L20 )
although I'm not sure where this debugging information would be shown? I don't see it show up in the Serial Monitor in the Arduino IDE.

Any help towards resolving this issue would be greatly appreciated. Thanks in advance!

@xxxajk
Copy link
Contributor

xxxajk commented Aug 15, 2018

@ghost
Copy link
Author

ghost commented Aug 15, 2018

Thanks for your reply @xxxajk!
Not sure what you mean by the link tho? Like I said in the first post, I have already set that to 1, but the thing I don't know is where the debugging information would show up? Is it in the Serial Monitor or somewhere else I haven't heard of because nothing shows up in Serial Monitor.

@xxxajk
Copy link
Contributor

xxxajk commented Aug 15, 2018 via email

@xxxajk
Copy link
Contributor

xxxajk commented Aug 15, 2018 via email

@xxxajk
Copy link
Contributor

xxxajk commented Aug 15, 2018 via email

@ghost
Copy link
Author

ghost commented Aug 15, 2018

The VBUS jumper is cut and the pad is connected to the VIN of the Teensy 3.2.
Serial.begin() is called in the setup of the XBOXUSB example...
So I'm not sure where the printing of the debug information is going wrong

@xxxajk
Copy link
Contributor

xxxajk commented Aug 15, 2018 via email

@xxxajk
Copy link
Contributor

xxxajk commented Aug 15, 2018 via email

@ghost
Copy link
Author

ghost commented Aug 15, 2018

https://www.pjrc.com/teensy/schematic32.gif

Vin is directly connected to Vusb on the Teensy 3.2. I checked the Vbus on the Shield and there's 5V on there aswell.

@xxxajk
Copy link
Contributor

xxxajk commented Aug 15, 2018 via email

@ghost
Copy link
Author

ghost commented Aug 15, 2018

The problem is on Line 36 Usb.Init() is called before any tests are actually performed:
https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/board_qc/board_qc.ino#L36

So it just gets stuck on that line. Maybe I selected a wrong option in the "Tools" section of the Arduino IDE? These are my current settings:
https://gyazo.com/d82f35c2cb58a258f0d5b1634b68bcaf

@gdsports
Copy link
Contributor

These kinds of problems are usually wrong wiring. Post a table or diagram of your wiring.

@ghost
Copy link
Author

ghost commented Aug 15, 2018

Hi @gdsports,

I think you just replied to my thread on the PJRC forum (https://forum.pjrc.com/threads/53452-USB-Host-Shield-with-Teensy-3-2). The thing is I have an older Teensy with a preloaded program which uses the exact same wiring and there the xbox controller works without an issue. That's why I doubt it's a wiring issue.

Anything else I might try?

@xxxajk
Copy link
Contributor

xxxajk commented Aug 16, 2018

As I said, try the board QC program.

@ghost
Copy link
Author

ghost commented Aug 16, 2018

@xxxajk

The problem is on Line 36 Usb.Init() is called before any tests are actually performed:
https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/board_qc/board_qc.ino#L36
So it just gets stuck on that line. Maybe I selected a wrong option in the "Tools" section of the Arduino IDE? These are my current settings:
https://gyazo.com/d82f35c2cb58a258f0d5b1634b68bcaf

As I said in an earlier reply. So the output of that program is literally the following:

Circuits At Home 2011
USB Host Shield Quality Control Routine
Reading REVISION register... Die revision

And then it gets stuck on the Usb.Init() function

@xxxajk
Copy link
Contributor

xxxajk commented Aug 16, 2018

https://github.com/felis/USB_Host_Shield_2.0/blob/master/settings.h#L86
try changing that to a zero and see if it works.
If not, then there is a wiring issue, perhaps even that your wires are too long.

@ghost
Copy link
Author

ghost commented Aug 17, 2018

@xxxajk Setting that to zero actually fixed the problem! Not sure why tho but I'm glad it's resolved!

@xxxajk
Copy link
Contributor

xxxajk commented Aug 17, 2018

Probabbly means there is a conflict with the built-in library. As far as I can remember PJRC has made the SPI faster. I'll have to look into this a bit deeper. Glad it is now working for you!

@Lauszus
Copy link
Collaborator

Lauszus commented Jan 6, 2019

@xxxajk is there any reason why USE_SPI4TEENSY3 is still defined to 1 by default? A lot of improvement has happened to the SPI library including transactions etc.

@wiesl
Copy link

wiesl commented May 30, 2019

I had the same issue, but it is a compiler optimization problem (at least in my environment):

NOT OK:

  • Optimize: Faster
  • CPU speed: 24 MHz, 48 MHz, 72MHz, 96MHz (overclock), 120MHz (overclock)

OK:

  • Optimize: Fast
  • CPU speed: 24 MHz, 48 MHz, 72MHz, 96MHz (overclock), 120MHz (overclock)

it works then with the built-in SPI library as well as SPI4TEENSY3

BTW: you can use
#define USE_SPI4TEENSY3 0
to use the build-in library without changing global source code

Versions:

  • Arduino: 1.8.9
  • Teensyduino: 1.46
  • USB Host Shield Library 2.0: 1.3.2
  • spi4teensy3: Latest commit 70a2360 on Aug 14, 2017

Hardware:

  • Teensy 3.2
  • USB Host Shield Mini 1.1

@greguz
Copy link

greguz commented Nov 2, 2019

Same problem here, solved by setting optimize option to fast.

Thank you @wiesl!

Software:

  • Arch Linux
  • Arduino 1.8.5
  • Teensyduino 1.44
  • USB Host Shield Library 2.0: 1.3.2
  • spi4teensy3: Latest commit 70a2360 on Aug 14, 2017

Hardware:

  • Teensy 3.6
  • Marked as UHS mini 2.0 (Chinese clone from eBay)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants