센서보드 RF IRQ 테스트 중 and bug fix?
Fork of EV-COG-AD3029LZ by
Diff: source/libs/spirit1/SPIRIT1_Library/Src/SPIRIT_Radio.c
- Revision:
- 83:54b207156a91
- Parent:
- 67:93bec0baf1de
- Child:
- 84:45b9ff78a066
--- a/source/libs/spirit1/SPIRIT1_Library/Src/SPIRIT_Radio.c Fri Feb 02 14:13:24 2018 +0100 +++ b/source/libs/spirit1/SPIRIT1_Library/Src/SPIRIT_Radio.c Wed Mar 21 05:06:08 2018 +0000 @@ -193,12 +193,15 @@ uint8_t drM, drE, FdevM, FdevE, bwM, bwE; /* Workaround for Vtune */ + printf("test 9-1\n"); uint8_t value = 0xA0; SpiritSpiWriteRegisters(0x9F, 1, &value); /* Calculates the offset respect to RF frequency and according to xtal_ppm parameter: (xtal_ppm*FBase)/10^6 */ + printf("test 9-2\n"); FOffsetTmp = (int32_t)(((float)pxSRadioInitStruct->nXtalOffsetPpm*pxSRadioInitStruct->lFrequencyBase)/PPM_FACTOR); /* Check the parameters */ + printf("test 9-3\n"); s_assert_param(IS_FREQUENCY_BAND(pxSRadioInitStruct->lFrequencyBase)); s_assert_param(IS_MODULATION_SELECTED(pxSRadioInitStruct->xModulationSelect)); s_assert_param(IS_DATARATE(pxSRadioInitStruct->lDatarate)); @@ -207,6 +210,7 @@ s_assert_param(IS_F_DEV(pxSRadioInitStruct->lFreqDev,s_lXtalFrequency)); /* Disable the digital, ADC, SMPS reference clock divider if fXO>24MHz or fXO<26MHz */ + printf("test 9-4\n"); SpiritSpiCommandStrobes(COMMAND_STANDBY); do{ /* Delay for state transition */ @@ -214,6 +218,7 @@ /* Reads the MC_STATUS register */ SpiritRefreshStatus(); + printf("test 9-4 g_xStatus.MC_STATE : [0x%02X]\n", g_xStatus.MC_STATE); }while(g_xStatus.MC_STATE!=MC_STATE_STANDBY); if(s_lXtalFrequency<DOUBLE_XTAL_THR) @@ -228,6 +233,7 @@ } /* Goes in READY state */ + printf("test 9-5\n"); SpiritSpiCommandStrobes(COMMAND_READY); do{ /* Delay for state transition */ @@ -235,38 +241,47 @@ /* Reads the MC_STATUS register */ SpiritRefreshStatus(); + printf("test 9-5 g_xStatus.MC_STATE : [%d]\n", g_xStatus.MC_STATE); }while(g_xStatus.MC_STATE!=MC_STATE_READY); /* Calculates the FC_OFFSET parameter and cast as signed int: FOffsetTmp = (Fxtal/2^18)*FC_OFFSET */ + printf("test 9-6\n"); xtalOffsetFactor = (int16_t)(((float)FOffsetTmp*FBASE_DIVIDER)/s_lXtalFrequency); anaRadioRegArray[2] = (uint8_t)((((uint16_t)xtalOffsetFactor)>>8)&0x0F); anaRadioRegArray[3] = (uint8_t)(xtalOffsetFactor); /* Calculates the channel space factor */ + printf("test 9-7\n"); anaRadioRegArray[0] =((uint32_t)pxSRadioInitStruct->nChannelSpace<<9)/(s_lXtalFrequency>>6)+1; SpiritManagementWaTRxFcMem(pxSRadioInitStruct->lFrequencyBase); /* 2nd order DEM algorithm enabling */ + printf("test 9-8\n"); uint8_t tmpreg; SpiritSpiReadRegisters(0xA3, 1, &tmpreg); tmpreg &= ~0x02; SpiritSpiWriteRegisters(0xA3, 1, &tmpreg); /* Check the channel center frequency is in one of the possible range */ + printf("test 9-9\n"); s_assert_param(IS_FREQUENCY_BAND((pxSRadioInitStruct->lFrequencyBase + ((xtalOffsetFactor*s_lXtalFrequency)/FBASE_DIVIDER) + pxSRadioInitStruct->nChannelSpace * pxSRadioInitStruct->cChannelNumber))); /* Calculates the datarate mantissa and exponent */ + printf("test 9-10\n"); SpiritRadioSearchDatarateME(pxSRadioInitStruct->lDatarate, &drM, &drE); digRadioRegArray[0] = (uint8_t)(drM); digRadioRegArray[1] = (uint8_t)(0x00 | pxSRadioInitStruct->xModulationSelect |drE); /* Read the fdev register to preserve the clock recovery algo bit */ + printf("test 9-11\n"); SpiritSpiReadRegisters(0x1C, 1, &tmpreg); /* Calculates the frequency deviation mantissa and exponent */ + printf("test 9-12\n"); SpiritRadioSearchFreqDevME(pxSRadioInitStruct->lFreqDev, &FdevM, &FdevE); digRadioRegArray[2] = (uint8_t)((FdevE<<4) | (tmpreg&0x08) | FdevM); /* Calculates the channel filter mantissa and exponent */ + printf("test 9-13\n"); SpiritRadioSearchChannelBwME(pxSRadioInitStruct->lBandwidth, &bwM, &bwE); digRadioRegArray[3] = (uint8_t)((bwM<<4) | bwE); @@ -316,6 +331,7 @@ /* Sets Xtal configuration */ + printf("test 9-14\n"); if(s_lXtalFrequency>DOUBLE_XTAL_THR) { SpiritRadioSetXtalFlag(XTAL_FLAG((s_lXtalFrequency/2))); @@ -326,18 +342,23 @@ } /* Sets the channel number in the corresponding register */ + printf("test 9-15\n"); SpiritSpiWriteRegisters(CHNUM_BASE, 1, &pxSRadioInitStruct->cChannelNumber); /* Configures the Analog Radio registers */ + printf("test 9-16\n"); SpiritSpiWriteRegisters(CHSPACE_BASE, 4, anaRadioRegArray); /* Configures the Digital Radio registers */ + printf("test 9-17\n"); g_xStatus = SpiritSpiWriteRegisters(MOD1_BASE, 4, digRadioRegArray); /* Enable the freeze option of the AFC on the SYNC word */ + printf("test 9-18\n"); SpiritRadioAFCFreezeOnSync(S_ENABLE); /* Set the IQC correction optimal value */ + printf("test 9-19\n"); anaRadioRegArray[0]=0x80; anaRadioRegArray[1]=0xE3; g_xStatus = SpiritSpiWriteRegisters(0x99, 2, anaRadioRegArray); @@ -3034,12 +3055,32 @@ * @param void. * @retval None. */ + + SpiritFunctionalState SpiritRadioGetRefDiv(void) { uint8_t tempRegValue; g_xStatus = SpiritSpiReadRegisters(SYNTH_CONFIG1_BASE, 1, &tempRegValue); + //값을 읽어 왔을때, Reserved 영역의 니블 값이 1011 임. + int iMask = 1; + + printf("\n !!!!!!!!!!!\n"); + for (int i = 8; i > 0; --i) + { + //값 찍기 + printf("%d",(tempRegValue & (iMask << i-1))?1:0); + } + printf("\n !!!!!!!!!!!\n"); + + + + + + + + if(((tempRegValue>>7)&0x1)) { return S_ENABLE;