0

I wrote a simple switch program using a teensy LC and transistors, but the Arduino compiler will not compile for the Teensy LC. And not for just my program, but any program, including the example programs included in the Arduino. I have tried compiling for other boards and they all compile fine. This problem was also replicated on another computer running Windows 10, I am running Windows 7, with the same error message. The error message and associated code is below, for reference.

int led1 = 0;
int led2 = 1;
int led3 = 2;

int input1 = 5;
int input2 = 7;
int input3 = 9;

int bypass1 = 23; //output 1
int toneStack1_1 = 22; //output 2
int toneStack1_2 = 21; //output 3
int bypass2 = 20; //output 4
int toneStack2_1 = 19; //output 5
int toneStack2_2 = 18; //output 6
int bypass3 = 17; //output 7
int toneStack3_1 = 16; //output 8
int toneStack3_2 = 15; //output 9

boolean bypass = true;        //idicators for which mode is active
boolean toneStack1 = false;
boolean toneStack2 = false;
boolean toneStack3 = false;

void setup() 
{
  pinMode(input1, INPUT);    //setting inputs
  pinMode(input2, INPUT);
  pinMode(input3, INPUT);

  pinMode(led1, OUTPUT);    //setting outputs
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);

  pinMode(bypass1, OUTPUT);
  pinMode(toneStack1_1, OUTPUT);
  pinMode(toneStack1_2, OUTPUT);
  pinMode(bypass1, OUTPUT);
  pinMode(toneStack2_1, OUTPUT);
  pinMode(toneStack2_2, OUTPUT);
  pinMode(bypass1, OUTPUT);
  pinMode(toneStack3_1, OUTPUT);
  pinMode(toneStack3_1, OUTPUT);

  digitalWrite(bypass1, HIGH);   //sets to bypass mode
  digitalWrite(bypass2, HIGH);
  digitalWrite(bypass3, HIGH);

}

void loop() 
{
  input1 = digitalRead(input1);    //reads inputs from pushbuttons
  input2 = digitalRead(input2);
  input3 = digitalRead(input3);

  if(input1 == HIGH && bypass == true) //Bypass to tonestack 1
  {
    digitalWrite(bypass1, LOW);   //turns off bypass transistors
    digitalWrite(bypass2, LOW);
    digitalWrite(bypass3, LOW);

    digitalWrite(toneStack1_1, HIGH);   //turns on tonestack 1 transistors
    digitalWrite(toneStack1_2, HIGH);

    bypass = false;
    toneStack1 = true;
  }

if(input2 == HIGH && bypass == true) //Bypass to tonestack 2
  {
    digitalWrite(bypass2, LOW);   //turns off bypass transistors
    digitalWrite(bypass3, LOW);

    digitalWrite(bypass1, HIGH);  //needs to be on to let signal flow to tonestack 2

    digitalWrite(toneStack2_1, HIGH);   //turns on tonestack 2 transistors
    digitalWrite(toneStack2_2, HIGH);

    bypass = false;
    toneStack2 = true;
  }

  if(input3 == HIGH && bypass == true) //Bypass to tonestack 3
  {

    digitalWrite(bypass3, LOW); //turns off bypass transistor

    digitalWrite(bypass1, HIGH);  //needs to be on to let signal flow to tonestack 2 
    digitalWrite(bypass2, HIGH);

    digitalWrite(toneStack3_1, HIGH);   //turns on tonestack 3 transistors
    digitalWrite(toneStack3_2, HIGH);

    bypass = false;
    toneStack3 = true;
  }

  if(input1 == HIGH && toneStack1 == true) //tonestack 1 to bypass
  {
    digitalWrite(bypass1, HIGH);   //turns on bypass transistors
    digitalWrite(bypass2, HIGH);
    digitalWrite(bypass3, HIGH);

    digitalWrite(toneStack1_1, LOW);   //turns off tonestack 1 transistors
    digitalWrite(toneStack1_2, LOW);

    bypass = true;
    toneStack1 = false;
  }

  if(input2 == HIGH && toneStack1 == true) //tonestack 1 to tonestack 2
  {
    digitalWrite(toneStack2_1, HIGH);   //turns on tone stack 2 transistors
    digitalWrite(toneStack2_2, HIGH);

    digitalWrite(bypass1, HIGH); //sets bypass transistors
    digitalWrite(bypass2, LOW);
    digitalWrite(bypass3, LOW);

    digitalWrite(toneStack1_1, LOW);   //turns off tonestack 1 transistors
    digitalWrite(toneStack1_2, LOW);

    toneStack2 = true;
    toneStack1 = false;
  }

  if(input3 == HIGH && toneStack1 == true) //tonestack 1 to tonestack 3
  {
    digitalWrite(toneStack3_1, HIGH);   //turns on tone stack 3 transistors
    digitalWrite(toneStack3_2, HIGH);

    digitalWrite(bypass1, HIGH);    //sets bypass transistors
    digitalWrite(bypass2, HIGH);
    digitalWrite(bypass3, LOW);

    digitalWrite(toneStack1_1, LOW);   //turns off tonestack 1 transistors
    digitalWrite(toneStack1_2, LOW);

    toneStack3 = true;
    toneStack1 = false;
  }

  if(input2 == HIGH && toneStack2 == true) //tonestack 2 to bypass
  {
    digitalWrite(bypass1, HIGH);   //turns on bypass transistors
    digitalWrite(bypass2, HIGH);
    digitalWrite(bypass3, HIGH);

    digitalWrite(toneStack2_1, LOW);   //turns off tonestack 2 transistors
    digitalWrite(toneStack2_2, LOW);

    bypass = true;
    toneStack2 = false;
  }

  if(input1 == HIGH && toneStack2 == true) //tonestack 2 to tonestack 1
  {
    digitalWrite(toneStack1_1, HIGH);   //turns on tonestack 1 transistors
    digitalWrite(toneStack1_2, HIGH);

    digitalWrite(bypass1, LOW);   //sets bypass transistors
    digitalWrite(bypass2, LOW);
    digitalWrite(bypass3, LOW);

    digitalWrite(toneStack2_1, LOW);   //turns off tonestack 2 transistors
    digitalWrite(toneStack2_2, LOW);

    toneStack1 = true;
    toneStack2 = false;
  }

  if(input3 == HIGH && toneStack2 == true) //tonestack 2 to tonestack 3
  {
    digitalWrite(toneStack3_1, HIGH);   //turns on tonestack 1 transistors
    digitalWrite(toneStack3_2, HIGH);

    digitalWrite(bypass1, HIGH);   //sets bypass transistors
    digitalWrite(bypass2, HIGH);
    digitalWrite(bypass3, LOW);

    digitalWrite(toneStack2_1, LOW);   //turns off tonestack 2 transistors
    digitalWrite(toneStack2_2, LOW);

    toneStack3 = true;
    toneStack2 = false;
  }  

  if(input3 == HIGH && toneStack3 == true) //tonestack 3 to bypass
  {
    digitalWrite(bypass1, HIGH);   //turns on bypass transistors
    digitalWrite(bypass2, HIGH);
    digitalWrite(bypass3, HIGH);

    digitalWrite(toneStack3_1, LOW);   //turns off tonestack 3 transistors
    digitalWrite(toneStack3_2, LOW);

    bypass = true;
    toneStack3 = false;
  }

  if(input1 == HIGH && toneStack3 == true) //tonestack 3 to tonestack 1
  {
    digitalWrite(toneStack1_1, HIGH);   //turns on tonestack 1 transistors
    digitalWrite(toneStack1_2, HIGH);

    digitalWrite(bypass1, LOW);   //sets bypass transistors
    digitalWrite(bypass2, LOW);
    digitalWrite(bypass3, LOW);

    digitalWrite(toneStack3_1, LOW);   //turns off tonestack 3 transistors
    digitalWrite(toneStack3_2, LOW);

    toneStack1 = true;
    toneStack3 = false;
  }


  if(input2 == HIGH && toneStack3 == true) //tonestack 3 to tonestack 2
  {
    digitalWrite(toneStack2_1, HIGH);   //turns on tonestack 2 transistors
    digitalWrite(toneStack2_2, HIGH);

    digitalWrite(bypass1, HIGH);   //sets bypass transistors
    digitalWrite(bypass2, LOW);
    digitalWrite(bypass3, LOW);

    digitalWrite(toneStack3_1, LOW);   //turns off tonestack 3 transistors
    digitalWrite(toneStack3_2, LOW);

    toneStack2 = true;
    toneStack3 = false;
  }
}

And the error message:

Arduino: 1.8.4 (Windows 7), TD: 1.38, Board: "Teensy LC, Serial, 48 MHz, Smallest Code, US English"

In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3\IntervalTimer.h:34:0,

                 from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3\IntervalTimer.cpp:31:

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3\IntervalTimer.cpp: In member function 'void IntervalTimer::end()':

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3\IntervalTimer.cpp:87:20: error: 'IRQ_PIT_CH0' was not declared in this scope

   NVIC_DISABLE_IRQ(IRQ_PIT_CH0 + index);

                    ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3\kinetis.h:5627:68: note: in definition of macro 'NVIC_DISABLE_IRQ'

 #define NVIC_DISABLE_IRQ(n) (*((volatile uint32_t *)0xE000E180 + ((n) >> 5)) = (1 << ((n) & 31)))

                                                                    ^

Error compiling for board Teensy LC.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I'm at my wits end trying to figure this out. I have reinstalled the Arduino 1.8.4, reinstalled Teensyduino, installed previous version of Arduino, and rebooting my system. Nothing so far has worked. I feel like there is something I am missing with this, as it seems no one else has my problem, from what I could find. Any help would be appreciated.

migrated from electronics.stackexchange.com Aug 31 '17 at 1:17

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • I was able to do a very hacky fix that seemed to work. In the directory Arduino > hardware > teensy > avr > cores > teensy3 there is a .H file called kinetis. This seems to be where some of the timers addresses are stored, and under Teensy LC, the infamous IRQ_PIT_CH0 from the error message is missing. I added it in defining it as 4 and everything seems to be working now. I haven't tested my code yet, aside from compiling it, but the blink program does work. I don't know if this will cause issues down the line, but it has seemingly fixed my current problem. – Blake H Aug 31 '17 at 18:02
  • You did the right thing. Libraries have problems but having the source code lets solve them by yourself. – user31481 Oct 30 '17 at 8:59
1

I experienced a similar error. Upon further research it seems to be a known issue. I was able to compile using 1.8.2 and Teensyduino 1.36 I accessed 1.36 from downloading the zip file of the pjrc website in the upper right corner. The Link was download website. Then the path was pjrc_2017_04_04\teensy\td_136

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.