Segmentation Fault: gyro_accel_tutorial02_inclinometer

Forums Technical Support for BerryIMU Segmentation Fault: gyro_accel_tutorial02_inclinometer

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #16665
    ryanrsm
    Participant

    I keep getting a segmentation fault after the first line of accel/gyro data prints to the shell, when trying to run the gyro_accelerometer_tutorial02_inclimometer code. I am using the BerryIMUv2 on a Raspberry Pi Zero with the latest OS (updated/upgraded). Powered w/ a USB battery pack (see attached)

    I have tried with HDMI cable connected, displaying the Pi desktop on a monitor, as well as with VNC Viewer. Neither works.

    I am also sure my SDL install went well because when I run the sample code to display a black window with a white box, it seems to work. To triple check, I even changed the lines

    rect.w = 10;
    rect.h = 10;

    to be

    rect.w = 200;
    rect.h = 200;

    And rerunning with "./test" (see attached) and sure enough, the white box shows up with 10x10 pixel padding, then a 200x200 white box. This tells me that SDL installed correctly, and the gcc compiler is compiling fine.

    But when I compile the gyro_accelerometer_tutorial02.c code with the copy/paste compile line from the "README" file (see attached), and run "sudo ./gyro_accelerometer_tutorial02" it spits out the first line of gyro/accel data, but then gives Segmentation fault.

    Maybe worth noting, I do see, for a split second, a window appear on my screen (looks to be totally black) before it dies and I get the seg fault msg.

    Lastly, just to be sure, I also included an attachment here to show a screengrab of data spewing out into the command window from running the "tutorial01_angles" code. This demonstrates that my IMU is at least functional. I was moving it around rapidly when the data was logging.

    So...what is causing the Segmentation fault? I'm new to SDL. Have never used it before....

    Thanks!

    #16676
    jaume
    Participant

    I don't know why segmentation fault comes out, but I have managed to make the inclinometer work like this:
    1.- I have put the startSDL () and graphics () functions in a program called sdl.c (like the compas application), like: void startSDL () with int graphics ().
    2.- I have adjusted the screen variable in current_w-300 and current_h-140 because the raspberry work with a 4 "screen.
    3.- Other personal settings (that do not affect).
    4.- It only works if you call the program from a terminal after starting the graphic mode with startx.

    Jaume

    #16678
    jaume
    Participant

    Inclinometer with RaspberryPi B+ and Hyperpixel screen

    OK

    Attachments:
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Blip, blop, bloop...