Code won't compile on Feather 32u4

I wrote code which compiles and runs fine on a 328P Nano. But when I tried to compile it for a Feather 32u4 RFM69HCW it won't compile. I changed the board in the Arduino IDE to Feather 32u4. Any idea why the problems? The errors are attached: (sorry if I posted the errors in the wrong way)
There are so many and I don't know which one made it fail.

Thanks for looking at this

c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp: In member function 'void RH_ASK::timerSetup()':
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:438:5: error: 'TCCR2A' was not declared in this scope
TCCR2A = _BV(WGM21); // Turn on CTC mode)
^~~~~~
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:438:5: note: suggested alternative: 'TCCR0A'
TCCR2A = _BV(WGM21); // Turn on CTC mode)
^~~~~~
TCCR0A
In file included from c:\users\jspri\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\io.h:99:0,
from c:\users\jspri\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\pgmspace.h:90,
from C:\Users\jspri\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/Arduino.h:28,
from c:\Users\jspri\Documents\Arduino\libraries\RadioHead/RadioHead.h:1501,
from c:\Users\jspri\Documents\Arduino\libraries\RadioHead/RHGenericDriver.h:9,
from c:\Users\jspri\Documents\Arduino\libraries\RadioHead/RH_ASK.h:9,
from c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:6:
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:438:18: error: 'WGM21' was not declared in this scope
TCCR2A = _BV(WGM21); // Turn on CTC mode)
^
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:438:18: note: suggested alternative: 'WGM41'
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:440:5: error: 'TCCR2B' was not declared in this scope
TCCR2B = prescaler;
^~~~~~
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:440:5: note: suggested alternative: 'TCCR0B'
TCCR2B = prescaler;
^~~~~~
TCCR0B
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:444:5: error: 'OCR2A' was not declared in this scope
OCR2A = nticks;
^~~~~
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:444:5: note: suggested alternative: 'OCR3A'
OCR2A = nticks;
^~~~~
OCR3A
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:451:5: error: 'TIMSK' was not declared in this scope
TIMSK |= _BV(OCIE2A);
^~~~~
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:451:5: note: suggested alternative: 'TIMSK0'
TIMSK |= _BV(OCIE2A);
^~~~~
TIMSK0
In file included from c:\users\jspri\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\io.h:99:0,
from c:\users\jspri\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\pgmspace.h:90,
from C:\Users\jspri\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/Arduino.h:28,
from c:\Users\jspri\Documents\Arduino\libraries\RadioHead/RadioHead.h:1501,
from c:\Users\jspri\Documents\Arduino\libraries\RadioHead/RHGenericDriver.h:9,
from c:\Users\jspri\Documents\Arduino\libraries\RadioHead/RH_ASK.h:9,
from c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:6:
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:451:18: error: 'OCIE2A' was not declared in this scope
TIMSK |= _BV(OCIE2A);
^
c:\Users\jspri\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:451:18: note: suggested alternative: 'OCIE0A'
Multiple libraries were found for "Servo.h"
Used: C:\Users\jspri\Documents\Arduino\libraries\Servo
Not used: C:\Users\jspri\AppData\Local\Arduino15\libraries\Servo
Multiple libraries were found for "RH_RF69.h"
Used: C:\Users\jspri\Documents\Arduino\libraries\RadioHead
Not used: C:\Users\jspri\Documents\Arduino\libraries\SparkFun_RadioHead_Arduino_Library-master
Not used: C:\Users\jspri\Documents\Arduino\libraries\RadioHead-master
Multiple libraries were found for "Wire.h"
Used: C:\Users\jspri\AppData\Local\Arduino15\packages\adafruit\hardware\avr\1.4.15\libraries\Wire
Not used: C:\Users\jspri\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire
exit status 1

Compilation error: exit status 1

It's all 328 counter/timer specific code.
It would need to be translated for the 32u4.

If you wrote the original code, and have datasheets for both processors, you may be able to do it fairly straightforwardly.

No, unfortunately I have no idea why the problems. I have another (different) sketch that I am using the same Feather 32u4 which compiles on my laptop but not on my desktop. But this sketch fails on both. I was thinking it might possibly be a problem with the libraries since I have more libraries installed on the desktop - hence the "Multiple Libraries were found..." error but I didn't think that would cause it to fail to compile.

The circuit is several pushbuttons connected to gpio pins. It has the Adafruit Feather 32u4 RFM69HCW which is a dev board with a 32u4 and an integrated RFM69HCW RF Transceiver mounted on it. It also has an LSM303AGR Accelerator/Magnetometer module on the pcb and an OLED display. Both of those use the I2c pins.

My understanding is that the serial communication for the RFM69HCW uses an interrupt.

I don't understand the counter/timer in the code. I have a basic understanding of timers but it's a weak area for me.

Thanks for your help.

I did some research on timers and looking at the errors I looked at
RadioHead\RH_ASK.cpp

and I had the line:

#define RH_ASK_ARDUINO_USE_TIMER2

uncommented. I commented it back out and tried to compile and a lot of the errors went away. It still isn't compiling but here are the remaining errors:

"C:\Users\jspri\AppData\Local\Temp\arduino\sketches\201F58E93FC04BFD5D71022B46CF903B\libraries\RadioHead\RH_ASK.cpp.o (symbol from plugin): In function RH_ASK::maxMessageLength()': (.text+0x0): multiple definition of __vector_17'
C:\Users\jspri\AppData\Local\Temp\arduino\sketches\201F58E93FC04BFD5D71022B46CF903B\libraries\Servo\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
Multiple libraries were found for "Servo.h"
Used: C:\Users\jspri\Documents\Arduino\libraries\Servo
Not used: C:\Users\jspri\AppData\Local\Arduino15\libraries\Servo
Multiple libraries were found for "RH_RF69.h"
Used: C:\Users\jspri\Documents\Arduino\libraries\RadioHead
Not used: C:\Users\jspri\Documents\Arduino\libraries\RadioHead-master
Not used: C:\Users\jspri\Documents\Arduino\libraries\SparkFun_RadioHead_Arduino_Library-master
Multiple libraries were found for "Wire.h"
Used: C:\Users\jspri\AppData\Local\Arduino15\packages\adafruit\hardware\avr\1.4.15\libraries\Wire
Not used: C:\Users\jspri\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire
exit status 1

Compilation error: exit status 1"

You have a conflict with both the Radio Head library and the Servo library using Timer1.

You can set Radio Head to use Timer2 as there is no Timer2 on the 32u4.

You can set Servo.h to use Timer3 on the 32u4

See these instructions on Pololu
https://www.pololu.com/docs/0J63/3.11.1

You want to make certain that you modify the Servo library actually being used.

Multiple libraries were found for "Servo.h"
Used: C:\Users\jspri\Documents\Arduino\libraries\Servo
Not used: C:\Users\jspri\AppData\Local\Arduino15\libraries\Servo

Thank you for the help. I followed your advice and now it compiles.

Now on to the next problem...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.