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

Thread: Teensy Compiler Issue

  1. #1
    Junior Member
    Join Date
    Feb 2016
    Posts
    6

    Teensy Compiler Issue

    I am not sure but there may be a bug in the compiler for Teensy 3.2

    I've been working on a project and I need high and low voltages with 1 sec in between. I know LED is connected to pin 13 in Teensy 3.2 and I use that pin
    in the code to apply HIGH and LOW using Arduino IDE's APIs. It works perfectly fine for the first I try that. Then I set pin 11 to be low and high and that's my problem begins.

    Pin continues blink even though pin is set to be 11. When I change pin to be 13 again LED stops blinking. After this point it is always pin 11 in the code that makes the LED connected to pin 13 blink.

    I think there is something wrong with compiler. It acts as if it is Teensy 2.x even though everything is set for Teensy 3.x

    Any thoughts?

  2. #2
    Hard to tell without the code...

    And IDE version, plus Teensyduino version...

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,082
    Quote Originally Posted by zurach View Post
    I am not sure but there may be a bug in the compiler
    That's extremely unlikely. Not impossible, but you must post code that reproduces the problem either way. (eg, the "Forum Rule") If your code is long and complex, please try to reduce it to the smallest and simplest way to reproduce the problem.

  4. #4
    Junior Member
    Join Date
    Feb 2016
    Posts
    6
    Arduino version is 1.6.7
    I am using last version of TeensyDuo

    The code is as follows,

    /* LED Blink, Teensyduino Tutorial #1
    http://www.pjrc.com/teensy/tutorial.html

    This example code is in the public domain.
    */

    // Teensy 2.0 has the LED on pin 11
    // Teensy++ 2.0 has the LED on pin 6
    // Teensy 3.0 has the LED on pin 13
    const int ledPin = 11;

    // the setup() method runs once, when the sketch starts

    void setup() {
    // initialize the digital pin as an output.
    pinMode(ledPin, OUTPUT);
    }

    // the loop() methor runs over and over again,
    // as long as the board has power

    void loop() {
    digitalWrite(ledPin, HIGH); // set the LED on
    delay(1000); // wait for a second
    digitalWrite(ledPin, LOW); // set the LED off
    delay(1000); // wait for a second
    }

    I only changed ledPin variable to be 13 first then 11 again. After that point only when ledPin variable is set to 11 LED on Teensy blinks.

  5. #5
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,665
    Quote Originally Posted by zurach View Post
    Arduino version is 1.6.7
    I am using last version of TeensyDuo

    The code is as follows,

    /* LED Blink, Teensyduino Tutorial #1
    http://www.pjrc.com/teensy/tutorial.html

    This example code is in the public domain.
    */

    // Teensy 2.0 has the LED on pin 11
    // Teensy++ 2.0 has the LED on pin 6
    // Teensy 3.0 has the LED on pin 13
    const int ledPin = 11;

    // the setup() method runs once, when the sketch starts

    void setup() {
    // initialize the digital pin as an output.
    pinMode(ledPin, OUTPUT);
    }

    // the loop() methor runs over and over again,
    // as long as the board has power

    void loop() {
    digitalWrite(ledPin, HIGH); // set the LED on
    delay(1000); // wait for a second
    digitalWrite(ledPin, LOW); // set the LED off
    delay(1000); // wait for a second
    }

    I only changed ledPin variable to be 13 first then 11 again. After that point only when ledPin variable is set to 11 LED on Teensy blinks.
    Cannot confirm your observation:
    my T3.2 only blinks when ledPin is set to 13.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,082
    I just tested here. Unable to reproduce the problem.


  7. #7
    Junior Member
    Join Date
    Feb 2016
    Posts
    6
    I ask once again just to make sure. Did you set ledPin to be 13 first, then 11 then again 13. It normally works. It doesn't work if you follow this order, 13, 11, 13.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,082
    I don't understand your question. The code you posted doesn't do anything like this. It only uses pin 11.

    Maybe you mean editing the code and uploading 3 times? But really, that's a guess. I just don't understand exactly what you mean. But I'm pretty sure there's no compiler bug here.

    If you want me to look at this again, you have to be extremely clear and highly specific about the exact steps to reproduce the problem. Think down to every last keystroke & mouse click style clarity. That may see excessive, but consider the context... supposedly a compiler bug while with one of the simplest and most widely used sketches! Tens of thousands of people have compiled and run this sketch. People edit pin numbers all the time. If you really have found a bug, it must be so extremely rare that only a very specific set of steps reproduce it.
    Last edited by PaulStoffregen; 03-02-2016 at 01:37 AM.

  9. #9
    Junior Member
    Join Date
    Feb 2016
    Posts
    6
    Okay to be more clear, just compile and upload the program when const int ledPin is set to 13. It works. Then set ledPin variable to 11 and compile and load on teensy again. Then again set ledPin variable to 13 once more, compile it and load to teensy and see what happens.

    Thanks for trying to understand what I try to explain,

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,082
    Ok, simple. Just did the 3 uploads (using 13, then 11, then 13). Everything seems to work fine.

    Maybe you could try again and keep a close eye on the Teensy Loader window during each upload. If your PC is having some sort of USB communication issue, perhaps Teensy isn't getting reprogrammed?

  11. #11
    Junior Member
    Join Date
    Feb 2016
    Posts
    6
    No, it gets programmed each time. I know because after the operations I told you above, the led only blinks when the ledPin variable is set to 11 as if program is written for 2.x. My teensy is already soldered on a circuit whereas you try your program on a standalone teensy. Maybe the physical state of the circuit causes the problem. I will have to prove it somehow. I will record a video as soon as possible. That's the only way to show what's going on. My problem is real. Teensy behaves in a very unexpected way.

    But thank you for trying again...

Posting Permissions

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