STM32-RFM69

Limited support for STM32F4 Discovery, Nucleo and custom F4 boards
kylix
Posts: 17
Joined: Mon Jul 10, 2017 6:30 pm

STM32-RFM69

Post by kylix » Sun Dec 03, 2017 7:55 pm

Hello!

I'm trying to use an RFM69HW module with the STM32F401RE board (the project is this: https://github.com/brainelectronics/RFM69-STM32). I've just updated the STM32 cores to the latest available version: 24.11.2017 (Arduino IDE v1.6.9) but I get this error while compiling:

Code: Select all

Arduino: 1.6.9 (Windows 7), Board: "Nucleo-64, Nucleo F401RE, Mass Storage, Generic Serial, None, Smallest (-Os default)"

Build options changed, rebuilding all
In file included from C:\Users\Kylix\AppData\Local\Arduino15\packages\STM32\hardware\stm32\2017.11.24\cores\arduino/stm32/PinNames.h:25:0,

                 from C:\Users\Kylix\AppData\Local\Arduino15\packages\STM32\hardware\stm32\2017.11.24\cores\arduino/stm32/pinmap.h:22,

                 from C:\Users\Kylix\AppData\Local\Arduino15\packages\STM32\hardware\stm32\2017.11.24\cores\arduino/stm32/PeripheralPins.h:34,

                 from C:\Users\Kylix\AppData\Local\Arduino15\packages\STM32\hardware\stm32\2017.11.24\cores\arduino/pins_arduino.h:21,

                 from C:\Users\Kylix\AppData\Local\Arduino15\packages\STM32\hardware\stm32\2017.11.24\variants\NUCLEO_F401RE\variant.h:26,

                 from C:\Users\Kylix\AppData\Local\Arduino15\packages\STM32\hardware\stm32\2017.11.24\variants\NUCLEO_F401RE\variant.cpp:19:

C:\Users\Kylix\AppData\Local\Arduino15\packages\STM32\hardware\stm32\2017.11.24\cores\arduino/stm32/PortNames.h:74:17: error: expected constructor, destructor, or type conversion before '(' token

 _Static_assert  (LastPort <= 0x0F, "PortName must be less than 16");

                 ^

exit status 1
Error compiling for board Nucleo-64.
With this library: https://github.com/goran-mahovlic/RFM69-STM32, I get different errors:

Code: Select all

Arduino: 1.6.9 (Windows 7), Board: "Nucleo-64, Nucleo F401RE, Mass Storage, Generic Serial, None, Smallest (-Os default)"

C:\Users\Kylix\Desktop\arduino-1.6.9\libraries\RFM69-STM32\RFM69_ATC_STM32.cpp: In member function 'void RFM69_ATC_STM32::sendFrame(uint8_t, const void*, uint8_t, bool, bool, bool, int16_t)':

C:\Users\Kylix\Desktop\arduino-1.6.9\libraries\RFM69-STM32\RFM69_ATC_STM32.cpp:104:3: error: 'SPI_def' was not declared in this scope

   SPI_def.transfer(REG_FIFO | 0x80);

   ^

C:\Users\Kylix\Desktop\arduino-1.6.9\libraries\RFM69-STM32\RFM69_ATC_STM32.cpp: In member function 'virtual void RFM69_ATC_STM32::interruptHook(uint8_t)':

C:\Users\Kylix\Desktop\arduino-1.6.9\libraries\RFM69-STM32\RFM69_ATC_STM32.cpp:143:23: error: 'SPI_def' was not declared in this scope

       _ackRSSI = -1 * SPI_def.transfer(0); //rssi was sent as single byte positive value, get the real value by * -1

                       ^

exit status 1
Error compiling for board Nucleo-64.

Any idea on how to solve it?

fpiSTM
Posts: 250
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: STM32-RFM69

Post by fpiSTM » Mon Dec 04, 2017 5:56 am

Hi,

for the first issue:

Code: Select all

 _Static_assert (LastPort <= 0x0F, "PortName must be less than 16");
I think you do not use the right arm gcc version. It should be arm-none-eabi-gcc\6-2017-q2-update.

For the second:

Code: Select all

 'SPI_def' was not declared in this scope
It is the SPI instance name, so you have to declare it.

Anyway, those libraries seems only compatible with libmaple based core not STM one.
Moreover, some pins are hardcoded in the library.

kylix
Posts: 17
Joined: Mon Jul 10, 2017 6:30 pm

Re: STM32-RFM69

Post by kylix » Mon Dec 04, 2017 10:14 am

I'm using Arduino IDE 1.6.9 on Windows, with STM32 Core installed through the Board Manager. What else should I do in order to have the right gcc version?

It's strange that nobody has tried those libraries on F401RE yet ...
In July I was able to compile it without errors for an STM32L053R8 board (I was using a different version of the STM32 Core package) but there was no signal getting out of the RFM69HW module (checked with SDRSharp software and USB dongle). I suppose the problem could be related to libmaple compatibility you were talking about...

In the second library, the pins are not hardcoded: https://github.com/goran-mahovlic/RFM69-STM32

Thanks for your time!

fpiSTM
Posts: 250
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: STM32-RFM69

Post by fpiSTM » Mon Dec 04, 2017 8:18 pm

kylix wrote:
Mon Dec 04, 2017 10:14 am
It's strange that nobody has tried those libraries on F401RE yet ...
Maybe some have tested and fix issue themselves in the code library... :roll:

For this one, https://github.com/goran-mahovlic/RFM69-STM32
I've just tested and it still some SPI_def which has not been renamed.
I've only added

Code: Select all

#define SPI_def SPI
in the RFM69STM32.h file and build is ok for F401...
kylix wrote:
Mon Dec 04, 2017 10:14 am
What else should I do in order to have the right gcc version?
Start by checking which one is used thanks the build log. (preferences: show verbose output during compilation)

kylix
Posts: 17
Joined: Mon Jul 10, 2017 6:30 pm

Re: STM32-RFM69

Post by kylix » Mon Dec 04, 2017 10:08 pm

Thanks! It now compiles after adding "#define SPI_def SPI" and deleting the other version of gcc.
I'll let you know in case it works with the RFM69 module (hope to get some spare time during the weekend).

kylix
Posts: 17
Joined: Mon Jul 10, 2017 6:30 pm

Re: STM32-RFM69

Post by kylix » Fri Dec 08, 2017 3:31 pm

The SPI seems to work as I can read RFM69's registry and temperature. Unfortunately, it doesn't transmit anything at all...
As IRQ pin I tried both PA3 and PA10.

stevestrong
Posts: 1821
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: STM32-RFM69

Post by stevestrong » Fri Dec 08, 2017 8:27 pm

I think there is a bug in line 150: it should be _interruptPin instead of _interruptNum.

kylix
Posts: 17
Joined: Mon Jul 10, 2017 6:30 pm

Re: STM32-RFM69

Post by kylix » Fri Dec 08, 2017 9:12 pm

They are both used:

uint8_t _interruptPin;
uint8_t _interruptNum;

stevestrong
Posts: 1821
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: STM32-RFM69

Post by stevestrong » Fri Dec 08, 2017 9:18 pm

attachInterrupt() needs as first parameter the interrupt pin, not the interrupt number (whatever it supposed to mean).

kylix
Posts: 17
Joined: Mon Jul 10, 2017 6:30 pm

Re: STM32-RFM69

Post by kylix » Fri Dec 08, 2017 9:22 pm

Line 49: https://github.com/goran-mahovlic/RFM69 ... M69STM32.h

I think one is used for defining the STM32 PIN and the other for the equivalent PIN on Arduino.

Post Reply