Custom Teensy starting up problem

Status
Not open for further replies.

ElkinDiaz

Member
Hi PJRC Team,

First of all I would like to mention that I find the Teensy project a very competitive solution for develop arduino projects. I have used teensy 3.2 for many projects, and I found a need to implement a "Custom Teensy", for a project that requires adding multiple components and reducing the final weight. I tried to do it by using using the MKL04 chip with pre-programmed Teensy LC & 3.2 bootloader, and following many reference circuits I found on the web.

My PCB actually is recognized by the PC, and allows me to program the blink example. However, when I restart my PCB, it does not do anything. The only way to get the led blink firmware to run again is to press the PROGRAM button, and connect USB cable to computer. I need the PCB to be programmed once, then I don't need more to connect any computer, I understand that the MKL04 task is to load the HEX and interface the Arduino software, but:

Does it program the firmware everytime it restarts?
Is it possible to program this once and leave unconnected the USB for future restarts?

Thanks,
 
Hi PJRC Team,

First of all I would like to mention that I find the Teensy project a very competitive solution for develop arduino projects. I have used teensy 3.2 for many projects, and I found a need to implement a "Custom Teensy", for a project that requires adding multiple components and reducing the final weight. I tried to do it by using using the MKL04 chip with pre-programmed Teensy LC & 3.2 bootloader, and following many reference circuits I found on the web.

My PCB actually is recognized by the PC, and allows me to program the blink example. However, when I restart my PCB, it does not do anything. The only way to get the led blink firmware to run again is to press the PROGRAM button, and connect USB cable to computer. I need the PCB to be programmed once, then I don't need more to connect any computer, I understand that the MKL04 task is to load the HEX and interface the Arduino software, but:

Does it program the firmware everytime it restarts?
Is it possible to program this once and leave unconnected the USB for future restarts?

Thanks,

No, the MKL04 facilitates only that the MK20 downloads the program and writes it to flash. After power-on without button pressed (prog button pin low) , program starts from flash.

There must be something wrong with your PCB concerning power-on.
A schematic will help others that are more expert to pinpoint the issue.
 
Thanks for the reply WMXZ,

I attach here the schematics.

View attachment 9657

I found strange that the Teensy loads well the arduino sketch, but when I restart it, is missing anything, and only start running the arduino sketch when I press the PROG and connect the PC.
 
Hi Paul,

In the Teensy 3.x schematics I find there are two nets named as VBAT, the external pin VBAT, and also the internal pin 21 of the Kinetis called VBAT. I have disconnected the external pin from the 3.3V, but I understand from the circuit that the diode allows internally to connect the pin 21 VBAT. Do I need to connect the external PIN VBAT also to the 3.3V?

Thank you for your help,
 
Also, try adding a lengthy delay at the beginning of your code.

We've seen this question many times, where you believe Teensy isn't running your program, because it works after you upload from Arduino but fails when you cold boot. It's easy to assume Teensy didn't retain your program.

Teensy does indeed retain your program. Time and time again when this question comes up, it's almost always due to poor programming. The most common cause is initializing some piece of hardware immediately, and not checking if it actually worked. Many other devices take time to boot up. Teensy starts up very quickly. Most Arduino boards have a lengthy startup delay, so the Arduino world is filled with libraries that don't properly wait for startup times or check if the hardware they're using as fully started.

Most of these problems were "solved" about a year ago by the addition of a 400 ms startup delay deep within Teensy's code.

But perhaps you have some other hardware that needs more than 0.4 seconds? Or maybe there's some other condition where the hardware works after the board has been powered up for some time, but not right at cold boot.

The best thing you can do is put some LED blinks or hardware serial output from a pin very early in your program. Then you can see it is indeed running. You're troubleshooting both code and bringing up new hardware at the same time, which is extremely tough. It's entirely possible this isn't what's wrong... I'm just blind guessing from what you've said and problems we've seen many times before, without any idea what your hardware really is.
 
You only need 3.3V power at the VBAT pin on the Kinetis chip.

A common PCB design mistake leaves that pin unconnected. In that case, you board is able to upload code, but then is crashes during startup when the code tries to init the RTC hardware.
 
The Teensy runs the code, and it looks that it retain the code, because I am using the simple /* LED Blink, Teensyduino Tutorial #1, however when I restart it, I found that the only way to see the LED blinking is by pressing the PROGRAM button, and then connecting the USB cable to the PC, (not loading again the sketch, only connection), then it start blinking the LED.

However, it is clear from your answers that the Teensy should retain the .hex in the Kinetis Flash memory, and it should work as I need it to work.

I will review everything, and mount another PCB to discard any problem with this.
 
Hi Paul,

I had a problem with my external source, it was giving a little overvoltage at start, I changed it and now it works.

Thanks for your fast support.

Regards.
 
Status
Not open for further replies.
Back
Top