Fitipower: Difference between revisions

From LinuxTVWiki
Jump to navigation Jump to search
(Calculate XIN)
No edit summary
Line 66: Line 66:
fvco is a parameter
fvco is a parameter


if frequency < 54000
*if frequency < 54000
* set fvco to frequency * 64
** set fvco to frequency * 64
* set tuner registry 5 to 0x82
** set tuner registry 5 to 0x82


if 54000 =< frequency < 108000
*if 54000 =< frequency < 108000
* set fvco to frequency * 32
** set fvco to frequency * 32
* set tuner registry 5 to 0x42
** set tuner registry 5 to 0x42


if 108000=< frequency < 216000
*if 108000=< frequency < 216000
* set fvco to frequency * 16
** set fvco to frequency * 16
* set tuner registry 5 to 0x22
** set tuner registry 5 to 0x22


if 216000=< frequency < 432000
*if 216000=< frequency < 432000
* set fvco to frequency * 8
** set fvco to frequency * 8
* set tuner registry 5 to 0x12
** set tuner registry 5 to 0x12


if frequency > 432000
*if frequency > 432000
* set fvco to frequency * 4
** set fvco to frequency * 4
* set tuner registry 5 to 0x0A
** set tuner registry 5 to 0x0A


=== Calculate XIN ===
=== Calculate XIN ===
Line 92: Line 92:
xdiv is a parameter
xdiv is a parameter


*set xdiv equal to floor(fvco/18000)
*set xdiv equal to fvco / 18000
* set fraction equal to fvco minus xdiv multiplied by 18000
* set fraction equal to fvco minus xdiv multiplied by 18000
* set fraction equal to fraction left shifted 15 times and then divided by 18000
* set fraction equal to fraction left shifted 15 times and then divided by 18000
Line 107: Line 107:
*write xin right shifted 8 times to tuner register 3
*write xin right shifted 8 times to tuner register 3
*write xin only 8 low bits to tuner register 4
*write xin only 8 low bits to tuner register 4

=== Calculate FP and FA ===
=== Calculate FP and FA ===
fvco is a pre-calculated parameter,
TBD
xdiv is a pre-calculated parameter,
xdivr is a parameter,
fp is a 8 bit wide parameter,
fa is a parameter

*set xdivr equal to xdiv
*if fvco minus xdiv multiplied by 18000 is greater equal to 9000
** set xdivr equal to xdiv + 1
* set fp equal to xdivr / 8
* set fa equal to xdivr minus fp left shifted 3 times
* if fa is less then 2
** set fp equal fp minus 1
** set fa equal fa plus 8
* write fa to tuner register 1
* write fp to tuner register 2


=== Select bandwidth ===
=== Select bandwidth ===
Line 119: Line 135:
*if bandwidth = 6000
*if bandwidth = 6000
** set tuner registry 6 to 0x80
** set tuner registry 6 to 0x80

=== VCO selection ===
TBD


=== Fix for low frequency's ===
=== Fix for low frequency's ===
Line 130: Line 149:
=== Write frequency parameters ===
=== Write frequency parameters ===
* write tuner registry 0-6
* write tuner registry 0-6



[[Category:Tuners]]
[[Category:Tuners]]

Revision as of 16:21, 6 December 2009

Tuner used together with AF9035.

Specifications

Don't trust this blindly.

Tuner general info

I2C address is 0xC0. There are 18 tuner registers indexed from 0. Always integer division.

Index Name
1 FA
2 FP
3,4 XIN
5 VCO
6 VCO_SELECT
14 VCO_CALIBRATE

Init/Reset

Enable tuner:

  • write 1 to GPIO 0xD8EB
  • write 1 to GPIO 0xD8EC
  • write 1 to GPIO 0xD8ED

Enable led:

  • write 1 to GPIO 0xD8D1
  • write 1 to GPIO 0xD8D0

UnInit

Disable led:

  • write 0 to GPIO 0xD8D1
  • write 0 to GPIO 0xD8D0

Tune

Tuning is based on 2 parameters:

  • bandwidth in Hz, can be 6000,7000 or 8000
  • frequency in Hz, can be the regular DVB-T frequency's

Init tuning

  • write 0x0F to tuner register 7
  • write 0x3E to tuner register 8
  • write 0xB8 to tuner register 10
  • write 0x80 to tuner register 11
  • write 0x04 to tuner register 13

Generate the frequency of VCO and the VCO divider

fvco is a parameter

  • if frequency < 54000
    • set fvco to frequency * 64
    • set tuner registry 5 to 0x82
  • if 54000 =< frequency < 108000
    • set fvco to frequency * 32
    • set tuner registry 5 to 0x42
  • if 108000=< frequency < 216000
    • set fvco to frequency * 16
    • set tuner registry 5 to 0x22
  • if 216000=< frequency < 432000
    • set fvco to frequency * 8
    • set tuner registry 5 to 0x12
  • if frequency > 432000
    • set fvco to frequency * 4
    • set tuner registry 5 to 0x0A

Calculate XIN

fraction is a 16bit unsigned parameter, xin is a parameter, fvco is a pre-calculated parameter, xdiv is a parameter

  • set xdiv equal to fvco / 18000
  • set fraction equal to fvco minus xdiv multiplied by 18000
  • set fraction equal to fraction left shifted 15 times and then divided by 18000
  • if fraction is greater or equal to 16384
    • set fractional equal to fractional plus 32768
  • if fraction is equal to 0
    • set xin equal to 0
  • if 0 < fraction < 511
    • set xin equal to 0x200
  • if 511 < fraction <= 65025
    • set xin equal to fraction
  • if 65025 < fraction
    • set xin equal to 0xfe00
  • write xin right shifted 8 times to tuner register 3
  • write xin only 8 low bits to tuner register 4

Calculate FP and FA

fvco is a pre-calculated parameter, xdiv is a pre-calculated parameter, xdivr is a parameter, fp is a 8 bit wide parameter, fa is a parameter

  • set xdivr equal to xdiv
  • if fvco minus xdiv multiplied by 18000 is greater equal to 9000
    • set xdivr equal to xdiv + 1
  • set fp equal to xdivr / 8
  • set fa equal to xdivr minus fp left shifted 3 times
  • if fa is less then 2
    • set fp equal fp minus 1
    • set fa equal fa plus 8
  • write fa to tuner register 1
  • write fp to tuner register 2

Select bandwidth

  • if bandwidth = 8000
    • set tuner registry 6 to 0x0
  • if bandwidth = 7000
    • set tuner registry 6 to 0x40
  • if bandwidth = 6000
    • set tuner registry 6 to 0x80

VCO selection

TBD

Fix for low frequency's

if frequency < 45000

  • set tuner registry 1 to 0x06
  • set tuner registry 2 to 0x11

Fix clock out

  • set tuner registry 6 to the result of a bitwise OR between tuner registry 6 and 0x20

Write frequency parameters

  • write tuner registry 0-6