Open yehia2amer opened 3 years ago
Is the cx23885 a 32-bit device, or could you just force it to use a 64-bit DMA mask?
I'd forgotten dtoverlay=pcie-32bit-dma
. That avoids the swiotlb_map issue.
No services found on the muxes though. The aerial connection works with my TV, so it's possible that it's something else in the card has failed. It registers the signal strength though, so the frontends appear OK.
A little more playing. There appears to be some generic issue with cascading PCIe switches which mean that they fail to get any irqs. Having picked up an ASM1184e 1:4 PCIe switch, and having a Pericom 1:3 port switch, connecting a VLI805 USB3 card to the chain fails with
[ 1.820995] usbcore: registered new interface driver smsc95xx
[ 1.822816] pcieport 0000:02:07.0: of_irq_parse_pci: failed with rc=-22
[ 1.824514] xhci_hcd 0000:09:00.0: xHCI Host Controller
[ 1.826108] xhci_hcd 0000:09:00.0: new USB bus registered, assigned bus number 1
[ 1.830913] xhci_hcd 0000:09:00.0: hcc params 0x002841eb hci version 0x100 quirks 0x0000060000000890
[ 1.832521] xhci_hcd 0000:09:00.0: No msi-x/msi found and no IRQ in BIOS
[ 1.834124] xhci_hcd 0000:09:00.0: startup error -22
[ 1.835770] xhci_hcd 0000:09:00.0: USB bus 1 deregistered
[ 1.837395] xhci_hcd 0000:09:00.0: init 0000:09:00.0 fail, -22
[ 1.839046] xhci_hcd: probe of 0000:09:00.0 failed with error -22
so largely the same as the WinTV QuadHD which has a built in PCIe switch (PericomPI7C9X2G304).
TBS6284 quad DVB-T2 tuner works fine on the end of a single PCIe switch, but also fails in the chain.
https://github.com/6by9/linux/tree/rpi-5.10.y-tbs/ rebased and updated to pull in drivers for TBS6984 (not arrived yet), and I've done the same with https://github.com/6by9/linux/tree/rpi-5.15.y-tbs/
I don't know if @geerlingguy wants to add these to his site, but the cards I have working are:
DVBSky S952 v3 Dual DVB-S2 http://dvbsky.net/Products_S952V3.html
Needs dtoverlay=pcie-32bit-dma
and kernel module CONFIG_VIDEO_CX23885
TBS6284 Quad DVB-T2 (obsolete)
Needs dtoverlay=pcie-32bit-dma
and custom drivers from TBS
TBS6985 Quad DVB-S2 (obsolete)
Needs dtoverlay=pcie-32bit-dma
and custom drivers from TBS
I've just taken the relevant bits of the TBS drivers from https://github.com/tbsdtv/linux_media/ and merged them to https://github.com/6by9/linux/tree/rpi-5.10.y-tbs and https://github.com/6by9/linux/tree/rpi-5.15.y-tbs. I may speak to Phil about merging them into our tree, but I feel like it would be a bad move as there are enough questions over the licencing and authorship of those patches that it's not worth opening that can of worms.
Believed working:
dtoverlay=pcie-32bit-dma
and kernel module CONFIG_VIDEO_CX23885.
Fully identified, but think my card is dead as it detects a signal strength but no signal.Ought to recheck: TBS6981 Dual DVB-S2 (should be the same as DVBSky S952 v3)
Unless any others pop up on Ebay at silly prices then I think I'm calling this done - yes you can use a CM4 system as a TV receiver.
TBS cards are a pain as their drivers are out of tree and pretty ugly in coding style. I'm not even going to look at their FPGA based cards (although a TBS6909 would be tempting as an octa DVB-S2 card) Some other manufacturers (particularly Hauppauge) are better. Always check against https://www.linuxtv.org/wiki/index.php/DVB-T2_PCIe_Cards or https://www.linuxtv.org/wiki/index.php/DVB-S2_PCIe_Cards for whether cards are supported.
Now to work out if I have sufficient feeds to run all the tuners I have at once (about 8 DVB-S2 and 10 DVB-T2! Shame there are only 8 DVB-T/T2 muxes in this area).....
@6by9 - I think I'd be happy adding those cards in the A/V section (https://pipci.jeffgeerling.com/#multimedia-av-and-sound-cards).
Oh dear, a TBS6909 did just come up at a silly price. I guess I've got a little more work to do :-)
And I'm now looking at satellite multiswitches to feed all these tuners! There was me thinking the octa LNB I installed would be sufficient for anything I cared to do - I guess I was wrong.
TBS6909 turned out to be dead :-( At least I got a refund.
Tried a combined rig with DVBSky S952 v3, TBS6985, and TBS6284 via a 4 way PCIe switch, alongside my 4 port SATA card (Marvell 9215). DVB cards need the pcie-32bit-dma tweak. The SATA card refuses to work with that in place. Joys! I might be able to get storage via a USB3 card instead, but that card was in the office. Not a priority though.
That did prompt me to try that rig out in my x86_64 machine. Ubuntu booted off a USB stick sees the above 3 tuners and the Hauppauge QuadHD I'd stuffed in there. No drivers for the TBS cards, but DVBSky and QuadHD show up. The QuadHD will actually tune though, and I can watch streams through VLC. So it's not dead, and I need to have a further look at why it's not happy on the CM4.
DVB cards need the pcie-32bit-dma tweak. The SATA card refuses to work with that in place.
It seems a lot of older cards (especially PCIe gen 1) require the tweak to work. Kind of annoying, but I think the solution is to either build specifically for the older card and sacrifice some newer gear (though there might be some SATA II card that works with it enabled), or give up the functionality from that older card.
Whoops.
pi@raspberrypi:~ $ lspci -nn
00:00.0 PCI bridge [0604]: Broadcom Limited Device [14e4:2711] (rev 20)
01:00.0 PCI bridge [0604]: ASMedia Technology Inc. ASM1184e PCIe Switch Port [1b21:1184]
02:01.0 PCI bridge [0604]: ASMedia Technology Inc. ASM1184e PCIe Switch Port [1b21:1184]
02:03.0 PCI bridge [0604]: ASMedia Technology Inc. ASM1184e PCIe Switch Port [1b21:1184]
02:05.0 PCI bridge [0604]: ASMedia Technology Inc. ASM1184e PCIe Switch Port [1b21:1184]
02:07.0 PCI bridge [0604]: ASMedia Technology Inc. ASM1184e PCIe Switch Port [1b21:1184]
03:00.0 Multimedia controller [0480]: TBS Technologies DVB-S2 4 Tuner PCIe Card [544d:6178]
pi@raspberrypi:~ $ sudo lspci -v
...
03:00.0 Multimedia controller: TBS Technologies DVB-S2 4 Tuner PCIe Card
Subsystem: Device 6909:0001
Flags: fast devsel
Memory at 600000000 (32-bit, non-prefetchable) [disabled] [size=256K]
Capabilities: [50] Power Management version 3
Capabilities: [70] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [90] Express Endpoint, MSI 00
Capabilities: [100] Device Serial Number 00-00-00-00-00-00-00-00
Not sure why it reports as a 4 tuner card as it's a TBS6909 octa DVB-S2 tuner. Now to try getting the drivers to compile....
I've created a monster!
Sadly it doesn't want to work through my ASM1184e PCIe switch, so I can't combine it with any other cards :-(
It required one little tweak to the driver to use
dma_alloc_coherent(..., GFP_KERNEL)
instead of pci_alloc_consistent()
as the later uses the restricted GFP_ATOMIC heap.
(It looks to be an interrupt issue - complains of failing to enable MSI interrupt and falling back to polling, but then I2C transactions time out which would imply no interrupts happening)
Er, it helps if you don't leave pci=nosmi
lying around on your kernel command line if you want to enable MSI.
The monster just grew.
The cx23885 in the Hauppauge card needs dtoverlay=pcie-32bit-dma
, and also seem to have an interrupt issue (nothing handles the triggered interrupt, so the kernel disables it). They do appear to route the interrupts through the 2 PCIe switches now though.
The other cards don't appear to require it, but the TBS6909 doesn't seem to actually work without it.
My TBS6284 (quad DVB-T2) and TBS6985 aren't being recognised in the PCIe switch. I'll have to see if they work direct, otherwise it may be that they're just dead.
Now to sort out some form of storage around this device and see just how many channels I can record at once :-)
A VL805 works fine in 32bit DMA mode, so that deals with storage.
Add USB and I can connect all my USB tuners too!
pi@raspberrypi:~ $ ls /dev/dvb*
adapter0 adapter10 adapter12 adapter14 adapter16 adapter18 adapter2 adapter3 adapter5 adapter7 adapter9
adapter1 adapter11 adapter13 adapter15 adapter17 adapter19 adapter20 adapter4 adapter6 adapter8
pi@raspberrypi:~ $ lspci -tv
-[0000:00]---00.0-[01-09]----00.0-[02-09]--+-01.0-[03-06]----00.0-[04-06]--+-01.0-[05]----00.0 Conexant Systems, Inc. CX23885 PCI Video and Audio Decoder
| \-02.0-[06]----00.0 Conexant Systems, Inc. CX23885 PCI Video and Audio Decoder
+-03.0-[07]----00.0 VIA Technologies, Inc. VL805 USB 3.0 Host Controller
+-05.0-[08]----00.0 TBS Technologies DVB-S2 4 Tuner PCIe Card
\-07.0-[09]----00.0 Spin Master Ltd. PCIe Video Bridge
pi@raspberrypi:~ $ lsusb -tv
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
|__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 5000M
|__ Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 5000M
|__ Port 4: Dev 4, If 0, Class=Hub, Driver=hub/4p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 4, If 0, Class=Vendor Specific Class, Driver=dvb_usb_dvbsky, 480M
|__ Port 2: Dev 5, If 0, Class=Vendor Specific Class, Driver=em28xx, 480M
|__ Port 3: Dev 6, If 0, Class=Vendor Specific Class, Driver=dw2102, 480M
|__ Port 4: Dev 7, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 3: Dev 8, If 0, Class=Vendor Specific Class, Driver=em28xx, 480M
|__ Port 4: Dev 9, If 0, Class=Vendor Specific Class, Driver=em28xx, 480M
I guess 9 DVB-T2 tuners is a touch excessive when there are only 7 active muxes in this area.
Last update for now. TBS6284 quad DVB-T2 and TBS6985 quad DVB-S2 work fine when directly connected to the CM4, so there appears to be something about the PCIe switch that they don't like. I do have an alternate chipset PCIe switch somewhere, so may try that (if I can find it).
Ah, I'd forgotten that the TBS 6284 and 6985 require the PCIe link to be forced to gen 1. You can do that for the brcmstb root controller, but there doesn't appear to be an easy solution for PCIe switches that I can see. Switching to my other PCIe switch (Pericom PI7C9X) didn't help.
So 21 tuners is probably my limit for the time being.
hi all,
i think i made a step forward in including the tbs 6984 using an asm1184e raiser board
it´s quite late here so i just give the quick version for now, also no stream test has been done just enumeration worked.
first i added 2 scripts on the pi and installed setpci https://www.alexforencich.com/wiki/en/pcie/set-speed https://unix.stackexchange.com/a/474378
then i set all asmedia enum´s to linkspeed 1
here an example for one enum:
sudo ./setpci.sh 02:07.0 1
sudo ./pcireset.sh 02:07.0
maybe we can also just set that one port and keep the pi and the other ports on gen2 speed?
and sure enough after that it appears to be alive! :) 00:00.0 PCI bridge: Broadcom Limited Device 2711 (rev 20) 01:00.0 PCI bridge: ASMedia Technology Inc. ASM1184e PCIe Switch Port 02:01.0 PCI bridge: ASMedia Technology Inc. ASM1184e PCIe Switch Port 02:03.0 PCI bridge: ASMedia Technology Inc. ASM1184e PCIe Switch Port 02:05.0 PCI bridge: ASMedia Technology Inc. ASM1184e PCIe Switch Port 02:07.0 PCI bridge: ASMedia Technology Inc. ASM1184e PCIe Switch Port 07:00.0 Multimedia controller: Philips Semiconductors SAA7160 (rev 02)
hope that helps and let me know how the testing goes
br stinger1/stinger151/francesco
@FrancescoRestelli Thank you!
I'd started reading through the information about PCI configuration blocks, but had some real work to do and therefore dropped it. I'll give it a go tonight when at home - I can see cascaded PCIe switches in my future to accommodate 5 PCIe tuner cards. Shame I smashed one of the PCIe connectors off my 3 way switch, so I won't be able to connect the USB3 card as well. AIUI Yes you should be able to drop the speed of just one port to keep as much bandwidth as possible.
Hmm, some further tweaking required.
Trying the above with a TBS6909 in slot 3, a TBS6985 in slot 1, and TBS6284 in slot 4, the device reset appears to reset the TBS6909, gives a kernel Unhandled fault: asynchronous external abort
, and a second instance shows up on port 1.
Run it with just the 6284 and 6985 connected, only one card is detected at a time, but they don't initialise happily
[ 106.035017] pci_bus 0000:06: busn_res: [bus 06] is released
[ 106.608485] pci 0000:02:07.0: [1b21:1184] type 01 class 0x060400
[ 106.608669] pci 0000:02:07.0: enabling Extended Tags
[ 106.608896] pci 0000:02:07.0: PME# supported from D0 D3hot D3cold
[ 106.611845] pcieport 0000:02:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[ 106.618489] pci 0000:02:07.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[ 106.618877] pci 0000:06:00.0: [1131:7160] type 00 class 0x048000
[ 106.618974] pci 0000:06:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit]
[ 106.619353] pci 0000:06:00.0: supports D1 D2
[ 106.619371] pci 0000:06:00.0: PME# supported from D0 D1 D2
[ 106.623284] PCI: bus6: Fast back to back transfers disabled
[ 106.623311] pci_bus 0000:06: busn_res: [bus 06] end is updated to 06
[ 106.623634] pci_bus 0000:07: busn_res: can not insert [bus 07-06] under [bus 02-06] (conflicts with (null) [bus 02-06])
[ 106.626204] PCI: bus7: Fast back to back transfers enabled
[ 106.626225] pci_bus 0000:07: busn_res: [bus 07-06] end is updated to 07
[ 106.626243] pci_bus 0000:07: busn_res: can not insert [bus 07] under [bus 02-06] (conflicts with (null) [bus 02-06])
[ 106.626266] pci 0000:02:07.0: devices behind bridge are unusable because [bus 07] cannot be assigned for them
[ 106.626284] pcieport 0000:01:00.0: bridge has subordinate 06 but max busn 07
[ 106.626337] pcieport 0000:01:00.0: BAR 8: no space for [mem size 0x00100000]
[ 106.626353] pcieport 0000:01:00.0: BAR 8: failed to assign [mem size 0x00100000]
[ 106.626370] pcieport 0000:02:01.0: BAR 8: no space for [mem size 0x00100000]
[ 106.626383] pcieport 0000:02:01.0: BAR 8: failed to assign [mem size 0x00100000]
[ 106.626398] pci 0000:06:00.0: BAR 0: no space for [mem size 0x00100000 64bit]
[ 106.626412] pci 0000:06:00.0: BAR 0: failed to assign [mem size 0x00100000 64bit]
[ 106.626427] pci 0000:02:07.0: PCI bridge to [bus 07]
[ 106.663543] SAA716x Budget 0000:06:00.0: SAA716x PCI Initialization failed
[ 185.206854] pci 0000:02:07.0: [1b21:1184] type 01 class 0x060400
[ 185.207037] pci 0000:02:07.0: enabling Extended Tags
[ 185.207265] pci 0000:02:07.0: PME# supported from D0 D3hot D3cold
[ 185.210077] pcieport 0000:02:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[ 185.215664] pci 0000:02:07.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[ 185.218720] pci_bus 0000:06: busn_res: [bus 06] end is updated to 06
[ 185.219025] pci_bus 0000:07: busn_res: can not insert [bus 07-06] under [bus 02-06] (conflicts with (null) [bus 02-06])
[ 185.221840] PCI: bus7: Fast back to back transfers enabled
[ 185.221863] pci_bus 0000:07: busn_res: [bus 07-06] end is updated to 07
[ 185.221883] pci_bus 0000:07: busn_res: can not insert [bus 07] under [bus 02-06] (conflicts with (null) [bus 02-06])
[ 185.221908] pci 0000:02:07.0: devices behind bridge are unusable because [bus 07] cannot be assigned for them
[ 185.221929] pcieport 0000:01:00.0: bridge has subordinate 06 but max busn 07
[ 185.221986] pci 0000:02:07.0: PCI bridge to [bus 07]
Hi,
I succesfully installed a TBS6902 on Raspberry Pi OS with 5.15.79-v7l+ compiled kernel but I'm facing a strange issue with this device. I can tune a satellite frequency however, no matter the application that I used, the signal doesn't get lock. There is no PCIe switch on my board.
lsmod command output:
pi@raspberrypi:~/minisatip $ lsmod
Module Size Used by
8021q 32768 0
garp 16384 1 8021q
stp 16384 1 garp
llc 16384 2 garp,stp
brcmfmac 335872 0
vc4 294912 11
brcmutil 24576 1 brcmfmac
snd_soc_hdmi_codec 20480 2
cec 49152 1 vc4
cfg80211 794624 1 brcmfmac
drm_kms_helper 286720 2 vc4
av201x 16384 2
rfkill 32768 4 cfg80211
snd_soc_core 237568 2 vc4,snd_soc_hdmi_codec
v3d 81920 8
snd_compress 20480 1 snd_soc_core
gpu_sched 45056 1 v3d
snd_bcm2835 28672 0
snd_pcm_dmaengine 16384 1 snd_soc_core
tbsecp3 49152 11
snd_pcm 122880 5 snd_compress,snd_pcm_dmaengine,snd_soc_hdmi_codec,snd_bcm2835,snd_soc_core
i2c_brcmstb 16384 0
tas2101 20480 3 tbsecp3
gx1133 24576 1 tbsecp3
raspberrypi_hwmon 16384 0
snd_timer 36864 1 snd_pcm
dvb_core 114688 1 tbsecp3
i2c_mux 16384 1 gx1133
vc_sm_cma 32768 0
snd 86016 6 snd_compress,snd_soc_hdmi_codec,snd_timer,snd_bcm2835,snd_soc_core,snd_pcm
videodev 249856 0
syscopyarea 16384 1 drm_kms_helper
sysfillrect 16384 1 drm_kms_helper
mc 45056 2 videodev,dvb_core
sysimgblt 16384 1 drm_kms_helper
fb_sys_fops 16384 1 drm_kms_helper
nvmem_rmem 16384 0
uio_pdrv_genirq 16384 0
uio 20480 1 uio_pdrv_genirq
drm 548864 14 v3d,vc4,gpu_sched,drm_kms_helper
i2c_dev 20480 0
fuse 135168 3
drm_panel_orientation_quirks 16384 1 drm
backlight 20480 2 drm_kms_helper,drm
ip_tables 28672 0
x_tables 32768 1 ip_tables
ipv6 528384 46
dmesg command output:
pi@raspberrypi:~/minisatip $ dmesg | grep -i tbs
[ 5.516420] TBSECP3 driver 0000:01:00.0: enabling device (0140 -> 0142)
[ 5.516511] TBSECP3 driver 0000:01:00.0: TurboSight TBS 6902 DVB-S/S2
[ 5.806780] dvbdev: DVB: registering new adapter (TBSECP3 DVB Adapter)
[ 5.926694] TBSECP3 driver 0000:01:00.0: MAC address 00:22:ab:f1:3d:68
[ 6.078838] TBSECP3 driver 0000:01:00.0: DVB: registering adapter 0 frontend 0 (TurboSight TBS 6902 DVB-S/S2 )...
[ 6.079159] dvbdev: DVB: registering new adapter (TBSECP3 DVB Adapter)
[ 6.231250] TBSECP3 driver 0000:01:00.0: MAC address 00:22:ab:f1:3d:69
[ 6.344528] TBSECP3 driver 0000:01:00.0: DVB: registering adapter 1 frontend 0 (TurboSight TBS 6902 DVB-S/S2 )...
[ 6.344812] TBSECP3 driver 0000:01:00.0: TurboSight TBS 6902 DVB-S/S2 : PCI 0000:01:00.0, IRQ 79, MMIO 0x0
[ 10.384758] TBSECP3 driver 0000:01:00.0: DVB: adapter 1 frontend 0 frequency 0 out of range (950000..2150000)
[ 11.054730] TBSECP3 driver 0000:01:00.0: DVB: adapter 0 frontend 0 frequency 0 out of range (950000..2150000)
@ Kitoko86 Welcome to the fun world of working with out of tree drivers. Eliminate any potential hardware issue - does the card work in an x86 machine?
Support needs to come from TBS, which means https://github.com/tbsdtv/linux_media/issues. They aren't always the most responsive, particularly when they find out you're running on a Pi.
@Kitoko86 make sure you have set "dtoverlay=pcie-32bit-dma" in /boot/config.txt if i remember right this happend when the dma range is wrong and therefore no data can flow
@ Kitoko86 Welcome to the fun world of working with out of tree drivers. Eliminate any potential hardware issue - does the card work in an x86 machine?
Support needs to come from TBS, which means https://github.com/tbsdtv/linux_media/issues. They aren't always the most responsive, particularly when they find out you're running on a Pi.
The card works flawlessly in an x86 computer. It seems that is linked to the tbsecp3 driver serie because I have the same symptoms with a TBS6909. I'm going to test a Digital Devices Octopus CI S2 and give a little feedback about it. I will contact the TBS support team to diagnose the issue.
@Kitoko86 make sure you have set "dtoverlay=pcie-32bit-dma" in /boot/config.txt if i remember right this happend when the dma range is wrong and therefore no data can flow
Already tried that on 64 bit OS and no change. Thanks anyway for the advice.
Can't tune with a Digital Devices Octopus CI S2. The dmesg throws me an error about the driver when I try to tune a frequency.
There is only one device, the TBS6290, a DVB-C/-T/-T2 tuner based on the SAA716x that gives me good results.
Next attempt - DVBSky S952 v3 dual DVB-S2 tuner. SUCCESS!
It needs
CONFIG_DVB_SMIPCIE=m
in the kernel config so that the smipcie module gets built, and the dvb-demod-m88rs6000.fw firmware file.
I got the smipcie module built and firmware installed. If I modprobe the module then it
loads fine and I see adapter0 and 1 in /dev/dvb. I needed dtoverlay=pcie-32bit-dma
. This card is on a ASM1184e
However, I've got a problem if the module is automatically loaded upon boot. With the module blacklisted I see bootmessages (until something about modem manager) and then a steady cursor in the top left until the UI starts. With the module active the bootmessages are followed by a very flickery cursor in the top left and (and D2 eMMC activty LED flickers) and the UI never starts.
If I disable the UI, I get console login regardless of whether the smipcie module is loaded or not. Using lastest 64-bit Pi OS fully updated, so kernel 5.15.76.
Any ideas?
I always had this idea of having a Raspberry PI Working as a Satellite/Terrestrial Reciver and Media Player. This could finally be achieved if PCIe Tuners works.
Example of a Dual Tuner PCIe Card:
TBS6522 Dual Tuner PCIe Card DVB-S2X S2 S T2 T C2 C ISDB-T Multi Standard Digital TV Card Live TV/Window/Linux/HTPC/IPTV Server https://www.amazon.com/dp/B01MR28YAA/
Also This could be tested on a more specialized linux distro Like:
OSMC
LibreELEC
OpenPCTV