Antivirusvivente
Posts: 130
Joined: Fri Dec 07, 2012 4:01 pm
Location: Bari
Contact: Website

Problem using SPI and RF24 library

Wed Sep 18, 2013 11:26 am

Ok guys, i'm trying to connect two master-slave devices to each other, so i bought these 2.4GHz modules and i connected them pretty well to both Arduino and Raspberry Pi..

Here's the topic: http://conoroneill.net/arduino-and-rasp ... 1-modules/

I've installed everything correctly into my Arduino and it seems to work (except that anything comes to the Serial Monitor due to Raspberry, it's disconnected)

But here's my problem, i'm trying to install the libraries to the Pi, but I got several errors,

Code: Select all

g++ -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c RF24.cpp
gcc -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c bcm2835.c
g++ -shared -Wl,-soname,librf24-bcm.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -o librf24-bcm.so.1.0 RF24.o bcm2835.o
/usr/bin/ld: error: RF24.o uses VFP register arguments, librf24-bcm.so.1.0 does not
/usr/bin/ld: failed to merge target specific data of file RF24.o
/usr/bin/ld: error: bcm2835.o uses VFP register arguments, librf24-bcm.so.1.0 does not
/usr/bin/ld: failed to merge target specific data of file bcm2835.o
collect2: ld returned 1 exit status
make: *** [librf24-bcm] Error 1
I guess because I got the soft float version of Raspbian. How can I fix this problem without changing my distro? Thanks for help and sorry for my bad english
DomoHome is coming! - RaspberryPi ~ Raspbian ~ Android
https://www.facebook.com/pages/Domohome/155791057916884

User avatar
joan
Posts: 14471
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Problem using SPI and RF24 library

Wed Sep 18, 2013 11:34 am

Remove these options

-mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s

and try again.

Code: Select all

g++ -Wall -fPIC -Ofast  -c RF24.cpp
gcc -Wall -fPIC -Ofast  -c bcm2835.c
g++ -shared -Wl,-soname,librf24-bcm.so.1 -Ofast  -o librf24-bcm.so.1.0 RF24.o bcm2835.o

Antivirusvivente
Posts: 130
Joined: Fri Dec 07, 2012 4:01 pm
Location: Bari
Contact: Website

Re: Problem using SPI and RF24 library

Wed Sep 18, 2013 11:36 am

Same error..

Code: Select all

[email protected] ~/gitwork/RF24/librf24-rpi/librf24-bcm $ sudo make
g++ -shared -Wl,-soname,librf24-bcm.so.1 -Ofast -o librf24-bcm.so.1.0 RF24.o bcm2835.o
/usr/bin/ld: error: RF24.o uses VFP register arguments, librf24-bcm.so.1.0 does not
/usr/bin/ld: failed to merge target specific data of file RF24.o
/usr/bin/ld: error: bcm2835.o uses VFP register arguments, librf24-bcm.so.1.0 does not
/usr/bin/ld: failed to merge target specific data of file bcm2835.o
collect2: ld returned 1 exit status
make: *** [librf24-bcm] Error 1
DomoHome is coming! - RaspberryPi ~ Raspbian ~ Android
https://www.facebook.com/pages/Domohome/155791057916884

User avatar
joan
Posts: 14471
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Problem using SPI and RF24 library

Wed Sep 18, 2013 12:02 pm

Did you recompile?

g++ -Wall -fPIC -Ofast -c RF24.cpp
gcc -Wall -fPIC -Ofast -c bcm2835.c

Antivirusvivente
Posts: 130
Joined: Fri Dec 07, 2012 4:01 pm
Location: Bari
Contact: Website

Re: Problem using SPI and RF24 library

Wed Sep 18, 2013 12:08 pm

joan wrote:Did you recompile?

g++ -Wall -fPIC -Ofast -c RF24.cpp
gcc -Wall -fPIC -Ofast -c bcm2835.c
I did the command that you have written to me, and then i do Sudo makefile but i still have these errors:

Code: Select all

[email protected] ~/gitwork/RF24/librf24-rpi/librf24-bcm $ g++ -Wall -fPIC -Ofast -c RF24.cpp

[email protected] ~/gitwork/RF24/librf24-rpi/librf24-bcm $
[email protected] ~/gitwork/RF24/librf24-rpi/librf24-bcm $ gcc -Wall -fPIC -Ofast -c bcm2835.c
[email protected] ~/gitwork/RF24/librf24-rpi/librf24-bcm $ sudo make
g++ -shared -Wl,-soname,librf24-bcm.so.1 -Ofast -o librf24-bcm.so.1.0 RF24.o bcm2835.o
[Install]
#@install -m 0755 librf24-bcm.a /usr/local/lib
ldconfig: /usr/lib/libstdc++.so.5.0.1 is for unknown machine 3.

ldconfig: /usr/lib/libstdc++.so.5 is for unknown machine 3.
DomoHome is coming! - RaspberryPi ~ Raspbian ~ Android
https://www.facebook.com/pages/Domohome/155791057916884

User avatar
joan
Posts: 14471
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Problem using SPI and RF24 library

Wed Sep 18, 2013 12:19 pm

That may be the result of some previous steps.

Are you compiling on a soft float machine?

Are you compiling for a soft float machine.

Your original scripts seemed to be cross-compiling for a hard float architecture.

Antivirusvivente
Posts: 130
Joined: Fri Dec 07, 2012 4:01 pm
Location: Bari
Contact: Website

Re: Problem using SPI and RF24 library

Wed Sep 18, 2013 12:27 pm

joan wrote:That may be the result of some previous steps.

Are you compiling on a soft float machine?

Are you compiling for a soft float machine.

Your original scripts seemed to be cross-compiling for a hard float architecture.
I never met this kind of problem, because i never used my Raspberry for C libraries. I always used it in Python

So now i downloaded these examples and i wanted to let it work. I guess my Raspbian version is soft-float. I Need to download the latest version of Raspbian? I don't want to lose my configurations

Or can you write me down a full-list of instructions to do for my Raspberry to let it work with that library? Thanks for help
DomoHome is coming! - RaspberryPi ~ Raspbian ~ Android
https://www.facebook.com/pages/Domohome/155791057916884

Antivirusvivente
Posts: 130
Joined: Fri Dec 07, 2012 4:01 pm
Location: Bari
Contact: Website

Re: Problem using SPI and RF24 library

Wed Sep 18, 2013 1:50 pm

Solved changing version with hard float version.

Now the problem is another one.. Arduino sends data but the Pi doesn't receive it.

I followed this configuration: http://arduino-for-beginners.blogspot.i ... es-to.html

It seems that it doesn't receive data pretty well. Sometimes i got messages and sometimes nothing
DomoHome is coming! - RaspberryPi ~ Raspbian ~ Android
https://www.facebook.com/pages/Domohome/155791057916884

Return to “Interfacing (DSI, CSI, I2C, etc.)”