LC refuses to program

Status
Not open for further replies.

snerk4000

New member
when i built this project originally, i could do updates fine. for some reason after it's sat for a month, the LC now REFUSES to be programmed. it gets 10% erased, download error. it erases, gets 40% programmed, download error. i've tried making a sketch that is literally only delay(1000); and still it just fails and gives me a download error.

nothing has changed about the hardware, except that i now have it opened up to get at the program / reset button, which is not doing anything, it just returns the loader to a picture of the board and sits there.


at this point the only way i can figure to fix this is to just throw it in the garbage and start over with teensy 2.0s; apparently saving $10 on two boards wasn't worth it, i've used dozens and dozens of 2.0s and never had this happen, ever.

WHY

HELP :(

teensy LC
mac os 10.12.5
arduino 1.8.9
teensy 1.46



Code:
int b1 = 19;
int b2 = 20;
int b3 = 21;
int b4 = 22;
int b5 = 23;

int dbd = 100; //debounce delay
int postdl = 20;



void setup() {
  // Serial.begin(9600);

  pinMode(b1, INPUT_PULLUP);
  pinMode(b2, INPUT_PULLUP);
  pinMode(b3, INPUT_PULLUP);
  pinMode(b4, INPUT_PULLUP);
  pinMode(b5, INPUT_PULLUP);
}

void loop() {
  if (digitalRead(b1) == LOW) {
    usbMIDI.sendNoteOn(1, 127, 1);
    delay(dbd);
    while (digitalRead(b1) == LOW) {
      delay(postdl);
    }
    usbMIDI.sendNoteOff(1, 0, 1);
  }

  if (digitalRead(b2) == LOW) {
    usbMIDI.sendNoteOn(2, 127, 1);
    delay(dbd);
    while (digitalRead(b2) == LOW) {
      delay(postdl);
    }
    usbMIDI.sendNoteOff(2, 0, 1);
  }

  if (digitalRead(b3) == LOW) {
    usbMIDI.sendNoteOn(3, 127, 1);
    delay(dbd);
    while (digitalRead(b3) == LOW) {
      delay(postdl);
    }
    usbMIDI.sendNoteOff(3, 0, 1);
  }

  if (digitalRead(b4) == LOW) {
    usbMIDI.sendNoteOn(4, 127, 1);
    delay(dbd);
    while (digitalRead(b4) == LOW) {
      delay(postdl);
    }
    usbMIDI.sendNoteOff(4, 0, 1);
  }

  if (digitalRead(b5) == LOW) {
    usbMIDI.sendNoteOn(5, 127, 1);
    delay(dbd);
    while (digitalRead(b5) == LOW) {
      delay(postdl);
    }
    usbMIDI.sendNoteOff(5, 0, 1);
  }



}  // loop
 

Most likely causes are poor quality power or a bad USB cable. Could also be circuitry connected to the Teensy is messing things up in unexpected ways (usually when this happens, it's power related issues).

Could also be a "strange" problem entirely on your PC, like some other software interfering in some way. Recommend trying with a different computer and a different USB cable.

If possible, best to completely disconnect Teensy from all other circuits and if the VIN-VUSB pads were cut apart, join them with a bead of solder for the sake of testing with only a USB cable and no other wires connected.
 
… two boards
...

Sounds like there is a second Teensy LC at hand. Is there a cable and simple sketch as noted that can upload to that T_LC? If so then unplug that T_LC and plug into the second T_LC while holding its Button - when connected release the button and that should result in the same code being uploaded to the second T_LC.

Trying that after checking the issues raised by Paul might result in success as long as the computer and cable are good, and the Teensy LC hasn't experienced any trauma including voltage over 3.3V applied to any pin but the Vin pin.
 
yes there's two boards, its a set of 5 buttons with a shared ground to send identical midi signals to two computers at once. they're all grounded together and the button pins just get split to both boards running the same code.

as of now i've stripped everything off it, tried all the micro usb cables i can find in my house, nothing. always a download error. time to bin it and start over.
 
shared ground
Is at least one of the computers a laptop running off a battery?

You see, it is very easy for a computers connected to grounded outlets to have a slightly different ground potentials. When you then connect devices to both computers, you get a ground loop, where the ground wires may carry significant current, and cause glitches or even break things.

With Teensy 2, 2++, 3.0, 3.1, 3.2, and LC, you can avoid this by using an USB isolator per Teensy. Cheap ADuM3160 -based ones off eBay work fine; they're direct implementations of the Analog Devices' application notes. (The manual switch on them chooses between 1.5 Mbits/s and 12 Mbits/s operation.) I have this one, but there are eBay sellers that sell the same thing for a bit cheaper; 7€ - 9€ is the expected price range. Olimex sells one that has an additional DC power jack (8V to 15V input) and regulator that provides up to 700mA of current at 5V for the Teensy side (an option, if you want the Teensies to be powered up even when the computers are not). Other companies sell other versions, but all the max. 12 Mbit/s ones are basically the same circuit, based on ADuM3160 or ADuM4160 and an isolated DC-DC converter. That DC-DC converter is the main difference, so the amount of current available on the Teensy side varies.

Isolating the Teensies from their respective computers means the Teensies can share their ground without risk of ground loops.

Another approach is to use buttons with more than one circuit; for two teensies, DPST or DPDT (look for e.g. "momentary DPST push button" or "momentary DPDT push button"; the DPDT have 6 pins, DPST 4 pins). Then, each button closes two completely separate circuits, just as if you'd pushed two buttons at the same time, and the Teensies do not need to have a shared ground at all. Personally, I'd prefer this approach.

Full disclosure: I've mentioned USB isolators here and elsewhere a number of times, but I do so only because I've managed to break stuff because of ground loops. I'm pretty good at breaking stuff via stupid goofs, actually, so I might be a bit paranoid here. So consider my advice to be coming from an uncle bumblefrig, to borrow an AvE-ism.
 
Another approach is to use buttons with more than one circuit; for two teensies, DPST or DPDT


yeah, if DPDT pushbuttons existed in a small enough form factor for this i'd be using them, they just don't exist. about all you can get to is SPDT. (currently using marquardt 6425, and i have a bunch of e switch 5501s sitting around but, same problem.)

isolators would be fine if they came in DIY PCB style so they could fit into the box, but i can't seem to find that either and this is intended to be user friendly / plug and play, not "also make sure this 2" long dongle is hanging off the usb cord".
 
Status
Not open for further replies.
Back
Top