RF24SH icon indicating copy to clipboard operation
RF24SH copied to clipboard

Silent crash

Open thomasqbrady opened this issue 11 years ago • 26 comments

Just built on RPi. Make all worked fine in both librf24/rpi and examples/rpi_master. Launching rpi_master (sudo ./rpi_master) resulted in an immediate silent crash.

My hardware works fine with the regular RF24 library (have a working example from that library, but interested in using your mesh network with a RPi master).

Put some debug messages in, and seeing that GenericStation gets instantiated twice, and immediately after the second time, the virtual ~GenericStation executes and the app crashes. G++ version issue or something?

thomasqbrady avatar Jul 01 '13 05:07 thomasqbrady

Hey Thomas.

I never had this problem, but to be honest I didn't used it on RPi for a while, maybe some update crashed some of my code? I don't know.

I will try to dig into this on the weekend.

Thanks.

matheusbrat avatar Jul 02 '13 15:07 matheusbrat

Great, thanks!

t h o m a s q b r a d y

On Jul 2, 2013, at 10:11 AM, Matheus Bratfisch [email protected] wrote:

Hey Thomas.

I never had this problem, but to be honest I didn't used it on RPi for a while, maybe some update crashed some of my code? I don't know.

I will try to dig into this on the weekend.

Thanks.

— Reply to this email directly or view it on GitHubhttps://github.com/x-warrior/RF24SH/issues/1#issuecomment-20351857 .

thomasqbrady avatar Jul 02 '13 15:07 thomasqbrady

The G++ version that my RPi has is: g++ (Debian 4.6.3-8+rpi1) 4.6.3

Which one are u using? Have u enabled SPI? "sudo gpio load spi"?

matheusbrat avatar Jul 02 '13 15:07 matheusbrat

I also have 4.6.3. I have definitely enabled SPI. I've had working RF24 builds with other libraries. Looking to use yours because of the mesh features.

t h o m a s q b r a d y

On Tuesday, July 2, 2013 at 10:30 AM, Matheus Bratfisch wrote:

The G++ version that my RPi has is: g++ (Debian 4.6.3-8+rpi1) 4.6.3 Which one are u using? Have u enabled SPI? "sudo gpio load spi"?

— Reply to this email directly or view it on GitHub (https://github.com/x-warrior/RF24SH/issues/1#issuecomment-20353250).

thomasqbrady avatar Jul 02 '13 15:07 thomasqbrady

I take that back. The command sudo gpio load api doesn't work. I must be using a different method. I'll check into this and get back to you.

t h o m a s q b r a d y

On Tuesday, July 2, 2013 at 10:30 AM, Matheus Bratfisch wrote:

sudo gpio load spi

thomasqbrady avatar Jul 02 '13 15:07 thomasqbrady

Take a look at: https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/ http://wiringpi.com/

If I record correctly this is what I'm using to access GPIO/SPI

matheusbrat avatar Jul 02 '13 15:07 matheusbrat

Yup. Installing now.

t h o m a s q b r a d y

On Tuesday, July 2, 2013 at 10:37 AM, Matheus Bratfisch wrote:

Take a look at: https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/ http://wiringpi.com/
I guess this is what I'm using to access GPIO/SPI

— Reply to this email directly or view it on GitHub (https://github.com/x-warrior/RF24SH/issues/1#issuecomment-20353733).

thomasqbrady avatar Jul 02 '13 15:07 thomasqbrady

Okay, GPIO is intalled and SPI is loaded, and I'm getting the same problem.

I'm noticing that GenericStation gets instantiated twice, immediately, and then one gets destroyed, and there's a SIGTERM when the second one is attempting to destroy immediately after. It crashes in less than a second.

t h o m a s q b r a d y

On Tuesday, July 2, 2013 at 10:40 AM, Thomas Q Brady wrote:

Yup. Installing now.

t h o m a s q b r a d y

On Tuesday, July 2, 2013 at 10:37 AM, Matheus Bratfisch wrote:

Take a look at: https://projects.drogon.net/raspberry-pi/wiringpi/the-gpio-utility/ http://wiringpi.com/
I guess this is what I'm using to access GPIO/SPI

— Reply to this email directly or view it on GitHub (https://github.com/x-warrior/RF24SH/issues/1#issuecomment-20353733).

thomasqbrady avatar Jul 02 '13 15:07 thomasqbrady

That is odd. I just recloned this repo in my RPi and compiled /examples/rpi_master with make.

And executed with sudo ./rpi_master and it didn't crash.

Have u done any change to the source codes? What is your RPI version?

matheusbrat avatar Jul 02 '13 15:07 matheusbrat

I have added some printf statements, but it was crashing before I added those. I can start from scratch and try again.

I'll send a stack trace after I try it.

t h o m a s q b r a d y

On Tuesday, July 2, 2013 at 10:58 AM, Matheus Bratfisch wrote:

That is odd. I just recloned this repo in my RPi and compiled /examples/rpi_master with make.
And executed with sudo ./rpi_master and it didn't crash.
Have u done any change to the source codes?

— Reply to this email directly or view it on GitHub (https://github.com/x-warrior/RF24SH/issues/1#issuecomment-20355333).

thomasqbrady avatar Jul 02 '13 15:07 thomasqbrady

Okay, here's what I did, step-by-step:

pi@professor-x ~ $ git clone https://github.com/x-warrior/RF24SH.git Cloning into 'RF24SH'... remote: Counting objects: 217, done. remote: Compressing objects: 100% (95/95), done. remote: Total 217 (delta 115), reused 216 (delta 114) Receiving objects: 100% (217/217), 60.79 KiB | 17 KiB/s, done. Resolving deltas: 100% (115/115), done. pi@professor-x ~ $ cd RF24SH/ pi@professor-x ~/RF24SH $ cd librf24/rpi pi@professor-x ~/RF24SH/librf24/rpi $ make all g++ -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c RF24.cpp RF24.h: In constructor ‘RF24::RF24(std::string, uint32_t, uint8_t)’: RF24.h:60:11: warning: ‘RF24::spispeed’ will be initialized after [-Wreorder] RF24.h:51:11: warning: ‘uint8_t RF24::csn_pin’ [-Wreorder] RF24.cpp:241:1: warning: when initialized here [-Wreorder] compatibility.h: At global scope: compatibility.h:18:23: warning: ‘start’ defined but not used [-Wunused-variable] compatibility.h:18:30: warning: ‘end’ defined but not used [-Wunused-variable] compatibility.h:19:13: warning: ‘mtime’ defined but not used [-Wunused-variable] compatibility.h:19:20: warning: ‘seconds’ defined but not used [-Wunused-variable] compatibility.h:19:29: warning: ‘useconds’ defined but not used [-Wunused-variable] g++ -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c gpio.cpp g++ -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c spi.cpp gcc -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c compatibility.c compatibility.c: In function ‘msleep’: compatibility.c:13:2: warning: implicit declaration of function ‘nanosleep’ [-Wimplicit-function-declaration] g++ -shared -Wl,-soname,librf24.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -o librf24.so.1.0 compatibility.o gpio.o spi.o RF24.o pi@professor-x ~/RF24SH/librf24/rpi $ cd ../../examples/rpi_master/ pi@professor-x ~/RF24SH/examples/rpi_master $ make all cd ../../librf24/rpi; make all make[1]: Entering directory /home/pi/RF24SH/librf24/rpi' g++ -shared -Wl,-soname,librf24.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -o librf24.so.1.0 compatibility.o gpio.o spi.o RF24.o make[1]: Leaving directory/home/pi/RF24SH/librf24/rpi' g++ -L../../librf24/rpi/ -lrf24 ../../config.h ../../GenericStation.h ../../MasterStation.h ../../PMessage.h ../../GenericStation.cpp ../../MasterStation.cpp ../../PMessage.cpp rpi_master.cpp -o rpi_master ../../GenericStation.cpp: In member function ‘bool GenericStation::writePipe(uint64_t, PMessage)’: ../../GenericStation.cpp:72:5: warning: deprecated conversion from string constant to ‘char’ [-Wwrite-strings] ../../GenericStation.cpp:75:9: warning: deprecated conversion from string constant to ‘char’ [-Wwrite-strings] ../../GenericStation.cpp:77:9: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../GenericStation.cpp: In member function ‘void GenericStation::print()’: ../../GenericStation.cpp:84:5: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../GenericStation.cpp:86:5: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../GenericStation.cpp:89:9: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../GenericStation.cpp:94:9: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../GenericStation.cpp: In member function ‘bool GenericStation::read(uint8_t_, PMessage&)’: ../../GenericStation.cpp:165:9: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../GenericStation.cpp: In member function ‘PMessage GenericStation::processRead(PMessage)’: ../../GenericStation.cpp:183:13: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../GenericStation.cpp:186:13: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../MasterStation.cpp: In member function ‘virtual void MasterStation::receivedWhoListen(PMessage)’: ../../MasterStation.cpp:78:5: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../MasterStation.cpp: In member function ‘virtual void MasterStation::receivedAskConfig(PMessage)’: ../../MasterStation.cpp:95:5: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../MasterStation.cpp:97:5: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../MasterStation.cpp:99:5: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../MasterStation.cpp:104:13: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../MasterStation.cpp:110:13: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../PMessage.cpp: In member function ‘void PMessage::print()’: ../../PMessage.cpp:46:2: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../PMessage.cpp:48:2: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../PMessage.cpp:50:2: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../PMessage.cpp:52:2: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../PMessage.cpp:54:2: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../PMessage.cpp:56:2: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] ../../PMessage.cpp:58:2: warning: deprecated conversion from string constant to ‘char_’ [-Wwrite-strings] pi@professor-x ~/RF24SH/examples/rpi_master $ sudo ./rpi_master pi@professor-x ~/RF24SH/examples/rpi_master $

Then I added debug flags to all the make instructions, and did this:

pi@professor-x ~/RF24SH/examples/rpi_master $ sudo gdb ./rpi_master GNU gdb (GDB) 7.4.1-debian Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "arm-linux-gnueabihf". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /home/pi/RF24SH/examples/rpi_master/rpi_master...done. (gdb) run Starting program: /home/pi/RF24SH/examples/rpi_master/rpi_master

Program received signal SIGSEGV, Segmentation fault. 0xb6f901c0 in ?? () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6

t h o m a s q b r a d y

On Tuesday, July 2, 2013 at 10:59 AM, Thomas Q Brady wrote:

I have added some printf statements, but it was crashing before I added those. I can start from scratch and try again.

I'll send a stack trace after I try it.

t h o m a s q b r a d y

On Tuesday, July 2, 2013 at 10:58 AM, Matheus Bratfisch wrote:

That is odd. I just recloned this repo in my RPi and compiled /examples/rpi_master with make.
And executed with sudo ./rpi_master and it didn't crash.
Have u done any change to the source codes?

— Reply to this email directly or view it on GitHub (https://github.com/x-warrior/RF24SH/issues/1#issuecomment-20355333).

thomasqbrady avatar Jul 02 '13 16:07 thomasqbrady

Here's a backtrace from DDD:

#6 0x0000c328 in main () at rpi_master.cpp:19 #5 0x0000ac94 in MasterStation::MasterStation () at MasterStation.cpp:10 #4 0x000093fc in GenericStation::GenericStation () at GenericStation.cpp:26 #3 0xb6fb96b0 in RF24::begin() from librf24.so.1 #2 0xb6fb8348 in GPIO::open() from librf24.so.1 #1 0xb6d69848 in fprintf () form libc.so.6 #0 0xb6d601ec in vfprintf () from libc.so.6

thomasqbrady avatar Jul 02 '13 17:07 thomasqbrady

Tried an experiment. Swapped in Stanley Seow's RF24 lib for the contents of librf24/rpi, and it no longer crashes on launch. Can't tell that it's actually working, but it's not crashing.

thomasqbrady avatar Jul 02 '13 21:07 thomasqbrady

Link for it? On Jul 2, 2013 6:39 PM, "Thomas Q Brady" [email protected] wrote:

Tried an experiment. Swapped in Stanley Seow's RF24 lib for the contents of librf24/rpi, and it no longer crashes on launch. Can't tell that it's actually working, but it's not crashing.

— Reply to this email directly or view it on GitHubhttps://github.com/x-warrior/RF24SH/issues/1#issuecomment-20379545 .

matheusbrat avatar Jul 02 '13 22:07 matheusbrat

https://github.com/stanleyseow/RF24

thomasqbrady avatar Jul 02 '13 23:07 thomasqbrady

I'm trying to reproduce it. It is kind of hard.

Can you list 'files'/permissions inside /sys/class/gpio? Could you try some debug inside librf24/rpi/gpio.cpp on method open. Print port and ddr and stuff.

What RPi are you using? I'm using the first released version.

matheusbrat avatar Jul 03 '13 05:07 matheusbrat

Maybe try rpi_station too, just to check if it crashes too.

matheusbrat avatar Jul 03 '13 05:07 matheusbrat

How do I print port and ddr?

I have a rev B Pi.

t h o m a s q b r a d y

On Jul 3, 2013, at 12:35 AM, Matheus Bratfisch [email protected] wrote:

I'm trying to reproduce it. It is kind of hard.

Can you list 'files'/permissions inside /sys/class/gpio? Could you try some debug inside librf24/rpi/gpio.cpp on method open. Print port and ddr and stuff.

What RPi are you using? I'm using the first released version.

— Reply to this email directly or view it on GitHubhttps://github.com/x-warrior/RF24SH/issues/1#issuecomment-20396587 .

thomasqbrady avatar Jul 03 '13 05:07 thomasqbrady

Will list permissions tomorrow morning. Pi's at work.

t h o m a s q b r a d y

On Jul 3, 2013, at 12:35 AM, Matheus Bratfisch [email protected] wrote:

I'm trying to reproduce it. It is kind of hard.

Can you list 'files'/permissions inside /sys/class/gpio? Could you try some debug inside librf24/rpi/gpio.cpp on method open. Print port and ddr and stuff.

What RPi are you using? I'm using the first released version.

— Reply to this email directly or view it on GitHubhttps://github.com/x-warrior/RF24SH/issues/1#issuecomment-20396587 .

thomasqbrady avatar Jul 03 '13 05:07 thomasqbrady

I did try that, and it did crash.

t h o m a s q b r a d y

On Jul 3, 2013, at 12:39 AM, Matheus Bratfisch [email protected] wrote:

Maybe try rpi_station too, just to check if it crashes too.

— Reply to this email directly or view it on GitHubhttps://github.com/x-warrior/RF24SH/issues/1#issuecomment-20396676 .

thomasqbrady avatar Jul 03 '13 05:07 thomasqbrady

Take a look into https://github.com/x-warrior/RF24SH/blob/master/librf24/rpi/gpio.cpp

port and ddr are params to GPIO::open, just print it as any other debug message.

matheusbrat avatar Jul 03 '13 05:07 matheusbrat

Any new update?

matheusbrat avatar Jul 04 '13 15:07 matheusbrat

No, I'm on a deadline, so I've had to go another route. I hope to come to this, though. Your DNS server-like features are definitely on my roadmap.

t h o m a s q b r a d y

On Jul 4, 2013, at 10:22 AM, Matheus Bratfisch [email protected] wrote:

Any new update?

— Reply to this email directly or view it on GitHubhttps://github.com/x-warrior/RF24SH/issues/1#issuecomment-20482522 .

thomasqbrady avatar Jul 04 '13 15:07 thomasqbrady

Please keep me posted. If I find anything else I will let you know.

If you have any question or need any other help, please let me know.

matheusbrat avatar Jul 04 '13 15:07 matheusbrat

I set up a mesh of Arduinos (3) with the Arduino master and station examples to see how long you have to wait when adding each node. Can that time (seemed like 60-120 seconds) be optimized?

t h o m a s q b r a d y

On Jul 4, 2013, at 10:43 AM, Matheus Bratfisch [email protected] wrote:

Please keep me posted. If I find anything else I will let you know.

If you have any question or need any other help, please let me know.

— Reply to this email directly or view it on GitHubhttps://github.com/x-warrior/RF24SH/issues/1#issuecomment-20483426 .

thomasqbrady avatar Jul 04 '13 17:07 thomasqbrady

I guess so. But that wasn't exactly a priority.

matheusbrat avatar Jul 05 '13 15:07 matheusbrat