Wavebubble 2010 Hardware Test
Functions

pll.c File Reference

#include <avr/io.h>
#include <avr/pgmspace.h>
#include "pll.h"
#include "main.h"
#include "serial.h"
#include "test.h"

Functions

void pll_init (void)
void pll_tx (uint32_t data, uint8_t addr)
void pll_set_rcounter (uint16_t rcounter)
void pll_set_freq (uint16_t rf_freq, uint8_t prescaler, uint8_t reg)
uint8_t tune_rf (uint16_t freq)
uint8_t tune_if (uint16_t freq)
uint8_t tune_rf_band (uint16_t min, uint16_t max, uint8_t vco_num)

Detailed Description

PLL driver functions


Function Documentation

void pll_init ( void  )
void pll_set_freq ( uint16_t  rf_freq,
uint8_t  prescaler,
uint8_t  reg 
)

Set PLL frequency and prescaler

Parameters:
rf_freqRF frequency to set
prescalerPLL prescaler
regPLL stage to use, RF or IF

References pc_putc(), pc_puts_P(), pll_tx(), and putnum_ud().

void pll_set_rcounter ( uint16_t  rcounter)

Set reference counter

Set PLL reference counter.

Parameters:
rcounterReference counter value

References pll_tx().

void pll_tx ( uint32_t  data,
uint8_t  addr 
)

Send data to PLL

Send data word to specific PLL address.

Parameters:
dataData word to send
addrPLL register address

References PLLCLK, PLLCLK_PORT, PLLDATA, PLLDATA_PORT, PLLLE, and PLLLE_PORT.

Referenced by pll_init(), pll_set_freq(), pll_set_rcounter(), and test_pll1().

uint8_t tune_if ( uint16_t  freq)

Tune VCO2 frequency

Tune VCO2 to specific frequency using the PLL.

Parameters:
freqFrequency to tune.
Returns:
Tuning midpoint value, 0 if tuning failed

References BANDWADJ2_RES, delay_ms(), pc_putc(), pc_puts_P(), PLL_IFIN, PLL_IFIN_PIN, pll_set_if, POWERCTL2, POWERCTL2_PORT, putnum_ud(), and set_resistor().

Referenced by tune_rf_band().

uint8_t tune_rf ( uint16_t  freq)

Tune VCO1 frequency

Tune VCO1 to specific frequency using the PLL.

Parameters:
freqFrequency to tune.
Returns:
Tuning midpoint value, 0 if tuning failed

References BANDWADJ1_RES, delay_ms(), pc_putc(), pc_puts_P(), PLL_RFIN, PLL_RFIN_PIN, pll_set_rf, POWERCTL1, POWERCTL1_PORT, putnum_ud(), and set_resistor().

Referenced by tune_rf_band().

uint8_t tune_rf_band ( uint16_t  min,
uint16_t  max,
uint8_t  vco_num 
)

Tune RF stage to frequency bandwidth

Tune given VCO to specific frequency bandwidth.

Parameters:
minMinimum frequency to tune.
maxMaximum frequency to tune.
vco_numNumber of VCO, 0 or 1
Returns:
Value of digital potentiometer, 0 if tuning failed

References BANDWADJ1_RES, BANDWADJ2_RES, delay_ms(), pc_puts_P(), pll_set_if, pll_set_rf, putnum_ud(), set_resistor(), set_sawtooth_high(), set_sawtooth_low(), tune_if(), and tune_rf().