Building Black Gold BGT3xxx DVB-T2 Drivers for Linux

pgslegs

Novice Member
Hi there,

Thanks for all this great work. I have had a BGT3595 for 6 or 8 years and had long given up on getting it to work in linux. Then my Gigablue Quad broke last week so decided to revisit TVheadend and Kodi.

It really was very exciting to finally be able to compile and see the card come up in TVHeadend.

I have two small issues that others may have seen before.

I am running ubuntu 18.04.1 LTS and kernel is 4.15.0-38

1. The DVB-T tuners work great but dont seem to work independently. If a mux is in use the other tuner is blocked to that mux. Is this expected?
2. I cant get the DVB-S2 tuners to lock. I keep getting the error below in TVheadend.

Nov 04 11:21:52 PWALSRV tvheadend[2314]: mpegts: 11068V in Freesat - tuning on STV090x Multistandard #0 : DVB-S #0
Nov 04 11:21:52 PWALSRV tvheadend[2314]: diseqc: failed to set voltage (e=Operation not supported)

I have the LNB set to Not Set for higher voltage. I get similar messages when higher voltage setting in TVHeadend is enabled

Any ideas would be much appreciated?

cheers
 

pgslegs

Novice Member
I am also getting this from lsdvb


lsdvb: Simple utility to list PCI/PCIe DVB devices
Version: 0.0.4
Copyright (C) Manu Abraham


SAA7231 (1131:7231 14:3585) on PCI Domain:0 Bus:9 Device:0 Function:0
DEVICE:0 ADAPTER:2 ERROR: Open frontend0 failed
 

trident01

Member
hi
yes dual tuner bug there is, not had time to see why

not got got any deseqc hardware so can not test, but will start to get back to doing stuff with the drivers. but testing sat was working fine for me and even dual tuner.

lsdvd not working if you got tvheadend running it got hold of the tuner.
make sure you stop tvheradend then lsdvb will work

so my plan for the driver is to make it able to use the kernel drivers. this way i dont need to worry if the kernel driver for the tuner are there I dont need to install are driver just use.
this way we keep in line with the kernel.

hope this helps a little
 

pgslegs

Novice Member
Thanks yes helps alot.

Im not using disecq either. Its fixed at Astra 28.2 thats why the message is confusing. Will play around with settings in Tvheadend

Great work again!
 

DragonQ

Member
I am also getting this from lsdvb


lsdvb: Simple utility to list PCI/PCIe DVB devices
Version: 0.0.4
Copyright (C) Manu Abraham


SAA7231 (1131:7231 14:3585) on PCI Domain:0 Bus:9 Device:0 Function:0
DEVICE:0 ADAPTER:2 ERROR: Open frontend0 failed
I get the same output when running lsdvb. Both tuners seem to work fine within Tvheadend though.

Annoyingly, I cannot get rid of the "poll TIMEOUT" error I described above. When I had IOMMU enabled, it would appear all the time. With IOMMU disabled, the card works but only for a certain period of time. Eventually, normally after a day or two, the card starts exhibiting this error again. The only fix I've found is to reboot the machine. I haven't yet found a cause for it - I've tried disabling automatic updates, and I've turned off my power saving tweaks too. I'm not even sure what to look for in log files for a clue to be honest.
 

DragonQ

Member
thanks for the update
i see if i can work out why this happen for you
It broke twice today. Both times I rebooted the server, then tested tuning worked, then I noticed the error in the logs whilst it was trying to do an EPG grab some time later (a couple of hours).
 

pgslegs

Novice Member
I get the same output when running lsdvb. Both tuners seem to work fine within Tvheadend though.

Annoyingly, I cannot get rid of the "poll TIMEOUT" error I described above. When I had IOMMU enabled, it would appear all the time. With IOMMU disabled, the card works but only for a certain period of time. Eventually, normally after a day or two, the card starts exhibiting this error again. The only fix I've found is to reboot the machine. I haven't yet found a cause for it - I've tried disabling automatic updates, and I've turned off my power saving tweaks too. I'm not even sure what to look for in log files for a clue to be honest.
I get the same poll timeout errors now on DVBT. Stopped working after a few days. Restarting tvheadend doesn’t make a difference
 

trident01

Member
not seen that on dvbt
which card was that did you have both tuner on
and which board cpu

sorry if am a pain but as i did not write the main drive i have to start look and see what is wrng so the more information i get the better
plus say what tuner driver it using as well like cx2820r or cxd2837

what linux version/kernel
thanks
Carl
 

pgslegs

Novice Member
My card is BG3595

Core i5 CPU
Ubuntu 18.04.01 LTS
Kernel 4.15.0-38 x64

How do I check which driver above in use I only see saa7231_core for dvb_core
 

trident01

Member
lsdvb show all the tuner you have
just make sure you not using TVheadend is on as it lock the tuner and lsdvb does not work
thanks
 

DragonQ

Member
not seen that on dvbt
which card was that did you have both tuner on
and which board cpu

sorry if am a pain but as i did not write the main drive i have to start look and see what is wrng so the more information i get the better
plus say what tuner driver it using as well like cx2820r or cxd2837

what linux version/kernel
thanks
Carl
I get it on DVB-S2.

Motherboard: Asus PRIME X370-PRO
CPU: AMD Ryzen 1700
OS: Ubuntu 18.04 LTS
Kernel: 4.15.0.38-generic
Tuner: BGT3600
Driver: BGT3xxx-fork-for-cxd2837 (branch: master, SHA: 6eb85f61)

Output of lsdvb:

Code:
lsdvb: Simple utility to list PCI/PCIe DVB devices
                Version: 0.0.4
                Copyright (C) Manu Abraham

SAA7231 (1131:7231 14:3600) on PCI Domain:0 Bus:0 Device:0 Function:0
        DEVICE:0 ADAPTER:2 FRONTEND:0 (Sony CXD2820R)
                 FE_OFDM Fmin=42MHz Fmax=870MHz
        DEVICE:0 ADAPTER:0 ERROR: Open frontend0 failed
The other adapter might be the DVB-C2 or DVB-T2 tuner on the card, which is disabled in Tvheadend.

Output of lsmod | grep saa:
Code:
saa7231_drv            24576  0
saa7231_core           65536  3 saa7231_drv
dvb_core              122880  2 cxd2820r,saa7231_core
 

pgslegs

Novice Member
My card is BG3595

Core i5 CPU
Ubuntu 18.04.01 LTS
Kernel 4.15.0-38 x64

How do I check which driver above in use I only see saa7231_core for dvb_core
Lsdvb output

SAA7231 (1131:7231 14:3585) on PCI Domain:0 Bus:9 Device:0 Function:0

DEVICE:0 ADAPTER:2 FRONTEND:0 (NXP TDA10048HN DVB-T) FE_OFDM Fmin=177MHz Fmax=858MHz
DEVICE:0 ADAPTER:0 FRONTEND:0 (STV090x Multistandard) FE_QPSK Fmin=950MHz Fmax=2150MHz
DEVICE:0 ADAPTER:3 FRONTEND:0 (NXP TDA10048HN DVB-T) FE_OFDM Fmin=177MHz Fmax=858MHz
DEVICE:0 ADAPTER:1 FRONTEND:0 (STV090x Multistandard) FE_QPSK Fmin=95
 

trident01

Member
so it the satellite part
that the oldest driver which has never been touch by me as it alwayed worked
not fun

when i bit better i will work on doing the driver from the ground up and get the kernel driver to work with are driver
 

DragonQ

Member
My system is currently in an errored state. The outputs of lsdvb and lsmod are identical. I can see nothing of interest in dmesg - should there be dmesg logs for this driver? Is there anywhere else I can check for debug info?

The information in this bug might be relevant? They link to a kernel issue that has the same symptoms, albeit for a USB tuner. It definitely has the hallmarks of some mutex locking issue.

For now, I've discovered that I can get the tuner working again by resetting the card, which is certainly faster and less annoying than rebooting the system. First, find the device ID of the card:

Code:
lspci | grep SAA
Then issue the following command as root:

Code:
echo "1" > /sys/bus/pci/devices/<device ID>/reset
I'm gonna try to put this in a cron script to do it automatically when a "poll TIMEOUT" is seen in the Tvheadend logs. It's a useful workaround but not ideal because obviously if it happens mid-recording you're gonna lose part of the recording, and if it happens mid-viewing who knows how clients will react.

EDIT: Although this does fix the card, it seems to break again VERY quickly when it tries to do an EPG scan (currently set to every 5 minutes), so I'm not sure this is viable. Maybe there is a chance of the driver locking up every time a tune is performed and therefore having it scan every 5 minutes makes it happen very quickly? I reset the card at 14:32, then it performed EPG scans at 14:35, 14:40, and 14:45, then I got the "poll TIMEOUT" error at 14:48. My EPG scans have a timeout of 3 minutes so it looks like the error first appeared exactly when the EPG scan timed out:

Code:
2018-11-10 14:45:00.985 [  DEBUG]:mpegts: 11425H in Freesat HD - add raw service
2018-11-10 14:45:00.985 [  DEBUG]:service: 8: 11425H in Freesat HD si 0x7fa63401ec90 BGT3600: DVB-S #0 weight 0 prio 10 error 0 (OK)
2018-11-10 14:45:00.985 [  DEBUG]:service: 7: 11425H in Freesat HD si 0x7fa63400bf70 BGT3600: DVB-S #1 weight 0 prio 10 error 0 (OK)
2018-11-10 14:45:00.985 [   INFO]:mpegts: 11425H in Freesat HD - tuning on BGT3600: DVB-S #1
2018-11-10 14:45:00.987 [  DEBUG]:linuxdvb: BGT3600: DVB-S #1 - starting 11425H in Freesat HD
2018-11-10 14:45:01.303 [  DEBUG]:mpegts: 11425H in Freesat HD - started
2018-11-10 14:45:01.303 [  DEBUG]:tbl-eit: uk_freesat: grab started
2018-11-10 14:45:01.303 [  DEBUG]:mpegts: 11425H in Freesat HD - open PID tables subscription [0042/0x7fa6340092c0]
2018-11-10 14:45:01.303 [   INFO]:subscription: 005C: "epggrab" subscribing to mux "11425H", weight: 4, adapter: "BGT3600: DVB-S #1", network: "Freesa
t HD", service: "Raw PID Subscription"
2018-11-10 14:45:01.303 [  DEBUG]:epggrab: no OTA modules active for 10936.5V in Freesat HD, check again next time
2018-11-10 14:45:01.623 [  DEBUG]:linuxdvb: BGT3600: DVB-S #1 - status    GOOD (SIGNAL | CARRIER | VITERBI | SYNC | LOCK)
2018-11-10 14:45:01.623 [  DEBUG]:linuxdvb: BGT3600: DVB-S #1 - locked
...
2018-11-10 14:48:08.956 [WARNING]:linuxdvb: BGT3600: DVB-S #1 - poll TIMEOUT
2018-11-10 14:48:09.359 [WARNING]:linuxdvb: BGT3600: DVB-S #1 - retune nodata
2018-11-10 14:48:09.965 [  DEBUG]:linuxdvb: BGT3600: DVB-S #1 - status    GOOD (SIGNAL | CARRIER | VITERBI | SYNC | LOCK)
2018-11-10 14:48:11.286 [  DEBUG]:epggrab: grab done for 11425H in Freesat HD (timeout)
2018-11-10 14:48:11.286 [WARNING]:epggrab: UK: Freesat - data completion timeout for 11425H in Freesat HD
2018-11-10 14:48:11.286 [   INFO]:subscription: 005C: "epggrab" unsubscribing
2018-11-10 14:48:11.286 [  DEBUG]:mpegts: 11425H in Freesat HD - close PID tables subscription [0042/0x7fa6340092c0]
2018-11-10 14:48:11.286 [  DEBUG]:mpegts: 11425H in Freesat HD - stopping mux
2018-11-10 14:48:11.286 [  DEBUG]:linuxdvb: BGT3600: DVB-S #1 - stopping 11425H in Freesat HD
2018-11-10 14:48:11.287 [  DEBUG]:linuxdvb: BGT3600: DVB-S #1 - stopped dvr thread
 
Last edited:

DragonQ

Member
I enabled verbose mode for the driver and got a tonne of syslog entries. My monitoring script detected that the card died between 2018-11-18 18:37:01 and 2018-11-18 18:38:01, so I've trimmed down the log to a couple of minutes around that time. It means nothing to me but maybe it will mean something to trident01?
 

Attachments

DragonQ

Member
An update on this card lock-up issue: it seems to go away if I only enable one of my two DVB-S2 tuners. Obviously only having one tuner isn't ideal but at least it seems stable for now. I've recorded about 6-7 hours of TV so far without it locking up, whereas before I'd be lucky to get 20-30 minutes without it locking up.

Has anyone else used these drivers with a card that has more than one tuner of a certain type on it? I imagine something like a BGT3630 wouldn't have this issue, maybe that's why I seem to be the first person to encounter it. Hopefully this helps narrow down the underlying cause as well.
 

trident01

Member
ok thanks for the update that the dual tuner bug
it only seem to happen manly with dual dvb-t2 not dvb-s2 but it now show it the driver at fault
it one of the bug a few people are looking at but noone know were
and as the person who made the driver is gone it a hard job
 

robbo100

Well-known Member
Hi all,

I have just installed LibreElec 9.0.2 on my media server to replace Windows with a MediaPortal TV Server back-end.

However, having done so, it looks like LibreElec doesn't have drivers built in for BGT cards. Has anyone managed to get the BGT 3600 card working with LibreElec TVHeadend? If so, can you point me to the best section of this thread to get me started. (I looked at the first thread, but you can't ssh into the root with LibreElec, so it isn't possible).

Thanks
 

trident01

Member
can you ssh into your machine
as how day you can not do root but loging with your default login then do sudo su to become root
 

robbo100

Well-known Member
can you ssh into your machine
as how day you can not do root but loging with your default login then do sudo su to become root
Thanks for the reply.

If I type "sudo su" I get the following response:

There is no working 'sudo'.

On debian/ubuntu/all general purpose linux distributions 'sudo'
allows a permitted user to execute a command as the superuser
or another user, as specified by the security policy

With LibreELEC you have root access by default, so you dont need 'sudo'
If I then type ls to get the directory list, I only get

backup music screenshots videos
lost+found pictures tvshows
 

trident01

Member
at the moment i can not test, but next week i will try to have a look unless someone else say

some time linux keep you in it own directory so you could try cd / then do ls to see if it give you the whole file system
if it does not then you do not have root access so you never see the / directory
 

The latest video from AVForums

Podcast: Home AV, TV, Tech News & Reviews, Plus The Best of July 2020

Trending threads

Latest News

McIntosh and Sonus faber unite under Fine Sounds Distribution in UK
  • By Andy Bassett
  • Published
JBL launches 4349 Studio Monitor
  • By Andy Bassett
  • Published
LG Display next generation OLEDs showcased at SID 2020
  • By Andy Bassett
  • Published
AVForums Podcast: 2nd August 2020
  • By Phil Hinton
  • Published
Top Bottom