SPI Digipot, Speed of Teensy vs Arduino Uno

Status
Not open for further replies.

chipaudette

Well-known member
I'm getting ready to use a SPI-bus digital potentiometer (AD5260) in a synthesizer hack. I figured that I'd prototype it first using an Arduino Uno to drive the digipot. The Uno was able to drive it at a rate of just over 60 kHz. Not bad...

http://synthhacker.blogspot.com/2015/10/surface-mount-digipot-with-arduino-uno.html

But then I swapped out the Uno and substituted a Teensy 3.1. Now I can get an update of over 700 kHz! Wow!

http://synthhacker.blogspot.com/2015/10/teensy-with-ad5260-digipot.html

What I find really interesting is that the apparent speed ratio here is ~12x. But, the ratio of the clock of the Teensy (96 MHz) vs Uno (16 MHz) is only 6x. Therefore, for this application, it appears that the ARM processor in the Teensy is also quite a bit more efficient per clock cycle than the AVR processor in the Uno. I think that's really interesting.

Does anyone else have direct comparisons of the speed of an Uno to the Teensy?

Chip
 
I'm getting ready to use a SPI-bus digital potentiometer (AD5260) in a synthesizer hack. I figured that I'd prototype it first using an Arduino Uno to drive the digipot. The Uno was able to drive it at a rate of just over 60 kHz. Not bad...

http://synthhacker.blogspot.com/2015/10/surface-mount-digipot-with-arduino-uno.html

But then I swapped out the Uno and substituted a Teensy 3.1. Now I can get an update of over 700 kHz! Wow!

http://synthhacker.blogspot.com/2015/10/teensy-with-ad5260-digipot.html

What I find really interesting is that the apparent speed ratio here is ~12x. But, the ratio of the clock of the Teensy (96 MHz) vs Uno (16 MHz) is only 6x. Therefore, for this application, it appears that the ARM processor in the Teensy is also quite a bit more efficient per clock cycle than the AVR processor in the Uno. I think that's really interesting.

Does anyone else have direct comparisons of the speed of an Uno to the Teensy?

Chip


I think this case is depended on the SPI-interface.
I don't know your sourcode, but did you use the SPI-FIFO ? If not, you could get even more speed. And if you want even more, switch to 120MHz, which enables 30MHz SPI.

The Cortex-ARM core is very fast, too. Most instructions are 1 Cycle, and it has a "Barrel-shifter", which means that shift-operations are 1-cycle too. It's long years ago, but if remember correctly, the AVR needs 1 cycle per BIT.
Then last but not least, ARM is 32BIT architecture. AVR 8 Bit.
 
Wow all that and it costs less too! I was assuming SPI might be part of it - it just includes SPI.H in the code I glanced at? Plus the more efficient 32 bit processor.

I was wondering how close to the middle the LC would get?
 
For this particular program, the printing to Serial is probably limiting the overall speed.

A fairer comparison would test Teensy vs Arduino Leonardo, because both have native USB. Teensy will still be dramatically faster, due to the faster SPI clock, more efficient USB, and of course the faster 32 bit processor. Many of my core library functions also have more optimization work than Arduino's, so you could expect a Teensy 2.0 to beat Arduino Leonardo on this test, even though both run the same AVR hardware at the same clock speed. But Arduino Uno is hobbled by it's slow 115200 baud serial rate, so it can't keep up. Native USB always transfers as fast as the USB will allow (which you may find does also depend on whatever software runs on the PC side... you might measure faster speed with CoolTerm displaying the results than you get with the Arduino Serial Monitor).

Teensy LC will probably perform quite well on this test. Teensy 3.1 will use 16 MHz SPI, but Teensy LC will have to use 12 MHz, so expect a 25% decrease. Other than that minor detail, they'll probably run about the same, since they have nearly identical USB. The slower Cortex-M0+ processor performs quite well for this type of fairly simple code. Complex math is where Cortex-M4 really shines.
 
Last edited:
Thanks for looking!

I agree that those lines slow down the code quite a bit. For my "max speed" tests, I had commented out the println() and the delay() lines. I'm sorry if that wasn't clear in my post (I said it explicitly in my Uno post, but not in my Teensy post).

Chip
 
Status
Not open for further replies.
Back
Top