Trying to use RH_ask on STM32F0

Post here first, or if you can't find a relevant section!
Post Reply
PHZ2
Posts: 7
Joined: Fri Jun 05, 2020 6:53 pm

Trying to use RH_ask on STM32F0

Post by PHZ2 »

Is it possible to use RH_ask library (want to use 433mhz rf) without having to change all the timer libraries or this library itself for STM32F0 on arduino IDE? (link for the RH_ask library: https://www.airspayce.com/mikem/arduino ... index.html)

Using this package for STM32F1 I can compile and use RH_ask, but it doesn't support STM32F0:
http://dan.drown.org/stm32duino/package ... index.json,

Using this package for STM32 in general (including STM32F0), it won't compile:
https://github.com/stm32duino/BoardMana ... index.json

I went through the libraries, and it seems that the HardwareTimer, timer and related libraries are different between those packages, even though both can upload to STM32F1.

I tried to change libraries on the second package to match those on the first one so RH_ask.h woudn't need to be changed, but I got nowhere =/.

Thanks!!
User avatar
fpiSTM
Posts: 1723
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Trying to use RH_ask on STM32F0

Post by fpiSTM »

STM32 F4 Discover board, using Arduino 1.8.2 or later and Roger Clarkes Arduino_STM from https://github.com/rogerclarkmelbourne/Arduino_STM32 Caution: with this library and board, sending text to Serial causes the board to hang in mysterious ways. Serial2 emits to PA2. The default SPI pins are SCK: PB3, MOSI PB5, MISO PB4. We tested with PB0 as slave select and PB1 as interrupt pin for various radios. RH_ASK and RH_Serial also work. Also works with stm32duino 1.8.0 from https://github.com/stm32duino/Arduino_Core_STM32, wich can be installed on Arduino with BoardManager. Select board: STM32 Discovery F407.
Probably you use the 1.9.0, there is an Hardware Timer API change so try with the 1.8.0 if it works then ask the maintainer of the library to update.
PHZ2
Posts: 7
Joined: Fri Jun 05, 2020 6:53 pm

Re: Trying to use RH_ask on STM32F0

Post by PHZ2 »

Thanks. I tried with 1.8 and other older versions but it didn't work. It seems they still use the same library as 1.9.
Last edited by PHZ2 on Fri Jun 12, 2020 1:22 am, edited 1 time in total.
User avatar
fpiSTM
Posts: 1723
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Trying to use RH_ask on STM32F0

Post by fpiSTM »

Well, I didn't check the library implementation anyway it seems the lib has only be tested for Disco F407.
PHZ2
Posts: 7
Joined: Fri Jun 05, 2020 6:53 pm

Re: Trying to use RH_ask on STM32F0

Post by PHZ2 »

I might be doing something wrong, but I couldn't compile to F407 using the second package either. It just compiles with the other package =/. the errors are the same, about the functions on the hardwaretimer library.
User avatar
fpiSTM
Posts: 1723
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Trying to use RH_ask on STM32F0

Post by fpiSTM »

Well, I've tested and it seems the library is not compatible event if it is specified it is compatible:
RadioHead\RH_ASK.cpp:18:21: error: invalid conversion from 'int' to 'TIM_TypeDef*' [-fpermissive]
18 | HardwareTimer timer(1);
| ^
| |
| int
This code is not correct:

Code: Select all

#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4)
// rogerclarkmelbourne/Arduino_STM32
// And stm32duino    
HardwareTimer timer(1);
I don't know why but this could not work. So I guess it does not talk about the STM32 core but one other.
So, the only way to have it compatible with the STM32 core is to update the library.
It seems the code is not under GitHub, anyway it exists several GitHub repo based on this:
https://github.com/adafruit/RadioHead

and this is already requested:
https://github.com/adafruit/RadioHead/issues/42

I guess, it would be fine for Adafruit to have it as they now have the Feather F405 and it is supported by the STM32 core.
PHZ2
Posts: 7
Joined: Fri Jun 05, 2020 6:53 pm

Re: Trying to use RH_ask on STM32F0

Post by PHZ2 »

I see.. thanks!
fpiSTM wrote: Fri Jun 12, 2020 9:38 am Well, I've tested and it seems the library is not compatible event if it is specified it is compatible:
RadioHead\RH_ASK.cpp:18:21: error: invalid conversion from 'int' to 'TIM_TypeDef*' [-fpermissive]
18 | HardwareTimer timer(1);
| ^
| |
| int
This code is not correct:

Code: Select all

#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4)
// rogerclarkmelbourne/Arduino_STM32
// And stm32duino    
HardwareTimer timer(1);
It's not only that, after you change it, new errors show up. The RadioHead library calls functions from hardwaretimer.h that are different between those two packages from my first post, even though both can upload to STM32F1. It seems both do the same thing, but are coded different and RadioHead is made to work with only one of those (the one that only supports STM32F1).

Seems I'll have to wait a little then.

Do you know if there's some library or exemples for 433 on CubeIDE? Couldn't find one.
User avatar
fpiSTM
Posts: 1723
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Trying to use RH_ask on STM32F0

Post by fpiSTM »

I don't know sorry.
Post Reply

Return to “General discussion”