|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2013-12-20 19:10:13
|
显示全部楼层
谢谢 primula 朋友,以下是代码,等待大家帮助,周末愉快!
int ATBMPowerOnInit()
{
int power_on_status = 0;
uint8_t ui8pll ;//reset_status;
uint8_t ui8ChipID;
stCustomConfig.stTunerConfig.ui8IQmode = SWAP_IQ ;
stCustomConfig.stTunerConfig.ui8DTMBBandwithMHz = 8; //unit: MHz
stCustomConfig.stTunerConfig.ui32IFFrequency = 5; //
//demod config
stCustomConfig.stTsMode.ui8TSTransferType = TS_PARALLEL_MODE;
stCustomConfig.stTsMode.ui8OutputEdge = TS_OUTPUT_FALLING_EDGE;
stCustomConfig.stTsMode.ui8SPIClockConstantOutput = TS_CLOCK_VALID_OUTPUT;
stCustomConfig.stTsMode.ui8TSSPIMSBSelection = TS_SPI_MSB_ON_DATA_BIT7;
stCustomConfig.stTsMode.ui8TSSSIOutputSelection = TS_SSI_OUTPUT_ON_DATA_BIT0;
stCustomConfig.ui8CrystalOrOscillator = OSCILLATOR;
stCustomConfig.ui32SampleClkFrequency = 24; //
//dvbc config
stCustomConfig.stDvbcParams.i32SymbolRate = 6875;//
stCustomConfig.stDvbcParams.ui8InputMode = DVBC_IF_INPUT;
ui8ChipID = ATBMChipID(); //
if(ui8ChipID == 0x40)
{
ATBMWrite(0x01, 0x0c, 0x00);
ATBMWrite(0x06, 0x06, 0x00);
ATBMWrite(0x01, 0x03, 0x00);
ATBMRead(0x06, 0x0e, &ui8pll);
ATBMWrite(0x06, 0x04, 0x01);
ui8pll |= 0x01;
ATBMWrite(0x06, 0x0e,ui8pll);
ui8pll &= 0xfe;
ATBMWrite(0x06, 0x0e,ui8pll);
ATBMWrite(0x06, 0x04, 0x00);
}
//else if(ui8ChipID == 0x30)
//{
// reset_status = ATBMReset(stCustomConfig.ui8CrystalOrOscillator); //Check hardware state
// if(reset_status ==0)
// {
// printf("please check Crystal or oscillator setting\n");
// }
// ATBMWrite(0x06, 0x06, 0x00);
// ATBMWrite(0x01, 0x03, 0x00);
//}
else
{
printf("power on init failed, chip not correctly detected\n");
}
System_wait(1);/*1 ms*/
return power_on_status;
}
其中 ATBMRead和ATBMWrite是I2C读写函数。
|
|