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

Thread: how to pick ports for analogRead () on T3.2

  1. #1

    how to pick ports for analogRead () on T3.2

    I remember reading here a while ago that depending on pin assignment, analog reads can take place either serially or in parallel.
    I'm currently reading 2 analog sources, but it's possible that 1 or 2 more will be added as last minute features continue to cree-eep in....

    What would be the best assignment for 2, 3, or 4 ports? I can use any port from A1 to A9. The other analog ports are either NC or used for something else.

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,627
    Since the T3.2 has 2 internal ADCs which can be routed from different input pins, you can do a maximum simultaneous reading of only 2 pins. Reading more signals is possible, but it would need fast switching between different input pins. This can basically be done at high speed, so that the readings will appear pseudo-simultaneous, using DMA to store the actual reading away, using the DMA interrupt to reconfigure the ADC input channel and to trigger the next reading.

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,535
    It also may depend on how you are reading the analog pins. That is if you are calling analogRead it does not return until that analog reading has completed.

    If however you are using some other code like: the ADC library, than you have more control. More details about that library in the thread:
    https://forum.pjrc.com/threads/25532...for-Teensy-3-1
    And if you can choose two analog pins where one is on ADC0 and the other on ADC1, you can have booth of them reading at the same time.

  4. #4
    Senior Member Epyon's Avatar
    Join Date
    Apr 2013
    Location
    Belgium
    Posts
    443
    I spread my analog channels over the two ADCs. E.g. if I use two channels, I make sure each one is on a different ADC. I do use analogRead, but if I ever find some time to upgrade my software with the ADC lib, at least the PCB routing doesn't prevent me from using simultaneous reads.

  5. #5
    Thanks, I got it. Pedvide's drawing shows how the pins are hooked up. Apparently, all but two pins (A2, A3) I can use can be read only with ADC0.

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,535
    Yes if you are restricted to only use the outer pins than A2/A3 are the only ones available on ADC1. Some other easy to use pins (A10, A11, A13) can also be used... And of course there are some on the bottom pins as well...

  7. #7
    Junior Member
    Join Date
    Jul 2014
    Location
    Currently NorCalif
    Posts
    18
    Hi Guys:
    It has been a long time since I have posted to this forum, I hope you can see this question.
    Is there a table or chart somewhere that shows which Analog Pins can be read from each A/D converter? I'm using A10 and A11 and I am not 100% certain which pin will work with ADC0 or ADC1.

    Thanks,
    Ed

  8. #8
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,535
    There is pretty good information talked about in the ADC thread, which was mentioned in #3 above
    https://forum.pjrc.com/threads/25532...for-Teensy-3-1

    Look at the sort of marked up Technical card in that thread. I believe it shows the data for A10/11 on the backside of the card

  9. #9
    Junior Member
    Join Date
    Jul 2014
    Location
    Currently NorCalif
    Posts
    18
    Kurt:
    Thanks,

    Ed

  10. #10
    Quote Originally Posted by KurtE View Post
    Yes if you are restricted to only use the outer pins than A2/A3 are the only ones available on ADC1. Some other easy to use pins (A10, A11, A13) can also be used... And of course there are some on the bottom pins as well...
    Currently, the only pins we use are those on the perimeter. We might incorporate the 4 through hole pins into the next rev, but I highly doubt we'll use the other bottom pins anytime soon.

Posting Permissions

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