MINI PCIe on JETSON TK1

Hi,

We are trying to bring up MINI PCIe interface on Jetson TK1.
We are using MPX6864 mini pcie interface card to use analog video input.

Initially when loading the driver , we faced the following issue.
PCI: Device 0000:01:00.0 not available because of resource collisions
probe of 0000:01:00.0 failed with error -5

However , after applying a patch we could fix this issue.

Now after the driver probing, the entire system comes to a freeze.
Stack Trace shows:

tw686x driver version 0.1.1 loaded
tw686x driver dma_mode=1, debug=0
tw686x[0]: subsystem: 0000:0000
tw686x[0]: registered device video 0 [v4l2]
tw686x[0]: registered device video 1 [v4l2]
tw686x[0]: registered device video 2 [v4l2]
tw686x[0]: registered device video 3 [v4l2]
tw686x[0]: registered device video 4 [v4l2]
tw686x[0]: registered device video 5 [v4l2]
tw686x[0]: registered device video 6 [v4l2]
tw686x[0]: registered device video 7 [v4l2]
tw686x[0]: tw686x_setup() Failed to create audio adapters 7
tw686x[0]: found at 0000:01:00.0, bus: 1, rev: 1, irq: 16, latency: 0, mmio: 0xf0000000
tw686x 0000:01:00.0: setting latency timer to 64

Am I missing something. Do we need to check for any kernel configurations for Jetson?
Any help is appreciable!!

I notice the “downloadable” driver is designed for a 2.6 series kernel, while Jetson is using a 3.10 series. I was unable to determine if any kind of driver comes native with 3.10 kernels. Where did you get the driver?

The driver itself could simply be out of date for this kernel series, or there may be certain configurable PINMUX settings related to it, although I have no idea which ones.

@linuxdev: Thank you for the quick reply.

The driver for kernel 3.8 is available here:
http://www.commell.com.tw/Download/Driver/Industrial%20Peripheral/Driver/MPX-6864/COMMELL.rar

The source code written checks for the LINUX VERSION and is written to support higher versions.
#if(LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))

We could successfully build it for Jetson TK1 for kernel 3.10.
lspci command also lists the MPX 6864 device correctly.

But we are out of clue on what is probably causing the issue. However we feel that the issue is caused within
tw686x_setup() function inside tw686x-core.c

I don’t have one of these devices so I can’t try to insmod, but I do notice something often forgotten: This module uses i2c and most likely PINMUX must be set up correctly for the module to work. “Possibly” this is the “resource” mentioned in the error.

Some of the customization for the Jetson version of the kernel involves setting up PINMUX, including kernel source and the .dts/.dtb files for firmware options. Using a patch to force use of a conflicting pin configuration could conceivably cause system freeze; it would also be likely that the first use of the wrong PINMUX setup would start with the setup function. I would start by viewing the dts files in the kernel source under:

arch/arm/boot/dts/

…especially tegra124-jetson_tk1-pm375-000-c00-00.dts

Out of curiosity , we tried the tw6864 driver on an IMX6 board running on kernel 3.0.35. But it shows the same behaviour. So I doubt if it is the driver or perhaps v4l2 which is causing the issue. Any suggestions?

sangeethk can you tell me, which version kernel it’s work? i try add this driver to next grinch 21.3.2

what patch did you use i have same problem with dmesg output
probe of 0000:01:00.0 failed with error -5

I have TK1 with l4t (ubuntu 14.04)

Hi
i cross compled linux kernel with Commel driver and it was successfully installed on TK1
but unfortunately , video 0,video 1,… not exist in /dev folder , dmesg output has this error :
probe of 0000:01:00.0 failed with error -5
what patch should i use ,to see video0,video1,…?

Thank you

I know nothing of the particular driver, but some information might get closer to the issue…

The files in “/dev” are not real files, but are generated by the drivers themselves. If the driver does not load, or if the driver tries to load and does not find the camera, then no such file would be generated.

Is it correct that the camera is USB? I could see the bus identifier ("0000:01:00.0") as being PCI, but probably not USB. The files of the naming convention “/dev/video#” are what you would find from a standardized USB Video Class ("UVC"), and PCI cameras would never generate such a file (PCI drivers find PCI devices, and then another driver would actually run the camera…that second driver would not be the standardized UVC driver).

How is this camera connected? Do you have a URL to look up the specs on the camera (or the actual specs)?

Hi thank you for your attention

I use mini pciexpress capture card
capture site
and it is not usb camera
the output of lspci is:

00:00.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x4 Bridge (rev a1)
01:00.0 Non-VGA unclassified device: Intersil Techwell Device 6864 (rev 01)
02:00.0 PCI bridge: NVIDIA Corporation TegraK1 PCIe x1 Bridge (rev a1)
03:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)

and (dmesg | grep tw686x) output is:

[ 10.125777] tw686x driver version 0.1.1 loaded
[ 10.125792] tw686x driver dma_mode=1, debug=0
[ 10.156444] tw686x: probe of 0000:01:00.0 failed with error -5

I wanna capture frames and save them on disk like DVR devices
and i want to use OPENCV for this purpose but i dont know how can i access device file on /dev
it seems device driver was not installed successfully!!

The first thing to know is that such a PCI device will not generate files in “/dev” with the format of “video#” (this is the realm of USB Video Class, or “UVC”). Some software is designed to use UVC, and if so, then you may need to use different software (or different arguments with the current software) to work with a non-UVC camera.

Even so, I see this error, and this would cause a failure even if the correct software is used to access this PCI device:

That error could be due to many different issues. Is this a dev kit TK1? Or is this a third party TK1? If dev kit, then the device tree should be fine as is, but if this is a third party board, then changes would be required to the device tree.

To know more about the PCI error, what do you see from:
sudo lspci -s 01:00.0 -vvv

The above verbose lspci should limit itself to that specific slot, and provide more information about what is failing (the “error -5”). Once this is known someone should be able to provide more detail about using OpenCV with this.

It is third party board (toradex TK1)
and sudo lspci -s 01:00.0 -vvv shows this result:

01:00.0 Non-VGA unclassified device: Intersil Techwell Device 6864 (rev 01)
Flags: bus master, fast devsel, latency 0, IRQ 130
Memory at <unassigned> (32-bit, prefetchable) [size=4K]
Capabilities: [40] Power Management version 3
Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [70] Express Legacy Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Virtual Channel

And i have no problem with opencv and my main problem is installation and access tw686x in L4T thank you

Toradex may have some changes to device tree, and you may want to ask them about it. However, that was a very very short reply from the fully verbose lspci. I would be surprised if there is not some sort of error, the response should have been much longer (perhaps 5 times longer than what is shown). I am wondering if something truncated.

Are you able to place that device on a Linux PC and try the lspci (to find slot number) and then the verbose lspci -vvv variant? Knowing what the verbose lspci responds with (even on another computer) would say a lot about the device itself.

excuse me yes you were right the reply was too short i try lspci on L4T again, and this time i got full reply

01:00.0 Non-VGA unclassified device: Intersil Techwell Device 6864 (rev 01)
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 130
Region 0: Memory at <unassigned> (32-bit, prefetchable) [size=4K]
Capabilities: [40] Power Management version 3
	Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
	Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
	Address: 0000000000000000  Data: 0000
Capabilities: [70] Express (v2) Legacy Endpoint, MSI 00
	DevCap:	MaxPayload 512 bytes, PhantFunc 0, Latency L0s <1us, L1 <8us
		ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
	DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
		RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
		MaxPayload 128 bytes, MaxReadReq 512 bytes
	DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
	LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <512ns, L1 <64us
		ClockPM+ Surprise- LLActRep- BwNot-
	LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk-
		ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
	LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
	DevCap2: Completion Timeout: Not Supported, TimeoutDis+, LTR-, OBFF Not Supported
	DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
	LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
		 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
		 Compliance De-emphasis: -6dB
	LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
		 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [100 v1] Advanced Error Reporting
	UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
	UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
	UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
	CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
	CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
	AERCap:	First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
Capabilities: [140 v1] Virtual Channel
	Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
	Arb:	Fixed- WRR32- WRR64- WRR128-
	Ctrl:	ArbSelect=Fixed
	Status:	InProgress-
	VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
		Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
		Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
		Status:	NegoPending- InProgress-

then according to your suggestion i installed tw686x on my x86 PC with minipciexpress slot .
My OS is UBUNTU 20.04 (desktop 5.4.0-56-generic) .tw686x was automatically detected by linux,
the output of lspci on my PC was this:

01:00.0 Multimedia controller: Intersil Techwell TW6864 multimedia video controller (rev 01)
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 16
Region 0: Memory at d0200000 (32-bit, prefetchable) [size=4K]
Capabilities: [40] Power Management version 3
	Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
	Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
	Address: 0000000000000000  Data: 0000
Capabilities: [70] Express (v2) Legacy Endpoint, MSI 00
	DevCap:	MaxPayload 512 bytes, PhantFunc 0, Latency L0s <1us, L1 <8us
		ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
	DevCtl:	CorrErr- NonFatalErr- FatalErr- UnsupReq-
		RlxdOrd- ExtTag+ PhantFunc- AuxPwr- NoSnoop-
		MaxPayload 256 bytes, MaxReadReq 512 bytes
	DevSta:	CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr+ TransPend-
	LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <512ns, L1 <64us
		ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp-
	LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk+
		ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
	LnkSta:	Speed 2.5GT/s (ok), Width x1 (ok)
		TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
	DevCap2: Completion Timeout: Not Supported, TimeoutDis+, NROPrPrP-, LTR-
		 10BitTagComp-, 10BitTagReq-, OBFF Not Supported, ExtFmt-, EETLPPrefix-
		 EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
		 FRS-
		 AtomicOpsCap: 32bit- 64bit- 128bitCAS-
	DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
		 AtomicOpsCtl: ReqEn-
	LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
		 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
		 Compliance De-emphasis: -6dB
	LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
		 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [100 v1] Advanced Error Reporting
	UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
	UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
	UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
	CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
	CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+
	AERCap:	First Error Pointer: 00, ECRCGenCap+ ECRCGenEn- ECRCChkCap+ ECRCChkEn-
		MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
	HeaderLog: 00000000 00000000 00000000 00000000
Capabilities: [140 v1] Virtual Channel
	Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
	Arb:	Fixed- WRR32- WRR64- WRR128-
	Ctrl:	ArbSelect=Fixed
	Status:	InProgress-
	VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
		Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
		Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=01
		Status:	NegoPending- InProgress-
Kernel driver in use: tw686x
Kernel modules: tw686x

and dmesg output was:

[ 5.164185] tw6864: PCI 0000:01:00.0, IRQ 11, MMIO 0xd0200000 (memcpy mode)
[ 5.164197] tw686x 0000:01:00.0: enabling device (0000 -> 0002)

and ls /dev/video* output was:

/dev/video0
/dev/video1
/dev/video2
/dev/video3

It seems tw6864 has not any problem with generic ubuntu

If we divide this into two parts, (A) the PCIe data pipe, and (B) the driver, we see that in both cases PCI is doing exactly as expected. According to both verbose lspci outputs, the two are identical for working at PCIe gen. 1 as should be. In both cases PCI does not detect any error.

In terms of actual driver loaded, only the PC has a driver. It is using the tw686x driver in the form of a module. This lack of a driver is why the Jetson is failing with the device, but electrically it is working 100% as expected.

A short summary of what follows is that the driver does not seem to exist on 32-bit or 64-bit ARM, at least not for the kernels available (there could be some new generation of 5.x kernels, but the TK1 reached end of life several years ago). Some similar drivers exist on 64-bit, but none, not even “similar”, exist on 32-bit ARM.

If you go to “/proc” on the Jetson you will find a file, “config.gz”. This is not a real file, it is the kernel showing what symbols (features) are enabled in the running kernel. I looked up the driver your PC is using, and the symbol is “CONFIG_VIDEO_TW686X”. For information on that symbol (driver), see:
https://cateee.net/lkddb/web-lkddb/VIDEO_TW686X.html

To see all known configurations of what is or is not installed to the Jetson:
zcat /proc/config.gz | egrep -i 'config_video'

To see all of the “TW” drivers, not being as specific as the TW686:
zcat /proc/config.gz | egrep -i 'config_video_tw'

This latter query shows me this on a 64-bit Jetson:

# CONFIG_VIDEO_TW2804 is not set
# CONFIG_VIDEO_TW9903 is not set
# CONFIG_VIDEO_TW9906 is not set

However, the TK1 is 32-bit. The installed kernel on this much older system is version 3.10.40-gb271e8f (they were using git versions instead of “-tegra” then). I could not find the driver available in the 4.4.140-tegra 32-bit ARM kernel. This is why no driver loaded…the software is simply missing. This URL seems to be from the maintainers of the driver as an email to the old Linux Weekly News publication:
https://lwn.net/Articles/673995/

Notably, this gives a git URL and information on the driver from back in 2016. A similar URL:
https://patchwork.kernel.org/project/linux-media/patch/1453699436-4309-1-git-send-email-ezequiel@vanguardiasur.com.ar/

There are two reasons I can think of why the symbol does not exist (even as not installed) is that (A), the driver might have architecture-dependent code in it which is not ported to ARM, and (B), that the driver simply predates the kernel on 32-bit ARM.

In terms of architecture-dependent code, the PC version could for example use something like SIMD which does not exist on ARM platforms (ARM has its own equivalents, but any such use would require custom coding).

In your case with 32-bit on the TK1 I think the kernel predates the existence of the driver.

If you know someone really good at porting drivers to 32-bit ARM, then someone could probably create the driver based on a port of the PC driver. Otherwise, I think you’re out of luck. Without the driver, but with PCIe working as it should, I am reminded of the phrase “the lights are on, but nobody is home”.