Bayer(RGGB8) internal data stream error

Hello NVIDIA,

We have a Jetson Nano developer kit and develop our own driver of CSI-MIPI camera.

We have developed a RAW8 and RGB888 driver and have successfully captured images from the CSI-MIPI camera.

We are currently developing a Bayer (RGGB8) driver, but it is not working due to an error.
“internal data stream error”

Do you have any debug techniques?

Enable the debug print in csi2_fops/vi2_fops.c to get information to analysis the problem.

We use JetPack 4.6.3 (Jetson Linux 32.7.3).
Does this version support Bayer RGGB8?

We checked the debug logs.
Can you tell anything from these logs?

error log

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

jounal log

-- Logs begin at Fri 2023-04-21 06:07:14 UTC. --
Apr 21 06:34:28 PureSpectra dhcpd[5905]: DHCPREQUEST for 192.168.55.100 from 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:34:28 PureSpectra dhcpd[5905]: DHCPACK on 192.168.55.100 to 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:34:35 PureSpectra dhcpd[5905]: DHCPREQUEST for 192.168.55.100 from 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:34:35 PureSpectra dhcpd[5905]: DHCPACK on 192.168.55.100 to 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:34:43 PureSpectra dhcpd[5905]: DHCPREQUEST for 192.168.55.100 from 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:34:43 PureSpectra dhcpd[5905]: DHCPACK on 192.168.55.100 to 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:34:49 PureSpectra dhcpd[5905]: DHCPREQUEST for 192.168.55.100 from 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:34:49 PureSpectra dhcpd[5905]: DHCPACK on 192.168.55.100 to 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:34:56 PureSpectra dhcpd[5905]: DHCPREQUEST for 192.168.55.100 from 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:34:56 PureSpectra dhcpd[5905]: DHCPACK on 192.168.55.100 to 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:35:03 PureSpectra dhcpd[5905]: DHCPREQUEST for 192.168.55.100 from 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:35:03 PureSpectra dhcpd[5905]: DHCPACK on 192.168.55.100 to 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:35:10 PureSpectra kernel: pscam_c5_548 7-0052: pscam_open:
Apr 21 06:35:10 PureSpectra kernel: pscam_c5_991 8-0053: pscam_open:
Apr 21 06:35:10 PureSpectra kernel: pscam: Called pscam_power_on
Apr 21 06:35:10 PureSpectra kernel: pscam_c5_548 7-0052: pscam_power_on: power on
Apr 21 06:35:10 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:10 PureSpectra kernel: pscam: Skip power sequence
Apr 21 06:35:10 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:10 PureSpectra kernel: pscam: End of pscam_power_on successfully
Apr 21 06:35:10 PureSpectra kernel: pscam: "pscam_set_mode" Required mode 0
Apr 21 06:35:10 PureSpectra dhcpd[5905]: DHCPREQUEST for 192.168.55.100 from 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:35:10 PureSpectra dhcpd[5905]: DHCPACK on 192.168.55.100 to 96:00:aa:1a:4f:15 (MiniPC) via l4tbr0
Apr 21 06:35:10 PureSpectra kernel: pscam: Start streaming!
Apr 21 06:35:10 PureSpectra kernel: vi 54080000.vi: Calibrate csi port 0
Apr 21 06:35:10 PureSpectra kernel: pscam: Stop streaming!
Apr 21 06:35:10 PureSpectra kernel: pscam: Called pscam_power_off
Apr 21 06:35:10 PureSpectra kernel: pscam_c5_548 7-0052: pscam_power_off: power off
Apr 21 06:35:10 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:10 PureSpectra kernel: pscam: End of pscam_power_off successfully
Apr 21 06:35:10 PureSpectra kernel: pscam: Called pscam_power_on
Apr 21 06:35:10 PureSpectra kernel: pscam_c5_991 8-0053: pscam_power_on: power on
Apr 21 06:35:10 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:10 PureSpectra kernel: pscam: Skip power sequence
Apr 21 06:35:10 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:11 PureSpectra kernel: pscam: End of pscam_power_on successfully
Apr 21 06:35:11 PureSpectra kernel: pscam: "pscam_set_mode" Required mode 0
Apr 21 06:35:11 PureSpectra kernel: pscam: Start streaming!
Apr 21 06:35:11 PureSpectra kernel: vi 54080000.vi: Calibrate csi port 4
Apr 21 06:35:11 PureSpectra kernel: pscam: Stop streaming!
Apr 21 06:35:11 PureSpectra kernel: pscam: Called pscam_power_off
Apr 21 06:35:11 PureSpectra kernel: pscam_c5_991 8-0053: pscam_power_off: power off
Apr 21 06:35:11 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:11 PureSpectra kernel: pscam: End of pscam_power_off successfully
Apr 21 06:35:11 PureSpectra kernel: pscam: Called pscam_power_on
Apr 21 06:35:11 PureSpectra kernel: pscam_c5_548 7-0052: pscam_power_on: power on
Apr 21 06:35:11 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:11 PureSpectra kernel: pscam: Skip power sequence
Apr 21 06:35:11 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:11 PureSpectra kernel: pscam: End of pscam_power_on successfully
Apr 21 06:35:11 PureSpectra kernel: pscam: Called pscam_power_off
Apr 21 06:35:11 PureSpectra kernel: pscam_c5_548 7-0052: pscam_power_off: power off
Apr 21 06:35:11 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:11 PureSpectra kernel: pscam: End of pscam_power_off successfully
Apr 21 06:35:11 PureSpectra kernel: pscam: Called pscam_power_on
Apr 21 06:35:11 PureSpectra kernel: pscam_c5_991 8-0053: pscam_power_on: power on
Apr 21 06:35:11 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:11 PureSpectra kernel: pscam: Skip power sequence
Apr 21 06:35:11 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:11 PureSpectra kernel: pscam: End of pscam_power_on successfully
Apr 21 06:35:11 PureSpectra kernel: pscam: Called pscam_power_off
Apr 21 06:35:11 PureSpectra kernel: pscam_c5_991 8-0053: pscam_power_off: power off
Apr 21 06:35:11 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:11 PureSpectra kernel: pscam: End of pscam_power_off successfully
Apr 21 06:35:11 PureSpectra kernel: pscam: Called pscam_power_on
Apr 21 06:35:11 PureSpectra kernel: pscam_c5_548 7-0052: pscam_power_on: power on
Apr 21 06:35:11 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:11 PureSpectra kernel: pscam: Skip power sequence
Apr 21 06:35:11 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:11 PureSpectra kernel: pscam: End of pscam_power_on successfully
Apr 21 06:35:11 PureSpectra kernel: pscam: Called pscam_power_off
Apr 21 06:35:11 PureSpectra kernel: pscam_c5_548 7-0052: pscam_power_off: power off
Apr 21 06:35:11 PureSpectra kernel: pscam: Force GPIO-reset
Apr 21 06:35:11 PureSpectra kernel: pscam: End of pscam_power_off successfully

gst-device-monitor log

Device found:

	name  : vi-output, pscam_c5_548 7-0052
	class : Video/Source
	caps  : video/x-bayer, format=(string)rggb, width=(int)2448, height=(int)2048, framerate=(fraction)48/1;
	properties:
		udev-probed = true
		device.bus_path = platform-54080000.vi
		sysfs.path = /sys/devices/50000000.host1x/54080000.vi/video4linux/video0
		device.subsystem = video4linux
		device.product.name = "vi-output\,\ pscam_c5_548\ 7-0052"
		device.capabilities = :capture:
		device.api = v4l2
		device.path = /dev/video0
		v4l2.device.driver = tegra-video
		v4l2.device.card = "vi-output\,\ pscam_c5_548\ 7-0052"
		v4l2.device.bus_info = platform:54080000.vi:0
		v4l2.device.version = 264701 (0x000409fd)
		v4l2.device.capabilities = 2216689665 (0x84200001)
		v4l2.device.device_caps = 69206017 (0x04200001)
	gst-launch-1.0 v4l2src ! ...
  1. Didn’t see the error message from csi2_fops.c from kernel message.
  2. Using v4l2-ctl to verify the driver.

https://docs.nvidia.com/jetson/archives/r35.3.1/DeveloperGuide/text/SD/CameraDevelopment/SensorSoftwareDriverProgramming.html#to-run-a-v4l2-ctl-test

Thank you for your advice.

How do you feel about the following?

We use JetPack 4.6.3 (Jetson Linux 32.7.3).
Does this version support Bayer RGGB8?

Argus don’t support RAW8 but v4l2-ctl can.

There has been some progress.

No “internal data stream error” occurs.
But I still can’t get the correct image.
image

Could you advise on the following points?

1.Regarding the command
We are using this command.
gst-launch-1.0 v4l2src ! bayer2rgb ! ximagesink
Is this correct?

2.Regarding the relationship between width and BytePerLine
Width and BytePerLine have different values.
We don’t understand this relationship.

gst-device-monitor-1.0
video/x-bayer, format=(string)rggb, width=(int)2448, height=(int)2048, framerate=(fraction)48/1
BytePerLine=2496

Could you tell us about these relationships?

The BytePerLine is width 32 alignment.
Check with below driver for it.
…/kernel/nvidia/drivers/media/platform/tegra/camera/vi/channel.c

We changed the width from 2448 to 2432 and got the correct Bayer image.

Is it possible to perform Bayer processing correctly with width=2448?
Or is it necessary that the width always set a muliple of 32?

You can adjust the preferred_stride by v4l2-ctl to try.

I’m very sorry but I am new to Driver Development in general.
So I’m not sure how to adjust the preferred_stride.

Could you tell me how to adjust it?

Just using v4l2-ctl command to config it like below.

v4l2-ctl -d /dev/video0 ... --set-ctrl preferred_stride=2432

Thank you for your support.
I’ll try it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.