Teensy 3.6 Not Responding

Lukef

Member
Hey everyone,

So earlier today I had my teensy 3.6 plugged into my computer with two joystick and 4 buttons attached to it with joy.cpl open. All the buttons and joysticks worked correctly. Although now when I plug it in to the computer nothing happens. The computer doesn't even see the Teensy in joy.cpl or anywhere else for that matter. I am wondering if maybe there is someway to reset the teensy or something like that to get it back to how it was when I bought it? The code that is on it right now is as follows (mostly comes from the joystick example from teensyduino, but with some edits to match my needs).

Thanks,
Luke


Code:
/* Complete USB Joystick Example
   Teensy becomes a USB joystick with 16 or 32 buttons and 6 axis input

   You must select Joystick from the "Tools > USB Type" menu

   Pushbuttons should be connected between the digital pins and ground.
   Potentiometers should be connected to analog inputs 0 to 5.

   This example code is in the public domain.
*/

// Configure the number of buttons.  Be careful not
// to use a pin for both a digital button and analog
// axis.  The pullup resistor will interfere with
// the analog voltage.
const int numButtons = 4;  // 16 for Teensy, 32 for Teensy++

void setup() {
  // you can print to the serial monitor while the joystick is active!
  Serial.begin(9600);
  // configure the joystick to manual send mode.  This gives precise
  // control over when the computer receives updates, but it does
  // require you to manually call Joystick.send_now().
  Joystick.useManualSend(true);
  for (int i=0; i<numButtons; i++) {
    pinMode(i, INPUT_PULLDOWN);
  }
  Serial.println("Begin Complete Joystick Test");
}

byte allButtons[numButtons];
byte prevButtons[numButtons];
int angle=0;

void loop() {
  // read 6 analog inputs and use them for the joystick axis
  Joystick.X(analogRead(1));
  Joystick.Y(analogRead(2));
  Joystick.Z(analogRead(3));
  Joystick.Zrotate(analogRead(4));
  //Joystick.sliderLeft(analogRead(0));
  //Joystick.sliderRight(analogRead(1));
  //Joystick.button(1, !digitalRead(0));
  //Joystick.button(2, !digitalRead(1));
  
  // read digital pins and use them for the buttons
  for (int i=0; i<numButtons; i++) {
    if (digitalRead(i)) {
      // when a pin reads high, the button is not pressed
      // the pullup resistor creates the "on" signal
      allButtons[i] = 1;
    } else {
      // when a pin reads low, the button is connecting to ground.
      allButtons[i] = 0;
    }
    Joystick.button(i + 1, allButtons[i]);
  }

pinMode(2, INPUT_PULLDOWN);
pinMode(3, INPUT_PULLDOWN);
pinMode(4, INPUT_PULLDOWN);
pinMode(5, INPUT_PULLDOWN);

  // make the hat switch stay in the center position
 // angle = angle + 1;
 // if (angle >= 360) angle = 0;
 // Joystick.hat(-1);
  
  // Because setup configured the Joystick manual send,
  // the computer does not see any of the changes yet.
  // This send_now() transmits everything all at once.
  Joystick.send_now();
  
  // check to see if any button changed since last time
  boolean anyChange = false;
  for (int i=0; i<numButtons; i++) {
    if (allButtons[i] != prevButtons[i]) anyChange = true;
    prevButtons[i] = allButtons[i];
  }
  
  // if any button changed, print them to the serial monitor
  if (anyChange) {
    Serial.print("Buttons: ");
    for (int i=0; i<numButtons; i++) {
      Serial.print(allButtons[i], DEC);
    }
    Serial.println();
  }
  
  // a brief delay, so this runs "only" 200 times per second
  delay(5);
}
 
Oh, and I haven't changed any code since this morning. Only thing I did was move some buttons around to different pins but that wouldn't make a difference. I also plugged it into a power source and checked with a multimeter to see if there was even any power going into the Teensy and there was power. Everything worked as it should, just the computer didn't see it. Tried three different computers, win10, win10, and win7, but no change between them.

Thanks,
Luke
 
May have bad code taking the Teensy into the weeds and USB offline - or compiled without USB? What happens when you push the Program button? Once connected - or while plugging it in then releasing it afterwards?
 
defragster,

I tried pressing the program button when it was plugged in, and also plugging in while pressing but nothing happens. Is there no way to reset the teensy? For example a certain combination of pressing the program button or something like that?

Luke
 
Well, that process and then reprogramming it with the LED blink example *is* the way to return your Teensy to its original condition.

If this isn't working, sadly it's a strong sign something may have gone horribly wrong causing damage to the hardware. We also see all kinda of problems that turn out to be USB cables, hubs, or other random issues, so even if those worked before don't take them for granted. Also, if you're using Windows, always cold reboot. Windows 10 is improved, but older versions are very brittle.

There's a couple quick sanity checks you can do on the hardware. The first is measuring the 3.3V power. The second is watching the voltage on Program and Reset when you press the button. Both of those should be 3.3V, and both should go low (zero or very close to zero volts) while the hold the button. Program basically just checks if the button is working. Reset responding means the MKL02 chip is alive.
 
Paul,

Thank you for the info. We tried multiple different cables, cold reboot, different computers/OS including Android, then also checked the 3.3V power and push button as well as the Program and Reset pins. P and R pins were not reacting as they were supposed to, so this leads us to believe that there is a hardware malfunction. We just ordered another Teensy (3.2 this time as the 3.6 was way more that we actually needed) so will have to continue our project when that arrives tomorrow.

Thank you everyone for your help, I really appreciate it!
Luke
 
Back
Top