TX2 v4l2 stream crashing *** buffer overflow detected ***

v4l2 stream cannot be restarted once stream crashes with *** buffer overflow detected ***
A reboot is needed to get CSI stream working again.

Description: I am Running TX2 L4T27.1 with custom cpp scripts controlling v4l2 api functions to initiate stream. For my application I am shutting down the CSI data stream asynchronously in order to reconfigure sensor settings. At the same time, right before, I trigger a safe shutdown of the v4l2 stream and reinit once CSI data is available (this was done in hopes of avoiding this buffer overflow error). Unfortunately, after after a few dozen restarts of the stream the issue persists, forcing me to reboot the TX2.

the failure stems from a ioctl VIDIOC_STREAMON command
VIDIOC_STREAMON: failed: Bad address

Is there any way to run a terminal command to mimic what rebooting the tx2 does to the v4l2 driver?
I tried some modprobe commands but not sure which module needs reloading
example: modprobe tegra_camera
modprobe: FATAL: Module tegra_camera not found in directory /lib/modules/4.4.15-tegra

I’m using /dev/video0 for the v4l2 stream
v4l2-ctl --list-devices
VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device
VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device
vi-output, ti960 2-0030 (platform:15700000.vi:0):
/dev/video0
/dev/v4l-subdev1
/dev/v4l-subdev0

not sure if this is worth mentioning but the cpp scripts runinng the v4l2 api calls are running from a roslaunch script.

Do I need to patch v4l2 somehow or is this an inherent problem with L4T27.1?

fyi: the v4l2 stream runs fine if left alone, but restarting it multiple times is where the issue arises.

Thanks

@erik.r.hammer
It could be the MIPI timing issue. The VI driver is build-in driver can’t reloading.

  1. Try the modify the BYPASS_LP_SEQ from 1 to 0
  2. Try settle time from 0x1 - 0x7F

./camera/csi/csi4_registers.h:#define T18X_BYPASS_LP_SEQ (0x1 << 7)
./camera/csi/csi4_registers.h:#define DEFAULT_THS_SETTLE (0x14 << 0)

Hi,
Can you try r28.1?

Thanks for the quick response. I was able to solve the issue by modifying what you suggested.

Took a few trys but found that these settings worked for me:
#define T18X_BYPASS_LP_SEQ (0x0 << 7)
#define THS_SETTLE (0x2F << 0)

Able to start and stop the v4l2 stream indefinitely now without crashing. Still running L4T27.1

Thanks