<< return to Pixycam.com

Arduino Nano 33 IoT compilation errors (TIMER2_OVF_vect)

I am succesfully running Pixy2 on Arduino Uno but when I try on an Arduino Nano 33 IoT board it fails.

Simply including these headers gives the following errors:

#include <SPI.h>
#include <Pixy2.h>

Full, error dump bellow.
Do I need a different library that is compatible with that hardware?
FYI ( I am the beginner )

Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:90:5: error: expected constructor, destructor, or type conversion before '(' token
 ISR (TIMER2_OVF_vect)
     ^
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp: In static member function 'static void ZumoBuzzer::init2()':
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:31:36: error: 'TIMSK2' was not declared in this scope
 #define DISABLE_TIMER_INTERRUPT()  TIMSK2 = 0
                                    ^
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:127:3: note: in expansion of macro 'DISABLE_TIMER_INTERRUPT'
   DISABLE_TIMER_INTERRUPT();
   ^~~~~~~~~~~~~~~~~~~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:170:3: error: 'TCCR2A' was not declared in this scope
   TCCR2A = 0x21;  // bits 7 and 6 clear: normal port op., OC4A disconnected
   ^~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:176:3: error: 'TCCR2B' was not declared in this scope
   TCCR2B = 0x0B;  // bit 7 clear: no force output compare for channel A
   ^~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:193:3: error: 'OCR2A' was not declared in this scope
   OCR2A = (F_CPU/64) / 1000;  // set TOP for freq = 1 kHz
   ^~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:194:3: error: 'OCR2B' was not declared in this scope
   OCR2B = 0;                  // 0% duty cycle
   ^~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:23:21: error: 'DDRD' was not declared in this scope
 #define BUZZER_DDR  DDRD
                     ^
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:197:3: note: in expansion of macro 'BUZZER_DDR'
   BUZZER_DDR |= BUZZER;    // buzzer pin set as an output
   ^~~~~~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:24:27: error: 'PORTD3' was not declared in this scope
 #define BUZZER      (1 << PORTD3)
                           ^
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:197:17: note: in expansion of macro 'BUZZER'
   BUZZER_DDR |= BUZZER;    // buzzer pin set as an output
                 ^~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:198:3: error: 'sei' was not declared in this scope
   sei();
   ^~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp: In static member function 'static void ZumoBuzzer::playFrequency(unsigned int, unsigned int, unsigned char)':
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:31:36: error: 'TIMSK2' was not declared in this scope
 #define DISABLE_TIMER_INTERRUPT()  TIMSK2 = 0
                                    ^
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:270:3: note: in expansion of macro 'DISABLE_TIMER_INTERRUPT'
   DISABLE_TIMER_INTERRUPT();      // disable interrupts while writing to registers
   ^~~~~~~~~~~~~~~~~~~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:283:3: error: 'TCCR2B' was not declared in this scope
   TCCR2B = (TCCR2B & 0xF8) | newCS2;  // select timer 2 clock prescaler
   ^~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:284:3: error: 'OCR2A' was not declared in this scope
   OCR2A = top;                        // set timer 2 pwm frequency
   ^~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:285:3: error: 'OCR2B' was not declared in this scope
   OCR2B = top >> (16 - volume);       // set duty cycle (volume)
   ^~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:288:3: error: 'TIFR2' was not declared in this scope
   TIFR2 |= 0xFF;  // clear any pending t2 overflow int.
   ^~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:30:51: error: 'TOIE2' was not declared in this scope
 #define ENABLE_TIMER_INTERRUPT()   TIMSK2 = (1 << TOIE2)
                                                   ^
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:291:3: note: in expansion of macro 'ENABLE_TIMER_INTERRUPT'
   ENABLE_TIMER_INTERRUPT();
   ^~~~~~~~~~~~~~~~~~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp: In static member function 'static void ZumoBuzzer::play(const char*)':
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:31:36: error: 'TIMSK2' was not declared in this scope
 #define DISABLE_TIMER_INTERRUPT()  TIMSK2 = 0
                                    ^
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:476:3: note: in expansion of macro 'DISABLE_TIMER_INTERRUPT'
   DISABLE_TIMER_INTERRUPT();  // prevent this from being interrupted
   ^~~~~~~~~~~~~~~~~~~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp: In static member function 'static void ZumoBuzzer::playFromProgramSpace(const char*)':
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:31:36: error: 'TIMSK2' was not declared in this scope
 #define DISABLE_TIMER_INTERRUPT()  TIMSK2 = 0
                                    ^
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:485:3: note: in expansion of macro 'DISABLE_TIMER_INTERRUPT'
   DISABLE_TIMER_INTERRUPT();  // prevent this from being interrupted
   ^~~~~~~~~~~~~~~~~~~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp: In static member function 'static void ZumoBuzzer::stopPlaying()':
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:31:36: error: 'TIMSK2' was not declared in this scope
 #define DISABLE_TIMER_INTERRUPT()  TIMSK2 = 0
                                    ^
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:496:3: note: in expansion of macro 'DISABLE_TIMER_INTERRUPT'
   DISABLE_TIMER_INTERRUPT();          // disable interrupts
   ^~~~~~~~~~~~~~~~~~~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:506:3: error: 'TCCR2B' was not declared in this scope
   TCCR2B = (TCCR2B & 0xF8) | TIMER2_CLK_32; // select IO clock
   ^~~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:507:3: error: 'OCR2A' was not declared in this scope
   OCR2A = (F_CPU/64) / 1000;                // set TOP for freq = 1 kHz
   ^~~~~
/Users/cv/Documents/Arduino/libraries/Pixy2/ZumoBuzzer.cpp:508:3: error: 'OCR2B' was not declared in this scope
   OCR2B = 0;                                // 0% duty cycle
   ^~~~~
exit status 1
Error compiling for board Arduino NANO 33 IoT

Hi, please try deleting the Zumo files shown here:

Let us know if that doesn’t solve the problem!

Thanks,
Jesse

1 Like

Hi Freed, YES that did solve the issue! :smiley:

Thank you for your fast response!

1 Like

Hooray! Sure thing :slight_smile: