PDA

View Full Version : Embedding Teensy 3 in project - Reset and PGM pins



Legb
11-20-2012, 07:51 PM
Looking at the schematic I see that the on board button effectively takes PGM to GND, well pin 13 (P5.2) on MINI54TAN, while reset is from the ARM processor.

What is the difference between the two pins in terms of bottom line function and in taking a button off to a concealed switch on a carrier board, which pin is to be most effective in the day to day working life of a Teensy in a bespoke application?

I'm aware that the reset over serial bus isn't as implemented by Arduino, I've not had time yet to try testing the function of the two buttons, can anyone give me a heads up on this?

On another front, I use DipTrace as my main PCB CAD package, I've got the Teensy 3 (all pins) and the Teensy 2 (not the ++) as patterns and schematics. PM me with your email address and I'll be more than happy to send them over - please note, if you're using versions before 2.3 the libraries won't work. Oh, and I don't have the 3D models!

Many thanks,
David

JBeale
11-20-2012, 10:09 PM
The pushbutton on the T3 starts the bootloader, which looks for a new program to be downloaded into the board. If your device is not attached to a PC running the Arduino software, that's not what you want. For a standalone application, much more useful is the simple main processor "Reset" for which you would add your own button to short the "Reset" pin (on the short side of the board, next to the corner Pin 13) to ground.

Legb
11-20-2012, 11:10 PM
Many thanks. I was wondering if that was the sort of reason.

Hopefully the main application never gets dropped - otherwise the unit needs to be opened up.

PaulStoffregen
11-21-2012, 12:57 AM
On Teensy 3.0, there are 2 ways to reboot the board. RESET lets you reboot to your program. Power cycling also reboots to your program. PROG lets you reboot to the bootloader mode, where the Mini54 chip takes control of the board.

On Teensy 2.0, these same 2 ways to reboot are present. On 2.0, the only way to reboot to your program is power cycling the board. The 2.0 RST pin does the same as 3.0's PROG pin.

Over the last few years, many people have misunderstood the 2.0's RST pin. They assume there is only one type of reset (even through it's explained on the Getting Started page). Having only 1 RST pin only served to reinforce this wrong assumption. The '32u4 chip has two distinctly different resets, one to the user program and the other to the bootloader.

Several people requested a hardware reset pin which would reboot to their program. It's possible to modify Teensy 2.0, where the voltage on the HWB pin determines which type of reset is done by the RST pin. By default, there's a 1k pulldown resistor to configure RST to reboot to the bootloader. If that pin is connected high instead of low, the RST pin reboots to your application. However, you can't reboot to the bootloader without driving the pin low again. When I designed Teensy 2.0, nearly all other development boards using the '32u4 chip followed Atmel's example using 2 pushbuttons, where you could press them in certain sequences to achieve either type of reboot. I felt that was overly complex and confusing, so I made Teensy 2.0 only have a single reset button. I felt a simpler approach was better. Since Teensy has become well established, pretty much everybody now uses only a single button with the 32u4 and not Atmel's complex 2 button approach.

But the single button approach and HWB pulldown resistor doesn't allow a physical reset pin to reboot to the user application.

While designing Teensy 3.0, I wanted to provide both reset pins. You can reboot either way. Hopefully the fact that 2 pins are available also indicates 2 different reboot mechanisms are implemented?

Legb
11-23-2012, 11:53 PM
Thanks Paul for the detail, I presumed that the documentation on the Teensy3 isn't on the high priority list at the moment.

And yes, having both options gives the best of both worlds.

smartwatch
02-05-2015, 02:59 AM
hello, this is my first post, I am planning to use teensy 3.1 on my smartwatch project, but I want to use in a custom pcb, what is the minimum requirement to make teensy 3.1 work? can I use other devices as bootloader or use the eeprom or flash memory of the mk20 chip?

potatotron
02-05-2015, 03:10 AM
hello, this is my first post, I am planning to use teensy 3.1 on my smartwatch project, but I want to use in a custom pcb, what is the minimum requirement to make teensy 3.1 work?

Here's the schematic for the 3.1

https://www.pjrc.com/teensy/schematic.html

You could leave the USB, Mini54, and USB resistors off the main PCB and make a "programming" daughterboard with those components, that would make the main circuit smaller and lighter (albeit more difficult to update).

If you don't need any analog sensing (or if you don't care about extremely high accuracy for analog, e.g. if you're just using it for an ambient light sensor) you can leave off the ferrites etc. You could also eliminate the LED on pin 13, the fuse, etc.


can I use other devices as bootloader or use the eeprom or flash memory of the mk20 chip?

EEPROM -- yes, no issues.

The rest -- yes, but not without some additional work. Googling "site:pjrc.com <your term here>" will usually get you started; both of those questions have been asked here before.

smartwatch
02-05-2015, 03:14 AM
from the schematic, i only see 16mhz crystal but the teensy 3.1 runs at 72mhz, how could i tell if teensy really runs at 72mhz?

smartwatch
02-05-2015, 03:17 AM
what I am really planning to do is that it is a smart watch but can be taken out from the wrist band and I am planning to build a custom docking station where it will aloow to smartwatch as a normal teensy which means I can reprogram it, and use the rest of the unsued pins to controls other peripheral devices.

potatotron
02-05-2015, 03:20 AM
from the schematic, i only see 16mhz crystal but the teensy 3.1 runs at 72mhz, how could i tell if teensy really runs at 72mhz?

You'll either have to take me at my word or buy one and see for yourself… :)

Or, if you believe everything you read, you can look at Chapter 5 here

http://www.pjrc.com/teensy/K20P64M72SF1RM.pdf

and see how the chip uses a phase-locked loop circuit to multiply the crystal's clock up to the appropriate internal speed.

smartwatch
02-05-2015, 04:12 AM
but can I separate the ministan from the main circuit and perhaps include in the docking station? it would be cool right?

PaulStoffregen
02-05-2015, 04:49 AM
We sell the Mini54 chip, so you can make your own design to suit your own needs. Some people have made it as a separate, disconnectable board, so that is indeed possible.

However, before you begin your own custom design, you should really consider the hidden costs. Bringing up your own hardware, even based on a widely used design, is a task that's much easier said than done. You can find many threads where people made their own board which didn't work at first. Some got them working, others didn't. Small details matter greatly.

If you do go down this custom PCB path, you'll be mostly on your own to resolve any problems. Browsing the many threads on this forum where people made their own boards can give you a feel for the sort of help you can get, and more importantly, the sort of details you'll have to figure out for yourself.

From the very casual nature of your questions so far, I really believe you should not peruse a custom PCB until after you've fully developed a working prototype of your project. You should become very familiar with all the small details BEFORE starting your PCB design.

smartwatch
02-05-2015, 06:10 AM
thank you for this advice, I will defenitely browse other threads to see how others became successful with this.

smartwatch
06-13-2015, 03:04 PM
hellow again, I became busy with other projects, may I ask if you have palns of creating a teensy 3.1 with castlelated, 1.27mm pitch and 0.1mm thick pcb? it will be really nice to have this readily available with square form factor this will be great to include in my project http://gadgetzoneblog.blogspot.com/2015/01/hacking-144-tft-lcd-for-my-smart-watch.html

local_dani_21
06-20-2015, 04:55 PM
Did I get this correctly from the discussion: The best way to reset a teensy 3.1 into the user program is to take RESET to Ground? Too bad it is so hard to reach. Thanks for confirming it. Dani

Frank B
06-20-2015, 05:01 PM
Did I get this correctly from the discussion: The best way to reset a teensy 3.1 into the user program is to take RESET to Ground? Too bad it is so hard to reach. Thanks for confirming it. Dani

May I ask:Why do you want to reset ? Do you have special reason ?

local_dani_21
06-20-2015, 05:44 PM
I have an installation that includes a Raspberry Pi and a Teensy 3.1. They share a power supply. I want to be able to reset the teensy from the outside of the casing without having to cut the power (because the RPi would suffer from a sudden power loss).

Frank B
06-20-2015, 06:00 PM
Ok...and why do want to be able to reset the teensy ?
Normaly, there's no need for that. It's not running windows (hehe).

You can reset it this way with some lines of software (don't know if this is a help, because i still don't know why you need a reset):



#define CPU_RESTART_ADDR (uint32_t *)0xE000ED0C
#define CPU_RESTART_VAL 0x5FA0004
#define CPU_RESTART (*CPU_RESTART_ADDR = CPU_RESTART_VAL)

CPU_RESTART;

local_dani_21
06-20-2015, 08:54 PM
Of course it's not windows but probably even less stable since I've programmed it! I generally find it a good idea to be able to reset a microcontroller - it will probably get stuck where you've expected it the least. Thank you for your code, but I want to be able to reset it by button. As far as I can tell, pulling RESET low resets the teensy well.

Frank B
06-20-2015, 10:08 PM
Of course it's not windows but probably even less stable since I've programmed it! I generally find it a good idea to be able to reset a microcontroller - it will probably get stuck where you've expected it the least. Thank you for your code, but I want to be able to reset it by button. As far as I can tell, pulling RESET low resets the teensy well.

Perhaps a switch in the power-connection (USB-Cable?) to the Teensy would be ok ?
This way you would'nt have to solder the reset-pad.