Skip to content

Pi Zero W - Segmentation fault #70

Description

@askolds11

I'm trying to run the jpeg_capture example minimally modified on my Pi Zero W, however after the file is written and function is exiting, there's a Segmentation fault.

I am not running it using cargo run, but I cross compile it first - fresh cargo project, copied code from jpeg_capture.rs. To run it, I added drm_fourcc and changed PIXEL_FORMAT_MJPEG to PixelFormat::new(DrmFourcc::Bgr888 as u32, 0); as MJPEG does not exist for Pi Camera 2, and removed the MJPEG check. The file is written correctly (it's raw bytes, but I can manage to get a proper image out of it with some post processing).

For cross compilation I'm using a docker image with armv6 compiler, using readelf I've confirmed that the binary is armv6. (can attach a Dockerfile if needed, very messy as I'm new to docker as well)

I am not very experienced in Rust, much less with C++ stuff being included, what are my next debugging steps so that I can attach more info here?

Here's all I get when running it:

pizero@pizero:~/app $ ./examplerun Test.jpg
[1:24:49.772349000] [1155]  INFO Camera camera_manager.cpp:326 libcamera v0.5.0+59-d83ff0a4
[1:24:49.972790000] [1158]  WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[1:24:49.993880000] [1158]  INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media1 and ISP device /dev/media0
Using camera: imx219
Generated config: [
    StreamConfigurationRef {
        pixel_format: BGR888,
        size: Size {
            width: 800,
            height: 600,
        },
        stride: 0,
        frame_size: 0,
        buffer_count: 4,
    },
]
Camera configuration valid!
[1:24:50.006120000] [1155]  INFO Camera camera.cpp:1205 configuring streams: (0) 800x600-BGR888
[1:24:50.009351000] [1158]  INFO RPI vc4.cpp:622 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1640x1232-SBGGR10_1X10 - Selected unicam format: 1640x1232-pBAA
Allocated 4 buffers
Waiting for camera request execution
Camera request Request { seq: 0, status: Complete, cookie: 0 } completed!
Metadata: {
    ExposureTime: ExposureTime(
        31417,
    ),
    ColourGains: ColourGains(
        [
            1.317261,
            1.97871,
        ],
    ),
    AnalogueGain: AnalogueGain(
        4.0,
    ),
    FrameDuration: FrameDuration(
        33326,
    ),
    Lux: Lux(
        126.03245,
    ),
    DigitalGain: DigitalGain(
        1.0934693,
    ),
    AeState: Searching,
    ColourTemperature: ColourTemperature(
        3453,
    ),
    SensorBlackLevels: SensorBlackLevels(
        [
            4096,
            4096,
            4096,
            4096,
        ],
    ),
    FocusFoM: FocusFoM(
        2400,
    ),
    ColourCorrectionMatrix: ColourCorrectionMatrix(
        [
            [
                2.205969,
                -0.6353007,
                -0.57067066,
            ],
            [
                -0.77581555,
                2.6748166,
                -0.89899105,
            ],
            [
                -0.25539201,
                -0.9860034,
                2.241393,
            ],
        ],
    ),
    ScalerCrop: ScalerCrop(
        Rectangle {
            x: 0,
            y: 2,
            width: 3280,
            height: 2460,
        },
    ),
    47: Int64(
        [
            1752088345034157,
        ],
    ),
    SensorTimestamp: SensorTimestamp(
        5090336385000,
    ),
}
FrameBuffer metadata: Some(
    Immutable(
        FrameMetadataRef {
            status: Success,
            sequence: 7,
            timestamp: 5090336385000,
            planes: [
                libcamera_frame_metadata_plane {
                    bytes_used: 1440000,
                },
            ],
        },
    ),
)
Written 1440000 bytes to Test.jpg
Segmentation fault

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions