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

Thread: TimerOne and TimerThree setup pin 0 to output high on Teensy 3.6

  1. #1
    Junior Member
    Join Date
    May 2018
    Posts
    3

    TimerOne and TimerThree setup pin 0 to output high on Teensy 3.6

    Hello world,
    I'm trying to use TimerOne ( TimerThree behaves the same) to trigger an interrupt at a programmable time interval, which works fine.

    The problem is that Serail1 Rx pin 0 is now set to output high, which breaks the serial input of course. disablePwm( 0 ) doesn't seem to have any impact. I had a quick scan through the library files but found nothing that would explain the issue.

    The offending code:

    Timer1.initialize( TIMER1_DELAY_US );
    Timer1.attachInterrupt( isrFunction );
    Timer1.disablePwm( 0 ); // attempt to prevent IO collision with Serial1 Rx

    Thoughts appreciated.

  2. #2
    Senior Member
    Join Date
    Nov 2017
    Location
    Belgium
    Posts
    167
    Have a look at the IntervalTimer lib.
    https://www.pjrc.com/teensy/td_timin...rvalTimer.html

    If I'm not mistaken, TimerOne and TimerThree are for avr microcontrollers.

  3. #3
    Junior Member
    Join Date
    May 2018
    Posts
    3
    Paul has done a great job of documenting it here:

    https://www.pjrc.com/teensy/td_libs_TimerOne.html

    Not to mention it does function, just with the added easter egg mentioned above. That said, I'll try interval timer also, thanks for the suggestion. One thing that wasn't clear in the TimerOne example was whether or not I can set interrupt priorities, tis didn't work:

    NVIC_SetPriority(TC1_IRQn, 1);

    and I couldn't find a vector table to set me straight.

    ***********UPDATE

    I found in the interval timer a reference stating that TimerOne is recommended for Teensy 2.0:

    " For Teensy 2.0 and Teensy++ 2.0, the TimerOne & TimerThree and FlexiTimer2 libraries provide similar capability. "

    Thanks again for the help.
    Last edited by JHamond; 11-01-2019 at 11:45 PM.

Posting Permissions

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