Project

General

Profile

Resolved: Beginners problem with RFM69 on Raspberry Pi

Added by Rolf 3 months ago

Hi,
just started trying the RFM69 radio on Raspberry Pi according to:
http://jeelabs.org/wp-content/uploads/2015/05/20/rfm69-on-raspberry-pi/index.html
and ran into a stupid beginners software problem. Installed WiringPi (on RPi B, 250 MB RAM, Debian Jessie light OS), downloaded Embello-master, switched to the directory "embello-master/lib/test-raspi-linux" and tried to compile rf69spi.cpp with "make" (make and gcc installed), and got the following error message - I think it's a stupid mistake from my side, but do not how where to look for at the moment - :

g++ -I../arch-raspi -I../driver rf69spi.cpp -lwiringPi -lwiringPiDev -lpthread -o rf69spi
In file included from rf69spi.cpp:8:0:
../arch-raspi/spi.h: In static member function ‘static void SpiDev::pseudoDma(const SpiDev::Chunk*, int)’:
../arch-raspi/spi.h:36:53: error: there are no arguments to ‘malloc’ that depend on a template parameter, so a declaration of ‘malloc’ must be available [-fpermissive]
uint8_t* buf = (uint8_t*) malloc(totalLength);
^
../arch-raspi/spi.h:36:53: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../arch-raspi/spi.h:59:17: error: there are no arguments to ‘free’ that depend on a template parameter, so a declaration of ‘free’ must be available [-fpermissive]
free(buf);
^
: recipe for target 'rf69spi' failed
make: *** [rf69spi] Error 1
...
Meanwhile I realized that I forgot to enable SPI in raspi-config. With this done I tried "gpio load spi" to enable SPI in wiringpi, but got an error message that "device tree" had to be disabled. This I tried by adding the line "device_tree=" in /boot/config.txt. But still the same error message.

Does anyone have experience with Raspian and wiringpi?
...
Aahh - "stupid beginners problems" are the worst.
It seems that "gpio load spi" ist not necessary, configuring SPI with raspi-config is enough. The above mentioned compiler error can be overcome by adding the compiler option "-fpermissive". I did this before, but without previously configuring SPI. Now, with "-fpermissive" and SPI configured, ignore the compiler warnings and it works.