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

Thread: T4: are there particular pins that are preferred for accurate hw edge timing?

  1. #1
    Junior Member
    Join Date
    Jul 2018

    T4: are there particular pins that are preferred for accurate hw edge timing?

    I'm porting a 3.6 project that used capacitive touch input to t4; hardware-wise, I'm happy to switch to a 2 pin arrangement as used by the old Capacitive Touch library by paul, with a drive output pin thru big resistor and a sense input pin.

    however that code seems to use an interrupts-disabled busy loop to time how long it takes for the sense pin to transition. since I'm hoping to run a fairly heavy audio handler, im contemplating if i can use hardware to help do the timing instead of busy looping

    I noticed the teensy freqcounter library specifies a particular pin to use, but doesnt yet list anything for t4. I'm assuming it's using some timer peripheral to make the pin stop the count. would that be a good strategy on t4? does it need particular pins?

    alternatively, i guess i could set up an interrupt on edges of more or less any digital pin, tho i was worried about isr latency especially if the audio library leaves interrupts disabled for long ish periods... i have a hunch that's a non starter.

    any advice on which-t4-peripheral-can-help-very-accurate-pin-state-transitions-while-audio-lib-is-busy gratefully received. if, following advice, i manage to make something work id be more than happy to share the code here. thanks!

  2. #2
    Senior Member
    Join Date
    Oct 2012
    Portland OR
    I don't know the general answer to your question but I do know on Teensy 4 the FreqMeasure input is pin 22, hopefully the FreqMeasure page gets updated soon given that each Teensy model is different.

Posting Permissions

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