Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: Are all Analog Pins Equal?

  1. #1

    Are all Analog Pins Equal?

    For example:
    On the Teensy 4.1 pin 41 is capable of being used as a digital pin or as analog pin A17. (Two options)
    On the other hand pin 24 can be digital, analog A10, serial TX6, I2C SCL2 and can do PWM. (4 options?)

    Does this mean it is better to use pin 41 for analog input as it has less options and would be faster, or is the speed of the ADC so slow compared to everything else that it doesn't matter?

    Just curious...

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    I don't think one pin is faster for analog than another... That is controlled by the ADC module and options used...

    Also as for one pin more capable than another.. Again hard to say. For example the two pins you mentioned actually have more capabilities, that are not on the Card that ships with the T4.1... Only so much you can put on card and also only so much details before it may start to confuse people.
    From my own excel document you can see there are more functions on both of these pins:
    Click image for larger version. 

Name:	screenshot.jpg 
Views:	38 
Size:	243.0 KB 
ID:	25708
    Things like: 41 is also a GPT1 pin, plus FlexIO, plus Camera Interface...

    So I will typically choose a pin that does not interfere with other functionality I want to use...

  3. #3
    Thanks for your detailed diagram of the pins. Very interesting to see how much is actually going on!

    I have been doing what you suggested and choosing pins based on what has to be used for a particular function first.
    1. Audio connections to shield
    2. I2C for Oled
    3. Analogue for pots
    4. Serial for MIDI
    5. Digital for buttons

    From my measurements of some processes, ADC seems to take more time than other processes so I expect it doesn't matter, as you say. I was just curious to know if some pins are actually busier than others because they have more options they could deal with. What I should do is measure them myself.

  4. #4
    Senior Member
    Join Date
    Jul 2020
    The pin will necessarily be analog multiplexed to the ADC, so no processing delays, just the propagation time of a CMOS
    transmission gate.

  5. #5
    Makes sense. Thanks.

  6. #6
    Senior Member
    Join Date
    May 2015
    Perhaps more interesting to know if there is any noise or other performance advantage of different analog pins.

  7. #7
    Yes that would be worthwhile to know...

  8. #8
    @KurtE, thanks for this useful diagram. Can I suggest a small labeling change? For the PWM columns, where the pin is FlexPWM, your labels are, for example, "1X1", which means FlexPWM module 1, channel X, submodule 1. Would you consider calling this "11X", to reflect the natural order of module, submodule, channel? This would also match the naming convention in cores/Teensy4/pwm.c. I have recently been looking at PWM pins to identify A/B pairs for complementary PWM. Pins 2-3 would be 41A/41B, pins 28-29 would be 31A/31B, and pins 42-47, which are the only ones with 3 pairs from the same FlexPWM module would be 11B/11A, 10B/10A, 12B/12A. Here is the naming from pwm.c

            // FlexPWM1_1_B  42
    	// FlexPWM1_1_A  43
    	// FlexPWM1_0_B  44
    	// FlexPWM1_0_A  45
    	// FlexPWM1_2_B  46
    	// FlexPWM1_2_A  47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts