Has anyone been able to get the RadioHead library to work on an STM32, specifically rfm22 if that matters. I had a few compile issues with feature that I don’t use compiling initially, which may be an indication of a problem, but, after hacking around those, I can’t get the simplest program to run.
Creating a simple project for an STM32F103CB that contains this for a main.c:
#include <Arduino.h>
#include <SPI.h>
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
will fail to compile.
It works great in the Arduino IDE, but I would love to be able to use PlatformIO.
Thanks, but I already tried importing my ino file from my Arduino project into platformio and got the same error. I think it must be due to some defines that are different, but I don’t know how to see what the differences are.
The code around the error is:
#if (RH_PLATFORM == RH_PLATFORM_STM32)
// Maple etc
.pio\libdeps\genericSTM32F103CB\RadioHead\RH_ASK.cpp:18:21: error: invalid conversion from 'int' to 'TIM_TypeDef*' [-fpermissive]
18 | HardwareTimer timer(1);
If I force it to use the first section by defining RH_PLATFORM = RH_PLATFORM_STM32 it compiles, but crashes.
Actually, I think I ended up just ifdeffing out that whole file, but it makes me think that the STM32 framework that I’m using in platformio is different from what I’m using in arduino, which I believe is this: GitHub - stm32duino/Arduino_Core_STM32: STM32 core support for Arduino
It also took me quite a while just to find a arduino framework that worked, with all the different bootloaders and flashing options, etc. I finally got it to work with no bootloader and flashing via serial. I would also love to use a bootloader, but all the ones I tried either didn’t work, or seemed to flash over themselves, so they only lasted one flash.
If the RadioHead library is written against an older STM32Duino core, you can also just downgrade the platform version that PlatformIO is supposed to use.
You’re right, it’s written against the Maple core.
But then the error could also be another one – since 7.0.0 the genericSTM32F103CB board uses STM32Duino instead of Maple as the default underlying core. See e.g. boards/genericSTM32F103CB.json diff in
Thank you for all the suggestions. I don’t know why I just received notification about the activity on this thread.
In any case, I will try the suggestions as soon as I can and report back. I suspect the maple version would work, since I think that’s the version of stm32 Ardiomp that I’m using in the Arduino IDI. I didn’t know it was available in PlatformIO.
I would prefer to use the default version in PlatformIO, which I believe is the newer version, so I’ll try the patch to see if that fixes it.