Teensy++ 2.0 vs Teensy 3.1

Status
Not open for further replies.
I am thinking of buying a teensy soon. The Teensy++ 2.0 is costlier than the Teensy 3.1 but the Teensy 3.1 is so much faster and has more memory! Can someone explain why? :confused:
 
I'll speculate: Amazingly, ARM Cortex M3/M4 cost less; I see distributor pricing of $7.50 or so for the K20 256KB vs. 10.50 for the Atmel USB 128K 8 bit. Partly due to competition among dozens of ARM-based vendors. Partly due to age of Atmel's 8 bit and its process, and it's sole-source.
And the PCB for the T2++ is larger.

The Atmel AVC/mega vs. ARM Cortex are really apples-vs-oranges.
 
Last edited:
5v output

I'll speculate: Amazingly, ARM Cortex M3/M4 cost less; I see distributor pricing of $7.50 or so for the K20 256KB vs. 10.50 for the Atmel USB 128K 8 bit. Partly due to competition among dozens of ARM-based vendors. Partly due to age of Atmel's 8 bit and its process, and it's sole-source.
And the PCB for the T2++ is larger.

The Atmel AVC/mega vs. ARM Cortex are really apples-vs-oranges.

On second thought, the Atmel AVC can be programmed using C rather than the Arduino coding which gives access to the timers and other registers easily. But I dont see any info about the timers and registers of teensy 3.1 in pjrc website. Also Teensy 3.1 output voltage is 3.3v. Doesnt that create a problem? Suppose I want to drive using a motor driver. The analogWrite() of 255 value will give only 3.3 v. The motor will run at full speed only on 5v.
 
Motors use more current (amperage) than a microprocessor itself can source. There is always a buffer or transistor switch between the motor and the microprocessor. Given this, the output at 3.3V vs. 5V is unimportant. Some motors like R/C servos use digital pulse width modulation - which is about timing, not current.

The Teensy 3 has many timers and libraries to support it, though the naming may pass by you. For example:
delay(n)
uses a periodic interrupt timer.
the servo and pulse width modulation libraries use timers.
Today, with MCU software libraries, like the Teensy, the hardware details are handled by the library code and you can focus on the application problem, not bit-twiddling in the MCU as we did years back.

But the source code to the libraries is there for you to see, learn, modify, adapt if you wish.
 
Yes, I am talking about PWM input to a motor driver like L293D H bridge IC. It needs 5v on the control lines and PWM controls the motor speed. The current is not sourced by the MCU itself. So How can i change the 3.3v PWM to 5v PWM?
 
I tend to use small PCBs ready to use, rather than IC chips. Less wiring/soldering, etc.
such as
http://www.pololu.com/product/713 $4.95, logic voltatage 2.7 V to 5.5 V
more
http://www.pololu.com/search?query=h+bridge&x=0&y=0

On the general question: how to convert logic levels 3.3V to 5V... it is rare that one needs to do this, by selecting peripherals that are 3.3V compatible, and most modern stuff is. But if you must, there are many ways to do so. Ether DIY with a transistor and resistor, or a chip with multiple converters, or with a small PCB like above that is more plug and play, such as this $1.95 board: https://www.sparkfun.com/products/11978
 
Most people accept that technology becomes less expensive over time as things improve. The process by which that happens involves newer, more capable things replacing older, less capable, more expensive things. Often the new isn't a perfect replacement for the old, despite the fact it's superior. There's usually a pretty long transition, where both are available, so people still depending on the old way can get it. The old version doesn't actually get any cheaper. It slowly becomes obsolete as newer versions offer better performance and people migrate to using it.

Teensy 2.0 & ++2.0 vs Teensy 3.1 is a perfect example.

The AVR chips were mostly designed in the late 1990s and early 2000s. They're some of the last and best 8 bit chips, from the end of an era where everything ran on 5 volts.

Cortex-M is a relatively new processor design, made by ARM within the last 5 years. Freescale introduced these chips to the market only a few years ago. Teensy 3.0 was created right when the first of the lower cost ones became commercially available, in September 2012.

Regarding the timers, you certainly can directly access them in Teensy 3.1 if you really want. That's fairly common practice on AVR and Arduino, partly because the chips have been around for so very long that many people have learned how those timers work (actually, only a subset of their features is really well known - hardly anyone uses the ICP register), and partly because the speed of those AVR chips is so much slower that certain types of projects really need to resort to that type of direct access.

But a huge reason why so many projects directly access the AVR timers is because Arduino never published a timer API for people to access the timers. That's a real shame, because a well designed API could have made accessing timers easier, and made the code more easily portable to other chips.

The vast majority of programs that access the timers directly do so for only 2 reasons: running an interrupt at a regular interval, and changing the PWM frequency and resolution. For Teensy 3.x, I created Arduino extensions to do these. There's IntervalTimer for running interrupts, and analogWriteFrequency() and analogWriteResolution() for control of the PWM waveform. If you're wanting the timer access of those 2 common needs, please save yourself a lot of trouble and use those nice functions.

Usually more advanced timer stuff is done deep within libraries. Just recently I wrote a PulsePosition library that makes extensive use of the Teensy 3.1 FTM0 timer. You could look at PulsePosition.cpp for some idea of how to access the timer hardware directly. In concept, it's pretty much the same as AVR. The chip's documentation explains how the hardware works and has a list of registers you can access to control it. Even on AVR, the timers have a lot of features. On Teensy 3.1, the timers are dramatically more capable, which means there's a LOT more to read and learn to use them. You won't find a lot of writing online about this, because the chip is so new that relatively few people have done so and written about it (or perhaps lived to tell the tale...) Because of IntervalTimer, analogWriteFrequency and analogWriteResolution, probably fewer people will do so (as probably should have happed with Arduino many years ago, but never did, causing so many people to have to dig into the hardware).

If you really want to learn the hardware timers, you certainly can. I might even be able to answer a few questions, since I've written code for all of them, though some features I still haven't used....
 
Most people accept that technology becomes less expensive over time as things improve. The process by which that happens involves newer, more capable things replacing older, less capable, more expensive things. Often the new isn't a perfect replacement for the old, despite the fact it's superior. There's usually a pretty long transition, where both are available, so people still depending on the old way can get it. The old version doesn't actually get any cheaper. It slowly becomes obsolete as newer versions offer better performance and people migrate to using it.

Teensy 2.0 & ++2.0 vs Teensy 3.1 is a perfect example.

The AVR chips were mostly designed in the late 1990s and early 2000s. They're some of the last and best 8 bit chips, from the end of an era where everything ran on 5 volts.

Cortex-M is a relatively new processor design, made by ARM within the last 5 years. Freescale introduced these chips to the market only a few years ago. Teensy 3.0 was created right when the first of the lower cost ones became commercially available, in September 2012.

Regarding the timers, you certainly can directly access them in Teensy 3.1 if you really want. That's fairly common practice on AVR and Arduino, partly because the chips have been around for so very long that many people have learned how those timers work (actually, only a subset of their features is really well known - hardly anyone uses the ICP register), and partly because the speed of those AVR chips is so much slower that certain types of projects really need to resort to that type of direct access.

But a huge reason why so many projects directly access the AVR timers is because Arduino never published a timer API for people to access the timers. That's a real shame, because a well designed API could have made accessing timers easier, and made the code more easily portable to other chips.

The vast majority of programs that access the timers directly do so for only 2 reasons: running an interrupt at a regular interval, and changing the PWM frequency and resolution. For Teensy 3.x, I created Arduino extensions to do these. There's IntervalTimer for running interrupts, and analogWriteFrequency() and analogWriteResolution() for control of the PWM waveform. If you're wanting the timer access of those 2 common needs, please save yourself a lot of trouble and use those nice functions.

Usually more advanced timer stuff is done deep within libraries. Just recently I wrote a PulsePosition library that makes extensive use of the Teensy 3.1 FTM0 timer. You could look at PulsePosition.cpp for some idea of how to access the timer hardware directly. In concept, it's pretty much the same as AVR. The chip's documentation explains how the hardware works and has a list of registers you can access to control it. Even on AVR, the timers have a lot of features. On Teensy 3.1, the timers are dramatically more capable, which means there's a LOT more to read and learn to use them. You won't find a lot of writing online about this, because the chip is so new that relatively few people have done so and written about it (or perhaps lived to tell the tale...) Because of IntervalTimer, analogWriteFrequency and analogWriteResolution, probably fewer people will do so (as probably should have happed with Arduino many years ago, but never did, causing so many people to have to dig into the hardware).

If you really want to learn the hardware timers, you certainly can. I might even be able to answer a few questions, since I've written code for all of them, though some features I still haven't used....

Thanks for the detailed explanation. I am also concerned about the 3.3v pwm. Is the 3.3 pwm enough for controlling motor speed while using motor driver ICs like l293d? Or should I convert it to a 5v pwm using opamps circuits? Or Is the 3.3 v enough to drive the transistors in l293d to saturation and achieve max speed?
 
must you do motor control starting with a chip? versus

http://www.pololu.com/product/713 $4.95, logic voltatage 2.7 V to 5.5 V
more
http://www.pololu.com/search?query=h+bridge&x=0&y=0

Yes I understand, The L293d is basically the same thing. You can just wire it up and it will act like the same module. The logic voltage level is between 2.7v to 5.5v. For speed control I get max speed at 5v and half speed at 2.5v if i am suppying a pwm instead of a HIGH or LOW. But can a 3.3 v pwm can't run the motors at the max rated speed?
 
Yes I understand, The L293d is basically the same thing. You can just wire it up and it will act like the same module. The logic voltage level is between 2.7v to 5.5v. For speed control I get max speed at 5v and half speed at 2.5v if i am suppying a pwm instead of a HIGH or LOW. But can a 3.3 v pwm can't run the motors at the max rated speed?
Yes, you can drive a motor to full speed using 3.3V logic from the Teensy 3/3.1 if your driver's logic level allows 3.3V, as that Pololu board does. It's purely a logic level going into the board, the only thing that matters is the PWM duty cycle because it is a PWM input, not an analog input. You are not dealing with an analog voltage until you get to the output (motor) side of the driver.
 
Last edited:
If you look at this datasheet:

http://www.ti.com/lit/ds/symlink/l293d.pdf

On page 5 near the top is "recommended operating conditions". VIH (High-level input voltage) is specified as 2.3 to VCC1 (which is supposed to be 4.5 to 7 volts). VIL (which is mislabeled output, but it's really Low-level input voltage) is -0.3 to 1.5V.

Pretty much all digital chips are specified this way, with a range that is guaranteed to be recognized as a logic low, and a range that's guaranteed to be seen as logic high. Sometimes, like this chip, it's specific voltages that do not change (probably because the detection is based on base-emitter junctions within the chip), other times it's a ratio of whatever the power supply voltage is (usually because the input circuit is a CMOS gate where the threshold is due to the ratio of transconductance in the 2 different types of mosfet transistors inside the chip). The point is virtually all digital electronic parts have these VIL and VIH specs that tell you what voltage ranges the chip is guaranteed to work for logic low and logic high.

For this chip, if you put a voltage between 1.5 to 2.3 volts at the input, it's anybody's guess whether it will see a logic high or low.

Teensy 3.1 will output very close to zero volts for a logic low, and 3.3 volts for logic high. So this L293D can receive the signal very well.

Some other parts have specs like VIH = VCC*0.7. For 5V, that would mean at least 3.5 volts is needed. For a part like that, a buffer like 74HCT245 (with VIH = 2.0) is needed to convert to a signal the part can recognize.

So, TL;DR = yet, it'll work. But since you've asked, these VIL and VIH specs published by the chip manufacturer are the way you check when voltage range a part needs on its logic inputs.
 
Status
Not open for further replies.
Back
Top