# Difference between revisions of "Fitipower"

From LinuxTVWiki

(Pre vco selection) |
|||

Line 1: | Line 1: | ||

Tuner used together with AF9035. | Tuner used together with AF9035. | ||

+ | http://www.fitipower.com.tw/main.htm?pid=9&ID=57 | ||

=Specifications= | =Specifications= | ||

− | Don't trust this blindly. | + | Don't trust this blindly. Division is always integer division. |

==Tuner general info == | ==Tuner general info == | ||

− | I2C address is 0xC0. There are 18 tuner registers indexed from 0 | + | I2C address is 0xC0. There are 18 8bit large tuner registers indexed from 0. |

{| class="wikitable" | {| class="wikitable" | ||

Line 136: | Line 137: | ||

** set tuner registry 6 to 0x80 | ** set tuner registry 6 to 0x80 | ||

− | === VCO selection === | + | === Pre VCO selection === |

− | + | fvco is a pre-calculated parameter, | |

+ | vco_sel is a parameter | ||

+ | |||

+ | *if fvco < 2320000 | ||

+ | ** set vco_sel equal to 0 | ||

+ | ** set tuner registry 6 equal to tuner registry 6 bitwise anded with the bitwise complement of 0x18 | ||

+ | *if 2320000 <= fvco < 3080000 | ||

+ | ** set vco_sel equal to 1 | ||

+ | ** set tuner registry 6 equal to tuner registry 6 bitwise or'ed with 0x10 | ||

+ | *if 3080000 <= fvco | ||

+ | ** set vco_sel equal to 1 | ||

+ | ** set tuner registry 6 equal to tuner registry 6 bitwise or'ed with 0x08 | ||

=== Fix for low frequency's === | === Fix for low frequency's === |

## Revision as of 20:43, 6 December 2009

Tuner used together with AF9035. http://www.fitipower.com.tw/main.htm?pid=9&ID=57

# Specifications

Don't trust this blindly. Division is always integer division.

## Tuner general info

I2C address is 0xC0. There are 18 8bit large tuner registers indexed from 0.

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

### Pre VCO selection

fvco is a pre-calculated parameter, vco_sel is a parameter

- if fvco < 2320000
- set vco_sel equal to 0
- set tuner registry 6 equal to tuner registry 6 bitwise anded with the bitwise complement of 0x18

- if 2320000 <= fvco < 3080000
- set vco_sel equal to 1
- set tuner registry 6 equal to tuner registry 6 bitwise or'ed with 0x10

- if 3080000 <= fvco
- set vco_sel equal to 1
- set tuner registry 6 equal to tuner registry 6 bitwise or'ed with 0x08

### 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