PDA

View Full Version : Teensy 3.1: number of PGAs is actually 2?



redstone
02-02-2014, 04:43 AM
As far as I can tell, there are two independent PGAs on the Teensy 3.1 chip; if this is true and there are no chip errata in the way, might want to update the technical-specs table here:

http://www.pjrc.com/teensy/teensy31.html

This is relevant for me because I'd like to use both ADCs in differential mode and with PGA enabled on both channels. At first I was a bit worried that this was not possible, or that a single PGA was shared or multiplexed among both ADCs, or something like that. (I haven't yet run an experiment with an actual Teensy 3.1 board to verify.)

See also Figure 3-32 in the reference manual, which seems to clearly show that each ADC has its own PGA.

Thanks!

PaulStoffregen
02-03-2014, 07:19 PM
Yes, you're right, it does say there are 2. I must confess, this is one of the parts of the new chip I haven't tried actually using yet.

Two are also defined in the ADC docs. I've added the register defs on github. They'll be in the next Teensyduino version.

https://github.com/PaulStoffregen/cores/commit/eac28569beb54a36fa088c36d523d5614867d7a7

I've updated the web page too. Thanks for pointing this out.

brianb00
02-03-2014, 09:38 PM
Just to clarify, you are not speaking of an on chip FPGA ? which would be awesome.

PaulStoffregen
02-03-2014, 10:11 PM
Just to clarify, you are not speaking of an on chip FPGA ? which would be awesome.

LOL, that would be awesome. But no, there's no Programmable Gate Array on Teensy.

In this case, PGA means Programmable Gain Amplifier.

Teensy 3.1 has 2 of these special amplifiers. Why I thought there was only 1, I'm not sure. It was a simple error when I made that page in the week before we released version 3.1. There are a LOT of last minute things to do, so it's kind of a miracle I didn't mess up more details on the documentation.

These amplifiers let you measure tiny analog voltages. They're fully differential, so you can read tiny voltages that aren't referenced to ground, as long as they're between 0 to 3.3V. That's useful for certain types of sensors like thermocouples and strain gauges. It might also be able to lets some cheap condenser microphones work, maybe?

Currently there's no support for this in analogRead(), so you'll have to hack the low level code. There's a register to turn the amplifier on, using either a standard mode or a lower power mode where it has slower response, and of course some bits to configure the gain. It can amplify the signal up to 64X. The ADC needs to read one of the other "unused" analog inputs, which is where the amplifier's output connects (all inside the chip), again not currently supported by the analogRead() code, but also pretty easy to hack by just changing a number.

I haven't actually done this yet, so all this is only from reading the documentation. It looks pretty straightforward, but there might be hidden gotchas.