Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Problem: FE_GET_FRONTEND frequency in alps_bsrv2.c



As nobody replied to my first message, I'll try it again:

The code to retrieve the locked frequency in alps_bsrv2.c
is obviously wrong:

        case FE_GET_FRONTEND:
        {
                struct dvb_frontend_parameters *p = arg;
                s32 afc;
                afc = ((int)((char)(ves1893_readreg (i2c, 0x0a) << 1)))/2;
                afc = (afc * (int)(p->u.qpsk.symbol_rate/8))/16;

                p->frequency += afc;


Below are some values for different symbolrates; I'm reporting the
value of afc = ((int)((char)(ves1893_readreg (i2c, 0x0a) << 1)))/2;

                 27.5 22.0  12.130  11.000  5.632
--------------------------------------------------
Freq -2000 kHz     -9  -11      
Freq -1750 kHz     -8   -9       
Freq -1500 kHz     -7   -8     -16    
Freq -1250 kHz     -5   -6     -13     -15
Freq -1000 kHz     -4   -5     -11     -12    
Freq - 750 kHz     -3   -4      -8      -9    -18
Freq - 500 kHz     -2   -2      -6      -6    -12
Freq - 250 kHz     -1   -1      -3      -3     -6
Freq +i  0 kHz      0    1       0       0     -1
Freq + 250 kHz      2    2       2       3      5
Freq + 500 kHz      3    4       5       6     11
Freq + 750 kHz      4    5       8       9     16
Freq +1000 kHz      5    7      10      14
Freq +1250 kHz      6    8      13
Freq +1500 kHz      7   10      16
Freq +1750 kHz      9   11    
Freq +2000 kHz     10   12    


That's something like:

27.500: 19 afc-units for 4000 kHz = 1.1875 afc-units per 250 kHz
22.000: 23 afc-units for 4000 kHz = 1.4375 afc-units per 250 kHz
12.130: 32 afc-units for 3000 kHz = 2.6667 afc-units per 250 kHz
11.000: 29 afc-units for 2250 kHz = 3.2222 afc-units per 250 kHz
 5.632: 34 afc-units for 1500 kHz = 5.6667 afc-units per 250 kHz


Now: can anybody think of a nice formula to get the actual lock frequency
in FE_GET_FRONTEND?

It will look something like this in the end:

        case FE_GET_FRONTEND:
        {
                struct dvb_frontend_parameters *p = arg;
                s32 afc, correction;
                afc = ((int)((char)(ves1893_readreg (i2c, 0x0a) << 1)))/2;

                correction = ((afc * X) / (p->u.qpsk.symbol_rate / Y)) * Z;

                p->frequency -= correction;


What are good values for X, Y, Z?


Could someone with knowledge of the tuner specs (or with better mathematical
background ;-) please comment?


Happy Easter, Wolfgang


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index