What I have
Raspberry Pi 3 B
RF24L01
How I've Connected It
Based on the library indications:
RF24L01 pin | RPi 3B
1 GND | 9 GND
2 VCC | 1 (3.3V)
3 CE | 15 (GPIO22)
4 CSN | 24 (GPIO8) (CE0)
5 SCK | 23 (GPIO11) (SPI_CLK)
6 MOSI | 19 (GPIO10) (SPI_MOSI)
7 MISO | 21 (GPIO9) (SPI_MISO)
The Code (Executable, built using TMRh20 library)
#include <RF24/RF24.h>
using namespace std;
// Pin 22 used for CE, as said before in pin connections
RF24 radio(22,0);
int main(int argc, char** argv)
{
printf("Starting...\n");
radio.begin();
printf("Done\n");
return 0;
}
Output
Problem / Question
As you can see, a segmentation fault
error (in Spanish) happened. I've also activated the SPI interface using:
sudo raspi-config
So, why do I get this execution error?
Isn't the initialization valid?
Update
I've also tried moving ping CE from RF24, that was connected to GPIO22 (pin 15) to pin 26 (CE1), because I saw this in the dependence BCM2835.
Then, I enabled SPI again, built and execute again, getting the same result.
gdb ./test
(if gdb is not installed,sudo apt install gdb
). When you get to a prompt, typerun
. The seg fault will be caught, and you will get another prompt. Enterbt
(backtrace). If the output is not too long, cut and paste it here. Please don't use screenshots for text.gdb ./test
arm-linux- ... -abi=hard
with the lettersgcc