Jetson Nano MIPI CSI-2 without I2C from FPGA

Hello,

I am aiming to develop a platform for a personnal sensor. In order to do that, I am firstly making a prototype which is causing me some troubles.
My prototype is composed of an evaluation board of the FPGA lattice Crosslink (the Master Link Board) and the Jetson Nano. The FPGA creates a sight which is sent using MIPI CSI-2 to the Jetson Nano.
The sight particularites are :
→ The sent image is in RAW8 format (GRAYSCALE8)
→ The resolution is 320x240
→ The data are sent with 2 MIPI lanes

The procedure I followed is very similar to the one described on this Topic of the NVIDIA Forum : Jetson AGX Xavier MIPI CSI-2 without I2C from FPGA

The main difference is that i started from the imx219 driver and dtsi (I modified it to remove I2C). Also, I added the GRAYSCALE8 format on the Jetson Nano.

Actually, I am trying to receive the datas from the FPGA.

I tried to display the video stream by using GStreamer and especially this command :

Because it failed, I tried to receive frame by frame the video stream with v4l2-ctl :

It seems to be working but I have these results with much investigation (command dmesg --follow) :

I refered to the TRM of the Jetson TX1 but without much success.

I am currently blocked because i don’t know where does the problem come from…

After searching a solution on the forum, it seems that @ShaneCCC and @JerryChang are very competents in this domain.

Have you got any idea of a solution to my problem ?

Don’t hesitate to ask for details if anything isn’t clear.

Thank you by advance,
Adrien

hello adrien.leroy2,

is this a monochrome sensor?
may I know what’s the bayer pattern of this GRAYSCALE8 sensor?
thanks

1 Like

Hello,

Thanks for your quick answer !

The sensor is indeed monochrome.

It has 8 bits per pixel in grayscale.
Isn’t bayer pattern only for RGB sensor ?

I am a beginner in this domain, so i apologize if i am not clear enough.

Adrien

it’s supported if this sensor output CCCC bayer formats.
however, by default the memory format is using T_R16, 8-bit per pixel might not supports.

please also check some similar discussion threads as see-also,
for example, Topic 63277, Topic 64216.

Here is an update of the result of the gstreamer command there was a mistake :

I have an error when I try to upload files… (“undefined method `hostname’ for nil:NilClass”)

So here are some screenshot of the files I modified in order to add GRAYSCALE8 support :

In camera_common.c :

static const struct camera_common_colorfmt camera_common_color_fmts[] = {
	{
		MEDIA_BUS_FMT_SRGGB12_1X12,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB12,
	},
	{
		MEDIA_BUS_FMT_SGRBG12_1X12,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SGRBG12,
	},
	{
		MEDIA_BUS_FMT_SRGGB10_1X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB10,
	},
	{
		MEDIA_BUS_FMT_SGRBG10_1X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SGRBG10,
	},
	{
		MEDIA_BUS_FMT_SGBRG10_1X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SGBRG10,
	},
	{
		MEDIA_BUS_FMT_SBGGR10_1X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SBGGR10,
	},
	{
		MEDIA_BUS_FMT_SRGGB8_1X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB8,
	},

	{	
	//Added part
		MEDIA_BUS_FMT_Y8_1X8, //GRAYSCALE 8 BITS
		V4L2_COLORSPACE_RAW, //RAW
		V4L2_PIX_FMT_GREY,
	},
	{
		MEDIA_BUS_FMT_YUYV8_1X16,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_YUYV,
	},
	{
		MEDIA_BUS_FMT_YVYU8_1X16,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_YVYU,
	},
	{
		MEDIA_BUS_FMT_UYVY8_1X16,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_UYVY,
	},
	{
		MEDIA_BUS_FMT_VYUY8_1X16,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_VYUY,
	},
	{
		MEDIA_BUS_FMT_RGB888_1X24,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_RGB24,
	},
	{
		MEDIA_BUS_FMT_YUYV8_2X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_YUYV,
	},
	{
		MEDIA_BUS_FMT_YVYU8_2X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_YVYU,
	},
	{
		MEDIA_BUS_FMT_UYVY8_2X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_UYVY,
	},
	{
		MEDIA_BUS_FMT_VYUY8_2X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_VYUY,
	},
	/*
	 * The below two formats are not supported by VI4,
	 * keep them at the last to ensure they get discarded
	 */
	{
		MEDIA_BUS_FMT_XRGGB10P_3X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_XRGGB10P,
	},
	{
		MEDIA_BUS_FMT_XBGGR10P_3X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_XRGGB10P,
	},
};

In sensor_common.c :

static int extract_pixel_format(
	const char *pixel_t, u32 *format)
{
	size_t size = strnlen(pixel_t, OF_MAX_STR_LEN);

	if (strncmp(pixel_t, "bayer_bggr10", size) == 0)
		*format = V4L2_PIX_FMT_SBGGR10;
	else if (strncmp(pixel_t, "bayer_rggb10", size) == 0)
		*format = V4L2_PIX_FMT_SRGGB10;
	else if (strncmp(pixel_t, "bayer_grbg10", size) == 0)
		*format = V4L2_PIX_FMT_SGRBG10;
	else if (strncmp(pixel_t, "bayer_gbrg10", size) == 0)
		*format = V4L2_PIX_FMT_SGBRG10;
	else if (strncmp(pixel_t, "bayer_bggr12", size) == 0)
		*format = V4L2_PIX_FMT_SBGGR12;
	else if (strncmp(pixel_t, "bayer_rggb12", size) == 0)
		*format = V4L2_PIX_FMT_SRGGB12;
	else if (strncmp(pixel_t, "rgb_rgb88824", size) == 0)
		*format = V4L2_PIX_FMT_RGB24;
	else if (strncmp(pixel_t, "bayer_wdr_pwl_rggb12", size) == 0)
		*format = V4L2_PIX_FMT_SRGGB12;
	else if (strncmp(pixel_t, "bayer_wdr_dol_rggb10", size) == 0)
		*format = V4L2_PIX_FMT_SRGGB10;
	else if (strncmp(pixel_t, "bayer_xbggr10p", size) == 0)
		*format = V4L2_PIX_FMT_XBGGR10P;
	else if (strncmp(pixel_t, "bayer_xrggb10p", size) == 0)
		*format = V4L2_PIX_FMT_XRGGB10P;
	//grayscale format
	else if (strncmp(pixel_t, "gray", size) == 0)
		*format = V4L2_PIX_FMT_GREY;
	else if (strncmp(pixel_t, "yuv_yuyv16", size) == 0)
		*format = V4L2_PIX_FMT_YUYV;
	else if (strncmp(pixel_t, "yuv_yvyu16", size) == 0)
		*format = V4L2_PIX_FMT_YVYU;
	else if (strncmp(pixel_t, "yuv_uyvy16", size) == 0)
		*format = V4L2_PIX_FMT_UYVY;
	else if (strncmp(pixel_t, "yuv_vyuy16", size) == 0)
		*format = V4L2_PIX_FMT_VYUY;
	else {
		pr_err("%s: Need to extend format%s\n", __func__, pixel_t);
		return -EINVAL;
	}

	return 0;
}

In vi2_formats.h :

static const struct tegra_video_format vi2_video_formats[] = {
	/* RAW 6: TODO */

	/* RAW 7: TODO */

	/* GRAYSCALE */
	TEGRA_VIDEO_FORMAT(RAW8, 8, Y8_1X8, 1, 1, T_L8, RAW8, GREY, "GRAY8"),

	/* RAW 8 */
	TEGRA_VIDEO_FORMAT(RAW8, 8, SRGGB8_1X8, 1, 1, T_L8,
				RAW8, SRGGB8, "RGRG.. GBGB.."),
	TEGRA_VIDEO_FORMAT(RAW8, 8, SGRBG8_1X8, 1, 1, T_L8,
				RAW8, SGRBG8, "GRGR.. BGBG.."),
	TEGRA_VIDEO_FORMAT(RAW8, 8, SGBRG8_1X8, 1, 1, T_L8,
				RAW8, SGBRG8, "GBGB.. RGRG.."),
	TEGRA_VIDEO_FORMAT(RAW8, 8, SBGGR8_1X8, 1, 1, T_L8,
				RAW8, SBGGR8, "BGBG.. GRGR.."),

	/* RAW 10 */
	TEGRA_VIDEO_FORMAT(RAW10, 10, SRGGB10_1X10, 2, 1, T_R16_I,
				RAW10, SRGGB10, "RGRG.. GBGB.."),
	TEGRA_VIDEO_FORMAT(RAW10, 10, SGRBG10_1X10, 2, 1, T_R16_I,
				RAW10, SGRBG10, "GRGR.. BGBG.."),
	TEGRA_VIDEO_FORMAT(RAW10, 10, SGBRG10_1X10, 2, 1, T_R16_I,
				RAW10, SGBRG10, "GBGB.. RGRG.."),
	TEGRA_VIDEO_FORMAT(RAW10, 10, SBGGR10_1X10, 2, 1, T_R16_I,
				RAW10, SBGGR10, "BGBG.. GRGR.."),

	/* RAW 10 Packed format */
	TEGRA_VIDEO_FORMAT(RAW10, 10, XBGGR10P_3X10, 4, 3, T_X2Lc10Lb10La10,
				RAW10, XBGGR10P, "BGBG.. GRGR.."),
	TEGRA_VIDEO_FORMAT(RAW10, 10, XRGGB10P_3X10, 4, 3, T_X2Lc10Lb10La10,
				RAW10, XRGGB10P, "RGRG.. GBGB.."),

	/* RAW 12 */
	TEGRA_VIDEO_FORMAT(RAW12, 12, SRGGB12_1X12, 2, 1, T_R16_I,
				RAW12, SRGGB12, "RGRG.. GBGB.."),
	TEGRA_VIDEO_FORMAT(RAW12, 12, SGRBG12_1X12, 2, 1, T_R16_I,
				RAW12, SGRBG12, "GRGR.. BGBG.."),
	TEGRA_VIDEO_FORMAT(RAW12, 12, SGBRG12_1X12, 2, 1, T_R16_I,
				RAW12, SGBRG12, "GBGB.. RGRG.."),
	TEGRA_VIDEO_FORMAT(RAW12, 12, SBGGR12_1X12, 2, 1, T_R16_I,
				RAW12, SBGGR12, "BGBG.. GRGR.."),

	/* RGB888 */
	TEGRA_VIDEO_FORMAT(RGB888, 24, RGB888_1X24, 4, 1, T_A8R8G8B8,
				RGB888, ABGR32, "BGRA-8-8-8-8"),
	TEGRA_VIDEO_FORMAT(RGB888, 24, RGB888_1X32_PADHI, 4, 1, T_A8B8G8R8,
				RGB888, RGB32, "RGB-8-8-8-8"),

	/* YUV422 */
	TEGRA_VIDEO_FORMAT(YUV422, 16, UYVY8_1X16, 2, 1, T_U8_Y8__V8_Y8,
				YUV422_8, UYVY, "YUV 4:2:2"),
	TEGRA_VIDEO_FORMAT(YUV422, 16, VYUY8_1X16, 2, 1, T_V8_Y8__U8_Y8,
				YUV422_8, VYUY, "YUV 4:2:2"),
	TEGRA_VIDEO_FORMAT(YUV422, 16, YUYV8_1X16, 2, 1, T_Y8_U8__Y8_V8,
				YUV422_8, YUYV, "YUV 4:2:2"),
	TEGRA_VIDEO_FORMAT(YUV422, 16, YVYU8_1X16, 2, 1, T_Y8_V8__Y8_U8,
				YUV422_8, YVYU, "YUV 4:2:2"),
	TEGRA_VIDEO_FORMAT(YUV422, 16, UYVY8_1X16, 1, 1, T_Y8__V8U8_N422,
				YUV422_8, NV16, "NV16"),
	TEGRA_VIDEO_FORMAT(YUV422, 16, UYVY8_2X8, 2, 1, T_U8_Y8__V8_Y8,
				YUV422_8, UYVY, "YUV 4:2:2 UYVY"),
	TEGRA_VIDEO_FORMAT(YUV422, 16, VYUY8_2X8, 2, 1, T_V8_Y8__U8_Y8,
				YUV422_8, VYUY, "YUV 4:2:2 VYUY"),
	TEGRA_VIDEO_FORMAT(YUV422, 16, YUYV8_2X8, 2, 1, T_Y8_U8__Y8_V8,
				YUV422_8, YUYV, "YUV 4:2:2 YUYV"),
	TEGRA_VIDEO_FORMAT(YUV422, 16, YVYU8_2X8, 2, 1, T_Y8_V8__Y8_U8,
				YUV422_8, YVYU, "YUV 4:2:2 YVYU"),
};

As you can see, I put T_L8 instead of T_R16 as did in this topic :

Thank you,
Adrien

I also add a part of the dtsi file of my driver : (the adding of my specific mod)

mode0 { /* ATI320_MODE_320x240_60FPS */
					mclk_khz = "20000";
					num_lanes = "2";
					tegra_sinterface = "serial_a";
					phy_mode = "DPHY";
					discontinuous_clk = "yes";
					dpcm_enable = "false";
					cil_settletime = "0";
					dynamic_pixel_bit_depth="8";
					csi_pixel_bit_depth = "8";
					//mode_type="gray";
					pixel_t="gray";
					pixel_phase="y";

					active_w = "320";
					active_h = "240";
					readout_orientation = "90";
					line_length = "337";
					inherent_gain = "1";
					mclk_multiplier = "9.33";
					pix_clk_hz = "5000000";

					gain_factor = "16";
					framerate_factor = "1000000";
					exposure_factor = "1000000";
					min_gain_val = "16"; /* 1.00x */
					max_gain_val = "170"; /* 10.66x */
					step_gain_val = "1";
					default_gain = "16"; /* 1.00x */
					min_hdr_ratio = "1";
					max_hdr_ratio = "1";
					min_framerate = "2000000"; /* 2.0 fps */
					max_framerate = "144000000"; /* 144.0 fps */
					step_framerate = "1";
					default_framerate = "144000000"; /* 144.0 fps */
					min_exp_time = "13"; /* us */
					max_exp_time = "683709"; /* us */
					step_exp_time = "1";
					default_exp_time = "2495"; /* us */

					embedded_metadata_height = "2";
				};

Adrien

hello adrien.leroy2,

v4l2src it only works with USB camera or YUV sensors,
please use v4l2 standard controls (i.e. v4l2-ctl) to access the stream for the verification.

are you able to dump the sensor capability via v4l2?
for example, $ v4l2-ctl -d /dev/video0 --list-formats-ext
thanks

Hello @JerryChang,

Here is the result of this command :

pi21@pi21-desktop:~$ v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'GREY'
	Name        : 8-bit Greyscale
		Size: Discrete 320x240
			Interval: Discrete 0.007s (144.000 fps)

We can see as expected the GREY format.

Is it correct ?

Thanks
Adrien

hello adrien.leroy2,

you may have a try to save the stream locally and check the content,
for example,
$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=320,height=240,pixelformat=GREY --set-ctrl bypass_mode=0 --stream-count=1 --stream-to=test.raw

@JerryChang I tried your command, it created the expected file test.raw, here is its content :

pi21@pi21-desktop:~$ hd -x test.raw 
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
0000000    0000    0000    0000    0000    0000    0000    0000    0000
*
0012c00

The 0012c00 indicates that we have a line for each pixel, but it is all empty…
Do you know where the problem could be coming from ?

hello adrien.leroy2,

is there any failure reported?
please execute following to verify the sensor stream.
for example,
$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=320,height=240,pixelformat=GREY --set-ctrl bypass_mode=0 --stream-count=300

please have a try, it’ll show < for each success capture frame, and report average frame-rate for a second below the pipeline.
thanks

No failure reported.

But with your last command, nothing happens, as shown here :

pi21@pi21-desktop:~$ sudo v4l2-ctl -d /dev/video0 --set-fmt-video=width=320,height=240,pixelformat=GREY --set-ctrl bypass_mode=0 --stream-count=300
pi21@pi21-desktop:~$

Thanks !

hello adrien.leroy2,

sorry, you’ll also need to include --stream-mmap options.
here’s an example to access sensor stream for checking camera functionality.

$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=100
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 59.94 fps

hello @JerryChang,
Oh ok !
I added the option --stream-mmap.
I get the < for each frame successfully, but I don’t get the average framerate as you can see :

pi21@pi21-desktop:~$ sudo v4l2-ctl -d /dev/video0 --set-fmt-video=width=320,height=240,pixelformat=GREY --set-ctrl bypass_mode=0 --stream-mmap --stream-count=50
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Thank you

hello adrien.leroy2,

you’ll need to increase stream-count property for a try.
please set it above 144 due to you’re having high frame-rate camera sensor.
thanks

1 Like

At first I did it with a stream-count of 300, but the result is the same :

pi21@pi21-desktop:~$ sudo v4l2-ctl -d /dev/video0 --set-fmt-video=width=320,height=240,pixelformat=GREY --set-ctrl bypass_mode=0 --stream-mmap --stream-count=300
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Thanks

Here is an update, I tried with a high number of --stream-count
We get a framerate after 15,585 < which I do not really understand…
Here is the output of the command (I only put until the first framerate appears)

pi21@pi21-desktop:~$ sudo v4l2-ctl -d /dev/video0 --set-fmt-video=width=320,height=240,pixelformat=GREY --set-ctrl bypass_mode=0 --stream-mmap --stream-count=76801
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<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<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 15584.00 fps
Thank you
Adrien

Hello @JerryChang,
do you think that the problem could be coming from the driver ? Because I manually removed the I2C from imx219.c and I may have done a mistake. I took inspiration of the @ShaneCCC advices in that topic : Xavier - using raw CSI without i2c - #7 by tom_adi

Hi @JerryChang,
I thought about it during the week end and I have few questions…
As input for our Jetson, we have 240 lines of 320 pixels, each pixel is represented by a value scaling from 0 to 255.
We don’t have a CCCC baye rformat, but only one value (not four) for each pixel.
So how does it work for the Nano, does it need a special format like CCCC as input ?
And is it possible to “fool” the Jetson by configuring the Jetson parameters at 160x120 as if it is a format CCCC or even RGGB ?

Thank you !

hello adrien.leroy2,

this looks incorrect. you may examine the signaling between start-of-frame and end-of-frame.
or,
from the software driver, it’s using sync-point for waiting hardware signal.
please add some debug messages to check nvhost_syncpt_wait_timeout_ext for the frame start.
for example,
$L4T_Sources/r32.5/Linux_for_Tegra/source/public/kernel/nvidia/drivers/media/platform/tegra/camera/vi/vi2_fops.c

static int tegra_channel_capture_frame_single_thread(
...
        chan->capture_state = CAPTURE_GOOD;
        for (index = 0; index < valid_ports; index++) {
                err = nvhost_syncpt_wait_timeout_ext(chan->vi->ndev,
                        chan->syncpt[index][0], thresh[index],
                        chan->timeout, NULL, &ts);