📄 rfcalib.lst
字号:
C51 COMPILER V7.06 RFCALIB 04/13/2005 12:55:51 PAGE 1
C51 COMPILER V7.06, COMPILATION OF MODULE RFCALIB
OBJECT MODULE PLACED IN RFCalib.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE RFCalib.c OMF2 BROWSE INCDIR(..\..\..\..\Include;..\..\..\..\lib) DEFINE(FR
-EQ433) DEBUG
stmt level source
1 /*****************************************************************************
2 * *
3 * ********** *
4 * ************ *
5 * *** *** *
6 * *** +++ *** *
7 * *** + + *** *
8 * *** + CHIPCON CC1010 *
9 * *** + + *** HAL - RFCalib *
10 * *** +++ *** *
11 * *** *** *
12 * *********** *
13 * ********* *
14 * *
15 *****************************************************************************
16 * *
17 *****************************************************************************
18 * Author: ROH *
19 *****************************************************************************
20 * Revision history: *
21 * *
22 * $Log: RFCalib.c,v $
23 * Revision 1.1 2002/10/14 13:04:33 tos
24 * Initial version in CVS.
25 *
26 * *
27 ****************************************************************************/
28
29 #include <chipcon/hal.h>
30
31
32 // Variables that are used to override baudrate and PA output power
33 byte xdata hal_dataformat_override,
34 hal_baudrate_override,
35 hal_pa_pow_override,
36 hal_modem0_original,
37 hal_pa_pow_original;
38
39 //----------------------------------------------------------------------------
40 // void halRFCalib(...)
41 //
42 // Description:
43 // Performs the necessary RF-calibration for an RX/TX channel pair with
44 // the settings specified by the RF_RXTXPAIR_SETTINGS data structure
45 // pointed to by _rf_settings_. The results of the calibration are stored
46 // in the RF_RXTXPAIR_CALDATA data structure pointed to by _rf_caldata_.
47 // Call this function once for each RX/TX channel pair that will be used
48 // by the program before they are used and whenever the supply voltage or
49 // temperature has changed significantly.
50 // The application Chipcon SmartRF Studio should be used to generate this
51 // data structure.
52 //
53 // Arguments:
54 // RF_RXTXPAIR_SETTINGS* rf_settings
C51 COMPILER V7.06 RFCALIB 04/13/2005 12:55:51 PAGE 2
55 // Pointer to a RF_RXTXPAIR_SETTINGS data structure containing the
56 // settings for an RX/TX channel pair (exported from SmartRF Studio.)
57 // RF_RXTXPAIR_CALDATA xdata* rf_caldata
58 // A pointer to a RF_RXTXPAIR_CALDATA data structure which will be
59 // filled with the results from the calibration.
60 //
61 // Return value:
62 // void
63 //----------------------------------------------------------------------------
64 void halRFCalib(RF_RXTXPAIR_SETTINGS code* rf_settings, RF_RXTXPAIR_CALDATA xdata* rf_caldata) {
65 1 // Write required registers for calibration
66 1 FREQ_2A=rf_settings->freq_2a;
67 1 FREQ_1A=rf_settings->freq_1a;
68 1 FREQ_0A=rf_settings->freq_0a;
69 1 FREQ_2B=rf_settings->freq_2b;
70 1 FREQ_1B=rf_settings->freq_1b;
71 1 FREQ_0B=rf_settings->freq_0b;
72 1 PLL=rf_settings->pll_rx;
73 1 CAL=0x26; // CAL_DUAL=0, CAL_WAIT=1, CAL_CURRENT=0
74 1 TEST5=0x00; // Zero previous calibration results,
75 1 TEST6=0x00; // so that override is no longer in effect
76 1
77 1 // Turn on frequency synthesiser and RX chain, set VCO current
78 1 //RFMAIN=0x10; // RXTX=RX, F_REG=A, RX_PD=0, FS_PD=0
79 1 F_REG=0;
80 1 FS_PD=0;
81 1 CURRENT=rf_settings->current_rx;
82 1
83 1 // Start RX calibration, wait for completion
84 1 CAL |= 0x80; // Start calibration
85 1 while (!(CAL&0x08)); // Wait until finished (max 34 ms)
86 1 CAL &= ~0x80; // Stop calibration
87 1
88 1 // Save RX calibration results
89 1 rf_caldata->vco_ao_rx=TEST0;
90 1 rf_caldata->chp_co_rx=TEST2;
91 1
92 1 // Setup for TX calibration
93 1 //RFMAIN=0xE0; // RXTX=TX, F_REG=B, TX_PD=0, FS_PD=0
94 1 PLL=rf_settings->pll_tx;
95 1 F_REG=1;
96 1 CURRENT=rf_settings->current_tx;
97 1 PA_POW=0x00; // Turn off PA to avoid spurious emmisions
98 1 TEST6=0x3B; // In TX, always use chp_current = 0x1B
99 1
100 1 // Start TX calibration, wait for completion
101 1 CAL |= 0x80; // Start calibration
102 1 while (!(CAL&0x08)); // Wait until finished (max 28 ms)
103 1 CAL &= ~0x80; // Stop calibration
104 1
105 1 // Save TX calibration results
106 1 rf_caldata->vco_ao_tx=TEST0;
107 1
108 1 // Turn off all RF
109 1 RFMAIN=0x38; // RX, TX, FS powered down
110 1
111 1 // Make sure the override variables are properly initialized
112 1 hal_dataformat_override=0;
113 1 hal_baudrate_override=0;
114 1 hal_pa_pow_override=0;
115 1 hal_modem0_original=0;
116 1 hal_pa_pow_original=0;
C51 COMPILER V7.06 RFCALIB 04/13/2005 12:55:51 PAGE 3
117 1 }
118
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 177 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 5 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
EDATA SIZE = ---- ----
HDATA SIZE = ---- ----
XDATA CONST SIZE = ---- ----
FAR CONST SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -