# Difference between revisions of "Fitipower"

From LinuxTVWiki

(Initial Fitipower specs) |
(Calculate XIN) |
||

Line 7: | Line 7: | ||

==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 tuner registers indexed from 0. Always integer division. |

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

Line 87: | Line 87: | ||

=== Calculate XIN === | === 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 floor(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 === | === Calculate FP and FA === | ||

TBD | TBD | ||

=== Select bandwidth === | === Select bandwidth === | ||

− | if bandwidth = 8000 | + | *if bandwidth = 8000 |

− | * set tuner registry 6 to 0x0 | + | ** set tuner registry 6 to 0x0 |

− | if bandwidth = 7000 | + | *if bandwidth = 7000 |

− | * set tuner registry 6 to 0x40 | + | ** set tuner registry 6 to 0x40 |

− | if bandwidth = 6000 | + | *if bandwidth = 6000 |

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

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

## Revision as of 16:08, 6 December 2009

Tuner used together with AF9035.

## Contents

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

TBD

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

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