Artemis and RadioHead library

Hi all,

trying to use the RadioHead library with an Artemis board, using Arduino. The low power aspect of the board is great, because I’m going to use the device as a remote outdoor weather station. I’m using a HopeRF95 LoRa board. I am able to get communication going with RadioLib, but not RadioHead.

I seem to be getting into trouble with the mBed core. I already had to alter my code because mbed doesn’t support a float into a String. That’s ok, there’s an easy workaround (I multiplied the float results from the sensor so I was working with an integer.) However. it looks like the SPI functions are different-- below is just a snippet of a couple of pages of error messages at compile time. Suggestions (other than using a different library) would be welcome. RadioHead is preferable for me because I want to be able to communicate directly and exclusively with individual modules and addressing an individual node looks easier. Error msg below. Thank you in advance. //Ed

Arduino: 1.8.13 (Windows 10), TD: 1.53, Board: “Artemis Thing Plus, 460800, SparkFun Variable Loader (Recommended)”

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp: In member function ‘virtual void RHHardwareSPI::begin()’:

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:79:9: error: ‘class arduino::MbedSPI’ has no member named ‘setDataMode’

SPI.setDataMode(dataMode);

^~~~~~~~~~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:92:9: error: ‘class arduino::MbedSPI’ has no member named ‘setBitOrder’

SPI.setBitOrder(bitOrder);

It looks like that is an incompatibility between that library and mBed OS…try updating the board efinitions via arduino IDE https://github.com/nRF24/RF24/issues/537 and re-try?

Install library version 1.2.3 and these calls are still accepted in this library version. The biggest aspect you lose in a default configuration is BLE.

thank you both for your input. Regrettably, neither suggestion worked. I’ll use a brute force hack with radioLib.

out of interest: what did not work ? Was the setBitOrder call not found ?

Thanks for the replies–

sipan1313-- thanks for the general info. I was aware of the need for two objects for the code to work. I usually run an example before I start coding my own project. The compiler failed to compile an example sketch; I don’t remember exactly which one.

paulvha-- error dump below. The compiler was exceedingly unhappy… I’m a decent intermediate grade programmer but not the most savvy by any means. I depend on libraries a lot so I don’t understand all of the subtleties. However, after doing some research and reading, looks like the problem is with the mBed core not supporting all the SPI functions. I would not know how to alter the code to make this work.

FWIW, I ended up using the LoRa library by Sandeep Mistry. Easy to use and seems to be reliable. I had to add some simple extra message filtering code to allow addressing a single unit out of three deployed, but that was a lot easier than messing with the hardware interface. Appreciate your interest.

Arduino: 1.8.13 (Windows 10), TD: 1.53, Board: “Artemis Thing Plus, 460800, SparkFun Variable Loader (Recommended)”

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp: In member function ‘virtual void RHHardwareSPI::begin()’:

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:79:9: error: ‘class arduino::MbedSPI’ has no member named ‘setDataMode’

SPI.setDataMode(dataMode);

^~~~~~~~~~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:92:9: error: ‘class arduino::MbedSPI’ has no member named ‘setBitOrder’

SPI.setBitOrder(bitOrder);

^~~~~~~~~~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:28:27: error: ‘VARIANT_MCK’ was not declared in this scope

#define SPI_CLOCK_DIV16 (VARIANT_MCK/84000000) // 1MHz

^~~~~~~~~~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:102:16: note: in expansion of macro ‘SPI_CLOCK_DIV16’

divider = SPI_CLOCK_DIV16;

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:28:27: note: suggested alternative: ‘VARIANT_SPI_CLK’

#define SPI_CLOCK_DIV16 (VARIANT_MCK/84000000) // 1MHz

^~~~~~~~~~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:102:16: note: in expansion of macro ‘SPI_CLOCK_DIV16’

divider = SPI_CLOCK_DIV16;

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:131:9: error: ‘class arduino::MbedSPI’ has no member named ‘setClockDivider’

SPI.setClockDivider(divider);

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp: In member function ‘uint8_t RH_ASK::timerCalc(uint16_t, uint16_t, uint16_t*)’:

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:118:40: error: ‘F_CPU’ was not declared in this scope

unsigned long inv_clock_time = F_CPU / ((unsigned long)prescalerValue);

^~~~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:118:40: note: suggested alternative: ‘FPU’

unsigned long inv_clock_time = F_CPU / ((unsigned long)prescalerValue);

^~~~~

FPU

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp: In member function ‘void RH_ASK::timerSetup()’:

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:209:5: error: ‘pmc_set_writeprotect’ was not declared in this scope

pmc_set_writeprotect(false);

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:208:34: error: ‘TC1_IRQn’ was not declared in this scope

#define RH_ASK_DUE_TIMER_IRQ TC1_IRQn

^~~~~~~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:210:27: note: in expansion of macro ‘RH_ASK_DUE_TIMER_IRQ’

pmc_enable_periph_clk(RH_ASK_DUE_TIMER_IRQ);

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:208:34: note: suggested alternative: ‘RTC_IRQn’

#define RH_ASK_DUE_TIMER_IRQ TC1_IRQn

^~~~~~~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:210:27: note: in expansion of macro ‘RH_ASK_DUE_TIMER_IRQ’

pmc_enable_periph_clk(RH_ASK_DUE_TIMER_IRQ);

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:210:5: error: ‘pmc_enable_periph_clk’ was not declared in this scope

pmc_enable_periph_clk(RH_ASK_DUE_TIMER_IRQ);

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:214:20: error: ‘VARIANT_MCK’ was not declared in this scope

uint32_t rc = (VARIANT_MCK / _speed) / 128 / 8;

^~~~~~~~~~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:214:20: note: suggested alternative: ‘VARIANT_SPI_CLK’

uint32_t rc = (VARIANT_MCK / _speed) / 128 / 8;

^~~~~~~~~~~

VARIANT_SPI_CLK

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:206:30: error: ‘TC0’ was not declared in this scope

#define RH_ASK_DUE_TIMER TC0

^~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:215:18: note: in expansion of macro ‘RH_ASK_DUE_TIMER’

TC_Configure(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL,

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:216: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\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:216: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\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:216: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\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:215:5: error: ‘TC_Configure’ was not declared in this scope

TC_Configure(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL,

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:217:5: error: ‘TC_SetRC’ was not declared in this scope

TC_SetRC(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL, rc);

^~~~~~~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:219: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\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:222:5: error: ‘TC_Start’ was not declared in this scope

TC_Start(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL);

^~~~~~~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:222:5: note: suggested alternative: ‘va_start’

TC_Start(RH_ASK_DUE_TIMER, RH_ASK_DUE_TIMER_CHANNEL);

^~~~~~~~

va_start

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp: In function ‘void TC1_Handler()’:

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:498:18: error: ‘TC0’ was not declared in this scope

TC_GetStatus(TC0, 1);

^~~

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:498:5: error: ‘TC_GetStatus’ was not declared in this scope

TC_GetStatus(TC0, 1);

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:498:5: note: suggested alternative: ‘SocketStats’

TC_GetStatus(TC0, 1);

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

SocketStats

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_RF22.cpp: In member function ‘virtual bool RH_RF22::init()’:

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_RF22.cpp:80:28: error: ‘NOT_AN_INTERRUPT’ was not declared in this scope

if (interruptNumber == NOT_AN_INTERRUPT)

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_RF22.cpp:80:28: note: suggested alternative: ‘AM_HAL_INTERRUPT_H’

if (interruptNumber == NOT_AN_INTERRUPT)

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

AM_HAL_INTERRUPT_H

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_RF69.cpp: In member function ‘virtual bool RH_RF69::init()’:

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_RF69.cpp:91:28: error: ‘NOT_AN_INTERRUPT’ was not declared in this scope

if (interruptNumber == NOT_AN_INTERRUPT)

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_RF69.cpp:91:28: note: suggested alternative: ‘AM_HAL_INTERRUPT_H’

if (interruptNumber == NOT_AN_INTERRUPT)

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

AM_HAL_INTERRUPT_H

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_RF95.cpp: In member function ‘virtual bool RH_RF95::init()’:

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_RF95.cpp:41:28: error: ‘NOT_AN_INTERRUPT’ was not declared in this scope

if (interruptNumber == NOT_AN_INTERRUPT)

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

C:\Users\Ed__XXX\Documents\Arduino\libraries\RadioHead\RH_RF95.cpp:41:28: note: suggested alternative: ‘AM_HAL_INTERRUPT_H’

if (interruptNumber == NOT_AN_INTERRUPT)

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

AM_HAL_INTERRUPT_H

exit status 1

Error compiling for board Artemis Thing Plus.

This report would have more information with

“Show verbose output during compilation”

option enabled in File → Preferences.

where can I find the library you use online? Maybe I can some changes to make it work

Here’s the URL. http://airspayce.com/mikem/arduino/RadioHead/

Thank you for your offer to correct the code. If you want to pursue that for your own interest, that would fine, but it’s not a must have at this point.

My new approach is working well, and I don’t need to go back to this library.

The RadioHead library is quite robust. If it worked for the Artemis community that would be a plus.

Best regards,

Ed

I have made 2 changes to get this to work, It now compiles without errors.

One disadvantage RH-ASK is not supported, but I expect a low impact for most users :

RH_ASK Works with a range of inexpensive ASK (amplitude shift keying) RF transceivers such as RX-B1 (also known as ST-RX04-ASK) receiver; TX-C1 transmitter and DR3100 transceiver; FS1000A/XY-MK-5V transceiver; HopeRF RFM83C / RFM85. Supports ASK (OOK).

RadioHead_artemis.zip (560 KB)

wow, thank you. I had not been back to this forum for several days. I’m sure this will be useful for me and others. Can’t wait to see this compile.

Ed