Seeeduino XIAO + RF 433MHz Transmitter/Receiver Module

I am trying to use the Seeeduino XIAO to transmit information to an Arduino UNO.

I am using the provided RadioHead code for the transmitter, but there is an error when I compile.

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile

RH_ASK driver;

void setup()
{
    Serial.begin(9600);    // Debugging only
    if (!driver.init())
         Serial.println("init failed");
}

void loop()
{
    const char *msg = "Hello World!";
    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(1000);
}

The error message details issues with the timer (error around line 200).

Here is the error message, beginning where the error is (link is the entire error message):

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp: In member function 'void RH_ASK::timerSetup()':

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:215:5: error: 'pmc_set_writeprotect' was not declared in this scope

 pmc_set_writeprotect(false);

 ^~~~~~~~~~~~~~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:214:34: error: 'TC1_IRQn' was not declared in this scope

 #define RH_ASK_DUE_TIMER_IRQ TC1_IRQn

                              ^

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:216:27: note: in expansion of macro 'RH_ASK_DUE_TIMER_IRQ'

 pmc_enable_periph_clk(RH_ASK_DUE_TIMER_IRQ);

                       ^~~~~~~~~~~~~~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:214:34: note: suggested alternative: 'TC5_IRQn'

 #define RH_ASK_DUE_TIMER_IRQ TC1_IRQn

                              ^

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:216:27: note: in expansion of macro 'RH_ASK_DUE_TIMER_IRQ'

 pmc_enable_periph_clk(RH_ASK_DUE_TIMER_IRQ);

                       ^~~~~~~~~~~~~~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:216:5: error: 'pmc_enable_periph_clk' was not declared in this scope

 pmc_enable_periph_clk(RH_ASK_DUE_TIMER_IRQ);

 ^~~~~~~~~~~~~~~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:212:30: error: 'TC0' was not declared in this scope

 #define RH_ASK_DUE_TIMER TC0

                          ^

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:221:18: note: in expansion of macro 'RH_ASK_DUE_TIMER'

 TC_Configure(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL,

              ^~~~~~~~~~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:212:30: note: suggested alternative: 'TCC0'

 #define RH_ASK_DUE_TIMER TC0

                          ^

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:221:18: note: in expansion of macro 'RH_ASK_DUE_TIMER'

 TC_Configure(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL,

              ^~~~~~~~~~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:222:4: error: 'TC_CMR_WAVE' was not declared in this scope

TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK4);

^~~~~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:222:18: error: 'TC_CMR_WAVSEL_UP_RC' was not declared in this scope

TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK4);

              ^~~~~~~~~~~~~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:222:18: note: suggested alternative: 'TCC_WAVE_POL'

TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK4);

              ^~~~~~~~~~~~~~~~~~~

              TCC_WAVE_POL

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:222:40: error: 'TC_CMR_TCCLKS_TIMER_CLOCK4' was not declared in this scope

TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK4);

                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:221:5: error: 'TC_Configure' was not declared in this scope

 TC_Configure(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL,

 ^~~~~~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:223:5: error: 'TC_SetRC' was not declared in this scope

 TC_SetRC(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL, rc);

 ^~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:223:5: note: suggested alternative: 'CDC_Setup'

 TC_SetRC(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL, rc);

 ^~~~~~~~

 CDC_Setup

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:225:69: error: 'TC_IER_CPCS' was not declared in this scope

 RH_ASK_DUE_TIMER->TC_CHANNEL[RH_ASK_DUE_TIMER_CHANNEL].TC_IER = TC_IER_CPCS;

                                                                 ^~~~~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:225:69: note: suggested alternative: 'TCC_PER_PER'

 RH_ASK_DUE_TIMER->TC_CHANNEL[RH_ASK_DUE_TIMER_CHANNEL].TC_IER = TC_IER_CPCS;

                                                                 ^~~~~~~~~~~

                                                                 TCC_PER_PER

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:228:5: error: 'TC_Start' was not declared in this scope

 TC_Start(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL);

 ^~~~~~~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:228:5: note: suggested alternative: 'va_start'

 TC_Start(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL);

 ^~~~~~~~

 va_start

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp: In function 'void TC1_Handler()':

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:504:18: error: 'TC0' was not declared in this scope

 TC_GetStatus(TC0, 1);

              ^~~

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:504:18: note: suggested alternative: 'TCC0'

 TC_GetStatus(TC0, 1);

              ^~~

              TCC0

C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:504:5: error: 'TC_GetStatus' was not declared in this scope

 TC_GetStatus(TC0, 1);

 ^~~~~~~~~~~~

Using library RadioHead in folder: C:\Users\homeGuest\Documents\Arduino\libraries\RadioHead (legacy)

Using library SPI at version 1.0 in folder: C:\Users\homeGuest\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.8.1\libraries\SPI 

Using library Adafruit_ZeroDMA at version 1.0.4 in folder: C:\Users\homeGuest\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.8.1\libraries\Adafruit_ZeroDMA 

exit status 1

Error compiling for board Seeeduino XIAO.

Any ideas on how to fix it?

Thanks in advance for any advice or help.

Looks like you’re compiling for a wrong board. XIAO does not have TC1_IRQn timer defined. But Arduino Duo (Cortext M3 based) do.

Thanks for the help! Just needed to download the newest version of the Radiohead library for the code to work.