RadioHead compiling errors

Hello,

I face compiling errors when just including the "RadioHead" library into my sketch (#include <RadioHead.h> no other code for now).

My setup is :

  • Arduino Uno R4 Wifi
  • Working with Arduino Cloud web interface but I have exactly the same errors with the local IDE

Thanks in advance if someone has an idea...

Compiling errors are :

/home/builder/Arduino/libraries/radiohead_1_122_1/RH_ASK.cpp: In member function 'void RH_ASK::timerSetup()':
/home/builder/Arduino/libraries/radiohead_1_122_1/RH_ASK.cpp:463:5: error: 'TCCR1A' was not declared in this scope
TCCR1A = 0; // Output Compare pins disconnected
^~~~~~

/home/builder/Arduino/libraries/radiohead_1_122_1/RH_ASK.cpp:464:5: error: 'TCCR1B' was not declared in this scope
TCCR1B = _BV(WGM12); // Turn on CTC mode
^~~~~~
/home/builder/Arduino/libraries/radiohead_1_122_1/RH_ASK.cpp:464:18: error: 'WGM12' was not declared in this scope
TCCR1B = _BV(WGM12); // Turn on CTC mode
^~~~~
/home/builder/Arduino/libraries/radiohead_1_122_1/RH_ASK.cpp:464:14: error: '_BV' was not declared in this scope
TCCR1B = _BV(WGM12); // Turn on CTC mode
^~~
/home/builder/Arduino/libraries/radiohead_1_122_1/RH_ASK.cpp:464:14: note: suggested alternative: '_B'
TCCR1B = _BV(WGM12); // Turn on CTC mode
^~~
_B

/home/builder/Arduino/libraries/radiohead_1_122_1/RH_ASK.cpp:471:5: error: 'OCR1A' was not declared in this scope
OCR1A = nticks;
^~~~~
/home/builder/Arduino/libraries/radiohead_1_122_1/RH_ASK.cpp:478:5: error: 'TIMSK' was not declared in this scope
TIMSK |= _BV(OCIE1A);
^~~~~

/home/builder/Arduino/libraries/radiohead_1_122_1/RH_ASK.cpp:478:18: error: 'OCIE1A' was not declared in this scope
TIMSK |= _BV(OCIE1A);
^~~~~~
/home/builder/Arduino/libraries/radiohead_1_122_1/RH_ASK.cpp: At global scope:
/home/builder/Arduino/libraries/radiohead_1_122_1/RH_ASK.cpp:798:4: error: expected constructor, destructor, or type conversion before '(' token
ISR(RH_ASK_TIMER_VECTOR)
^
/home/builder/Arduino/libraries/radiohead_1_122_1/RHHardwareSPI.cpp: In member function 'virtual void RHHardwareSPI::begin()':
/home/builder/Arduino/libraries/radiohead_1_122_1/RHHardwareSPI.cpp:137:57: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'BitOrder' [-fpermissive]
_settings = SPISettings(frequency, bitOrder, dataMode);
^
In file included from /home/builder/.arduino15/packages/arduino/hardware/renesas_uno/1.2.0/libraries/SPI/SPI.h:22:0,
from /home/builder/Arduino/libraries/radiohead_1_122_1/RadioHead.h:1517,
from /home/builder/Arduino/libraries/radiohead_1_122_1/RHGenericSPI.h:10,
from /home/builder/Arduino/libraries/radiohead_1_122_1/RHHardwareSPI.h:10,
from /home/builder/Arduino/libraries/radiohead_1_122_1/RHHardwareSPI.cpp:7:
/home/builder/.arduino15/packages/arduino/hardware/renesas_uno/1.2.0/cores/arduino/api/HardwareSPI.h:47:3: note: initializing argument 2 of 'arduino::SPISettings::SPISettings(uint32_t, BitOrder, int)'
SPISettings(uint32_t clock, BitOrder bitOrder, int dataMode) {
^~~~~~~~~~~

Welcome to the forum

You are using a library that is not compatible with the processor on the Uno R4

For instance, this code

TCCR1A = 0; // Output Compare pins disconnected

tries to access a processor register that is not present on the Renesas processor used by the Uno R4

2 Likes

@UKHeliBob is quite correct. The library hasn't been updated in 5 years, long before the R4s came on the scene. At the time it was created, it quite likely did support all board types; but time marches on and that is no longer true.

Quickly glancing through the library, there's a series of #if defined(processor_type) blocks for various board types. If none of them apply (as in this case), it defaults to ATmega328P.

Long story short; you'll have to use another type of board, find a fork of RadioHead that's been updated for the R4 (and no, I have no idea whether or not one exists), or modify the library yourself.