PC-Basic TV FM SAA7130/TUA6030 Driver

I just bought this cheap PCI card (20 euros)... And i had some problems to make it working with Ubuntu 8.10

large_IMG_0157.JPG large_IMG_0151.JPG large_IMG_0176.JPG

This card doesn't have EEPROM, so no Subvendor PID/VID except from the well known Controller "Philips SAA7130"

The card is detected, we need to specify the parameters to get it working...

So i've take a look at the card PCB and opened the Tuner box... to understand the components and capabilities of the beast...

[31 Nov 2008]
Ok, i wrote the driver for this card, for the card itself (GPIOs configuration) and for the Tuner PLL... I am now able to watch 26 canals from the french analog Cable Numericable...

The second chip near the SAA is a microcontroller for the remote control...
Pin "I" of the "IGP" missing connector is connected to the IR connector, GP pins are Gnd and maybe the MCLR pin of PIC remote control µc..

To be continued... soon... Need to write IR Driver (GPIO thing), and FM Radio configuration

[2 Dec 2008]
Radio FM is working... very well :p !

Tuner Driver Configuration (tuner-types.c):

/* ------------ TUNER_INFINEON_TUA6030 - PAL/SECAM/FM ------------ */
/*
Name          Byte  Bits 
                    MSB bit6 bit5 bit4 bit3 bit2 bit1 LSB
Write Data
Address Byte   ADB  1   1    0    0    0    MA1  MA0  R/W=0  >> I²C addr = 0xC0 (AS gnd) or 0xC2 (AS open)
Divider Byte 1 DB1  0   N14  N13  N12  N11  N10  N9   N8
Divider Byte 2 DB2  N7  N6   N5   N4   N3   N2   N1   N0
Control byte    CB  1   CP   T2   T1   T0   RSA  RSB  OS
Bandswitch byte BB  P7  P6   P5   P4   P3   P2   P1   P0
Auxiliary byte  AB* ATC AL2  AL1  AL0  0    0    0    0
* AB replaces BB when T2,T1,T0=0,1,1
 
Read data
Address byte   ADB  1   1    0    0    0    MA1  MA0  R/W=1
Status byte     SB  POR FL   1    1    AGC  A2   A1   A0
        ex:0x78 --> 0   1    1    1    1    0    0    0
                                ex:0x31 --> 0   0    1    1    0    0    0    1
                                
 *CB ******************
  * 0x80 CB: Control Byte
  * 0x40 CP: 280 uA charge pump (TV) / 0x00 60 uA charge pump (FM)
  * 0x20 T2: Set P4=fdiv output, P5=fref output
      or
    0x18 T1/T0: Auxiliary Byte will follow (otherwise byte BB will follow)
      or
    0x10 T1/T0: CP inactive (is in high-impedance state)
  * 0x06 RSA/B: Divider Ratio=64  : 62.5KHz  (fast picture search)
    0x04        Divider Ratio=24  : 166.7KHz
    0x02        Divider Ratio=128 : 31.25KHz (slow picture search)
    0x00        Divider Ratio=80  : 50KHz
  * 0x01 OS Disable tuning amplifier Vt (aka sleep)
 *BB ******************
    (only P01234 seem's to be connected to my tuner) - On philips P6=FM Mono ?
    0xF0 P4-7: NPN ports control bits  1: Port is active, VOUT= VCESAT 
    0x0F P0-3: PNP ports control bits  1: Port is active, VOUT= VCC-VCESAT, 0: inactive, high impedance state (default)
 *AB ******************
    0x80 ATC: AGC time constant bit 1: IAGC=9µA; dt=50ms
              default 0: IAGC=220nA; dt=2s
    AL2,1,0 0x40,0x20,0x10 AGC take-over point bits, 0x30 recommended by philips, but get flickers (0x20 too), 0x10 get less
 
 *Result SB ******************
  * 0x80 POR 1 at power on
  * 0x40 FL  1 PLL is locked
  * 0x08 AGC 1 Active
    0x04, 0x02, 0x01  Digital output of 5-level AGC (A2 A1 A0) 
    
  Recommended Bands limits
  PAL   RF input        Oscillator
  Band  min     max     min     max
  LOW   44.25   154.25  83.15   193.15
  MID   161.25  439.25  200.15  478.15
  HIGH  447.25  863.25  486.15  902.15
        
  NTSC
  LOW    55.25  127.25  101     173
  MID   133.25  361.25  179     407
  HIGH  367.25  801.25  413     847
 */
 
//static u8 tua6030_agc109[] = { 2, 0x80|0x00|0x18|0x06|0x01, 0x80|0x30 }; //bad for most of channels
//static u8 tua6030_agc106[] = { 2, 0x80|0x00|0x18|0x06|0x01, 0x80|0x40 };
//static u8 tua6030_noagc[]  = { 2, 0x80|0x00|0x18|0x06|0x01, 0x80|0x70 }; //good for most of channels
static u8 tua6030_extagc[]  = { 2, 0x80|0x00|0x18|0x06|0x01, 0x80|0x60 }; //good for all channels
 
//to check : if 0xc0 (or 0x80) here frequency ranges need to be changed (about +200Mhz for same canals),
static struct tuner_range tuner_infineon_tua6030_secam_ranges[] = {
        { 16 * 154.00 /*MHz*/, 0xc6, 0x01, },
        { 16 * 439.00 /*MHz*/, 0xc6, 0x02, },
        { 16 * 999.99        , 0xc6, 0x04, },
};
 
static struct tuner_range tuner_infineon_tua6030_pal_ranges[] = {
        { 16 * 158.00 /*MHz*/, 0xc6, 0x01, }, // LOW  ? not tested but working for FM
        { 16 * 443.00 /*MHz*/, 0xc6, 0x02, }, // MID  0x02/0x52 ok ! 17 chaines 176-435
        { 16 * 999.99        , 0xc6, 0x04, }, // HIGH 0x04 ok tf1 a m6 - verifier vers 670 - 800 830 850-860
};
 
static struct tuner_range tuner_infineon_tua6030_fm_ranges[] = {
        { 16 * 120.00 /*MHz*/, 0x80, 0x08, }, // 0x08 or 0x01
};
 
static struct tuner_params tuner_infineon_tua6030_params[] = {
  {
    .type   = TUNER_PARAM_TYPE_SECAM, //not used ?? (PAL) even with secam=L saa7134 module option,
    .ranges = tuner_infineon_tua6030_secam_ranges,
    .count  = ARRAY_SIZE(tuner_infineon_tua6030_secam_ranges),
    .has_tda9887 = 0,
    .port1_active = 1,
    .port2_active = 1,
    .port2_invert_for_secam_lc = 0,
  },
  {
    .type   = TUNER_PARAM_TYPE_PAL,
    .ranges = tuner_infineon_tua6030_pal_ranges,
    .count  = ARRAY_SIZE(tuner_infineon_tua6030_pal_ranges),
    .has_tda9887 = 0,
    .port1_active = 1,
    .port2_active = 1, //sinon pas de son
    .port2_invert_for_secam_lc = 0,
  },
  {
    .type   = TUNER_PARAM_TYPE_RADIO,
    .ranges = tuner_infineon_tua6030_fm_ranges,
    .count  = ARRAY_SIZE(tuner_infineon_tua6030_fm_ranges),
    .has_tda9887 = 1,
    .port1_active = 0,
    .port2_active = 1,
    .fm_gain_normal=1,
    .port1_set_for_fm_mono = 1,
    .port2_fm_high_sensitivity = 0, //needed
    .radio_if = 1,
  },
};

...
        [TUNER_INFINEON_TUA6030] = { /* Infineon PAL/SECAM/FM */
                .name   = "Infineon TUA6030",
                .params = tuner_infineon_tua6030_params,
                .count  = ARRAY_SIZE(tuner_infineon_tua6030_params),
                .initdata = tua6030_extagc,
                .sleepdata = tua6030_extagc,
        },      
        //Dummy tuner, bug <= tuner_count-1
        [TUNER_INFINEON_TUA6030] = { /* Infineon PAL/SECAM/FM */
                .name   = "Infineon TUA6030",
                .params = tuner_infineon_tua6030_params,
                .count  = ARRAY_SIZE(tuner_infineon_tua6030_params),
                .initdata = tua6030_extagc,
                .sleepdata = tua6030_extagc,
        },
};
EXPORT_SYMBOL(tuners);

and in tuner-simple.c

static int simple_radio_bandswitch(struct dvb_frontend *fe, u8 *buffer)
{
        struct tuner_simple_priv *priv = fe->tuner_priv;
 
        switch (priv->type) {
        ...
        case TUNER_INFINEON_TUA6030:
                //keep tuner-types config !
                buffer[3] = 0x01;
                break;
        }
        ...
        return 0;
}

[3 Dec 2008]
After some research, i think the Remote Control Chip look like a 18pin 8bit PIC16F84 micro controller, VDD/VSS and XTAL pin's are at the right place... and IRDA signal come also on the unique Interrupt Pin (RB0)

I've connected the chip to a PIC programmer via ICSP (ICD2) ... but the chip seem's to be code-protected

Remote.JPG

If we assume the chip is a 16F84, RB0 is the Signal from IR Receiver, RB1 to RB7 are connected to SAA7130 GPIO 8 to 14.
GPIO 14 is the Key Press Event, it is set to zero when key is pressed.

For the last pin RA/GPIO 15 (which have a resistor pulled to VDD), it must be switched to 0 to enable IR listening...

So for the card configuration (in saa7134-cards.c)

[SAA7134_BOARD_PCBASIC_TV_FM] = {
/* Tanguy Pruvot (fr) <tanguy.pruvot on gmail.com> */
 .name           = "PC-Basic TVBasic-FM (saa7130)",
 .audio_clock    = 0x00187de7,
 .tuner_type     = TUNER_INFINEON_TUA6030, //TUNER_PHILIPS_FM1216ME_MK3,
 .radio_type     = TUNER_INFINEON_TUA6030, //TUNER_PHILIPS_FM1216ME_MK3,
 .tuner_addr     = 0x60, // i2c = 0xC0
 .radio_addr     = 0x60, // i2c = 0xC0
 .gpiomask       = 0x0108000,
 .inputs = {{
  .name = name_tv,
  .vmux = 3,
  .amux = LINE2,
  .tv   = 1,
 },{
  .name = name_comp1,
  .vmux = 1,
  .amux = LINE1,
 },{
  .name = name_svideo,
  .vmux = 8,
  .amux = LINE1,
 }},
 .radio = {
  .name = name_radio,
  .amux = LINE2,
 },
 .mute = {
  .name = name_mute,
  .amux = LINE1,
  .gpio = 0, //enable remote
 },
},
 
//... and at the end of the file... weird but needed
 
  case SAA7134_BOARD_PCBASIC_TV_FM:
    if (dev->i2c_client.addr != 0x60) {
      printk("%s: SAA7134_BOARD_PCBASIC_TV_FM tuner i2c client address set from 0x%x to 0x60\n", 
                  dev->name, dev->i2c_client.addr);
      dev->i2c_client.addr = 0x60; //0xC0
    }
    break;
  } /* switch() */

Tuner box is from TCL, product page. (Thanks Hermann)

[5 December 2008]
Remote Control working !

saa7134-input.c

        case SAA7134_BOARD_PCBASIC_TV_FM:
                ir_codes     = ir_codes_manli;
                mask_keycode = 0x003f00;
                mask_keyup   = 0x004000;
                polling      = 50; // ms
                break;
        }

So, i compared the device settings with other cards... and i've seen a compatible card in the supported card list :
The Russian Behold TV 505FM (Card=126)

Fichier attachéTailleDownloadsLast Download
Datasheet Philips SAA7130HL.pdf197.39 Ko6349il y a 3 sec
Datasheet Infineon TUA6030 v2.2.pdf882.36 Ko5642il y a 3 sec
Datasheet Philips FM1216ME_MK3 - TUA6030 compatible.pdf1.16 Mo6521il y a 4 sec

Commentaires

Options d'affichage des commentaires

Sélectionnez la méthode d'affichage des commentaires que vous préférez, puis cliquez sur "Sauvegarder les paramètres" pour activer vos changements.

[linux-dvb] [TUA6030] From Hermann Pitton (.de) 3 Dec. 2008

These tuners have been seen at first on Hauppauge products as
replacement for the Philips FM1216ME/I H-3 (MK-3) and a member of the
video4linux-list in the UK had confirmation from Hauppauge's user
support there, that they are compatible with the prior tuner=38.

This was for a MFPE05-2. (PE = PAL/Europe)
http://tuner.tcl.com/English/html/enewsproopen.asp?proname=107&url=product
I think a MFPE05-3-E was reported on some device too.

Since then this tuner is mapped to tuner=38 in media/video/tveeprom.c
and is on several Hauppauge devices, but also on others. No complaints
so far.

The layout of the tuner PCB of your MFPE05-2-E and the FM1216ME MK3
seems to be identical. The most visible difference is, that the on your
tuner just unused tuner pins 7 and 8 are not present at the Philips at
all. Means 12 against 14 visible tuner pins according to your
photograph.

Else only the color of some of the coils differs and instead of TUA 6032
marked on the pll chip, on the pll used by Philips is only printed B2
and 230, but both have 38pins connected to the obviously same layout.

You might even have the same original EPCOS SAW filters, but your tuner
will not support NTSC, needs different filter equipment.
NTSC is covered by the MFNM05. (NM = NTSC N/M)
http://tuner.tcl.com/English/html/enewsproopen.asp?proname=108&url=product
This also causes the different bandswitch takeover frequencies.

On a first look at the main programming table all write and read bytes
are identical up to every single bit. You can find the datasheet of the
Philips FM1216ME MK3 we have these days at ivtvdriver.org.
http://dl.ivtvdriver.org/datasheets/tuners

If we find details not covered by tuner=38, you can get a new tuner
entry, but the patch must be against recent v4l-dvb. The radio should be
treated like on the other MK3 tuners in tuner-simple.c I guess.
IIRC, we have reports for radio working well with port1=1, inactive, FM
high sensitivity.

We would need a valid signed-off-by line from you as well.

Thanks, especially for the picture of the opened tuner. We did not have
any further details previously. Just testing results and the Hauppauge
hint.

Cheers,
Hermann