Unable to use V4L2 and USB to serial at the same time

I had a program that use V4L2 and USB to serial.After I ran this program the V4L2 dont show picture.Its actuall running but no picture showed.I doubt the reason is that the V4L2 and USB to serial use the same channel
that those had been block.What your guys opinion?

I doubt anyone will be able to guess without many more details. For example, are you using the USB for a camera feeding V4L2? Is it a USB camera and the program does not work for this particular case?

My bad.Its an USB camera.I am sure its can work for this particular case.I have used this camera in other device and it work just fine.But in that device It is use the serial communication.The device name is ttyTHS0.

So is the serial UART for camera control, or is it for passing through what the USB camera sees? Which physical connection are you using (or perhaps mention if this is a custom board)?

Oh I forget to say that my board is TK1 sorry about that.I dont quiet understand what your"serail UART for camera control" mean.Could you please explain this more detaily.As for the physical connection its TK1 use a usb3.0 hub.
Thanks for your reply.

The UART is work to send the data after TK1 processing.And the camera is work for collect data.

When you mentioned ttyTHS0 this implies a separate serial communications versus USB. How is ttyTHS0 used? Are you trying to relay pictures through this from the USB camera? Some cameras can be controlled by serial ports (which would have far lower bandwidth requirements than would picture data). In the case of ttyTHS0 it is important to know how you connect to this…it implies a physical connection which isn’t USB (perhaps you are using a header pin, perhaps you are simply using software to relay it to USB and have set up custom software…it isn’t known from your description).

I mean in an other board the device name is ttyTHS0.In TK1 the device name is ttyUSB0.

I’m so sorry for not being able to discribe the problem clearly. I’m on a project which requires a webcam to collect data from the environment, process the image inside an c++ program in my TK1, then send the result of processing to another device(which I never mentioned before). V4L2 is used for webcam to collect data, and serial communication is used for sending the result, in other words, they are seprate steps in one program. Now the problem is that I cannot open serial communication properly while running V4L2 in another thread. In c++, the function “open” stucked and doesn’t return the file descripter as it usually does. BTW, ttyTHS0 is not used in this program but it worked out well in another one for the same usage. In this case, the device name of serial communication is ttyUSB0.

Regarding serial UART naming…

The ttyS# syntax is for standard UARTs like the 16550A. The ttyTHS# syntax is very similar, but it uses one of NVIDIA’s drivers and has a DMA capability (you can’t use both at the same time on the hardware). The ttyUSB# depends on a USB serial UART (the driver depends on the chipset).

So the first thing I’d wonder is if your device shows up as “ttyUSB#” syntax. If it does, then it means you have the driver for the UART chipset and are good to go other than perhaps port settings.

Can I verify you are using something like ttyUSB0?

When communications show nothing at all, then typically port settings on the two halves of the connection are far different. If you see garbage, then typically the connections also differ, but perhaps not by as much as seeing nothing. If communications gets stuck, then it might be your flow control is not correct (which again needs to be the same on both sides of the connection).

Assuming you have the ttyUSB0 (or other ttyUSB#) you might start by examining what port settings and flow control settings are being used and validating both sides being set to match.

Yes my device shows up as “ttyUSB0”.In fact I am using two USB device in the same time.The camera and the USB to serial.The name of camera is video0 and the name of USB to serial is ttyUSB0.The communication protocol has been tested and is completely normal.I mean I haved failed to open the serial.

In what way does this fail? Is this a USB3 camera? USB2? If USB3 it might require all possible bandwidth, but a serial UART wouldn’t use much and having one USB device cause another to fail is suspicious of something else going on, but I think first it is necessary to know exactly how it fails.

Its an USB2.0 camera.Personaly I dont think this is the bandwidth problem.From the data that I know now the bandwidth is enough.

And I use an USB3 hub to connect all those things with TK1.I am not sure if this matters.

As said by @linuxdev, you may explain what fails, what errors you see.

About your USB topology, you may post the output of:

lsusb -t

Furthermore, you should try to see if the problem is with camera capture through USB. You may install package qv4l2 and try to configure your camera with it.
Once you can get pictures from your camera, and you can analyse frames with your application, then check for the usb-serial transmission, being sure to have the right framing speed, parity and flow control on both sides (Jetson and your other board).

Explain what fails at which step, it should lead to better advices.