Program Mode through code

Status
Not open for further replies.
Program Mode through code Teensy 2.0 ++

Hi there!
I need to know if It is possible to enter on programing Mode without pressing the button on the Teensy 2.0 ++

I need this because I completed my proyect (MIDI pedalboard) and I want to close the hardware with the Teensy inside. But then, If I need to modify the code I Will need to disamble the hardware in order to have access to the Teensy.

My idea was if possible, with a combination of buttons, or with a long press on a button, enter on the program Mode of Teensy.

Thanks in advance, I Hope I explained myself well.

Regards!
 
Last edited:
What Teensy? For the 1062 based T_4's I see this:
Code:
			Serial.print( "Bootloader !!!\n" );
			delay(10);
			asm("bkpt #251");
 
ALso, there is a pin for that. The code does only work, if the Teensy does not crash. If it crashes before, or in setup() that's a bit difficult. I'd use the pin in any case, and if it's as backup only..
 
I see Mcu32...

I Will investigate about your solution.
The only issue is that I can not add more buttons to the case I create for the project.

Thanks.
 
Ah you are using the old AVR model. ok that one has different rules the newer 32-bit teensies.

The AVR boards don't got a dedicated programming mode. On power-up/reset the bootloader will wait for about 1 second to see if a programmer wants to give them data, if not they move on and start running your code. So assuming the IDE truly cannot remotely reset the chip itself (it normally ought to) you would need to manually time it. Telling the programmer to start and then reset the AVR. If you have exposed the Reset button than you are already set (having a reset button is rarely a bad practice)


Now if adamant there is a trick used to software restart an ATMega. that is:
Code:
void(* resetFunc) (void) = 0;
Calling "resetFunc();" then causes it to start over, but it only restarts the User code and does not clear any registers. it does also not tell the AVR to enter the bootloader as for that you need to know where the Bootloader begins and idk where that is is on the T2++. if you do find out you could replace the 0 by the bootloader's starting address.

You could also restart via hardware by sending a LOW signal out of a digital output to the reset pin, but this isn't considered proper without a little circuit that could make sure it is a proper lasting pulse.
 
Thanks for your time Foxhood...

I think I understood your explanations.

Just one questuion, when you say "So assuming the IDE truly cannot remotely reset the chip itself (it normally ought to)", you mean that the Arduino IDE should be able to modify the code inside the Teensy without pressing the "Program button"? Because in my case it is impossible to do it without doing it.
 
Look for the _reboot_Teensyduino_() function. In the core library folder, pay attention to the folder name so you're looking at the version for Teensy++ 2.0. The implementation is very different on each generation of Teensy.

Or to be able to call it from Arduino code, add near the top of your program.

Code:
extern "C" void _reboot_Teensyduino_(void);
 
Status
Not open for further replies.
Back
Top