[closed] RadioHead compiling fails for ATTiny85

The ATTiny85 can run RadioHead ASK. it’s tricky but it works. This code is from the Arduino IDE and it compiles there, with a few warnings. In platformio, it results in an error. My guess is it sticks to hardware SPI while Arduino IDE works around it.

Or it has something to do with the fuses setting, I tried to figure out how to switch ‘cores’ but did not succeed. It looks like platformio uses Arduino TinyCore and that is the right one anyway.

#include <RH_ASK.h>

#define R_PIN PB4
#define T_PIN PB1
#define L_PIN PB3

RH_ASK driver(2000, R_PIN, T_PIN);

void setup()
{
  if (!driver.init()){
    pinMode(L_PIN, OUTPUT);
    digitalWrite(L_PIN, HIGH);
    delay(500);
    digitalWrite(L_PIN, LOW);
    delay(500);
  }
}

void loop()
{
  const char *msg = "hello";

  driver.send((uint8_t *)msg, strlen(msg));
  driver.waitPacketSent();
  delay(200);
}

config

[env:myenv]
platform = atmelavr
framework = arduino
board = attiny85
upload_protocol = stk500v1
upload_flags = -P$UPLOAD_PORT -b$UPLOAD_SPEED
upload_port = /dev/ttyUSB0
upload_speed = 19200
lib_deps =
  RadioHead

Due to some poor choices in forum configuration, it is not possible for me to attach the log results from compiling :angry:

did you try with lib_ignore = SPI?

Good idea!
But it does not alter the error message as it seems.
I took a look in the library to find something like IF ATTINY THEN LOAD SOFTWARE SPI but I cannot find it in RH_ASK.h or RH_ASK.cpp…

tried your code and only works with “board = digispark-tiny” (which is a attiny85)
maybe you can find out what’s the difference of the board configuration.

1 Like

For me this returns the exact same errors when building. So how did you get this done? Could you please share your platformio.ini?

there is nothing special:

[env:digispark-tiny]
platform = atmelavr
board = digispark-tiny
framework = arduino
lib_deps = RadioHead
lib_ignore = SPI

Ah yes, I forgot to include the lib_ignore again, now it builds indeed, thanks. I may try to compare the two board configurations later.

[edit]
Uploading the code does not work, the digispark is not as Arduiono as ISP so I am stuck again.

Please file an issue here Issues · platformio/platform-atmelavr · GitHub

done - ATtiny core on steroids · Issue #48 · platformio/platform-atmelavr · GitHub