主题中讨论的其他器件:CC1020、
大家好、TI 社区、
我将向您介绍我开发与 CC1020射频模块兼容的 CC1120射频模块的项目。
下面是简要概述:
主要目的是取代我们在 CC1020上工作的旧品牌:
MCU -[CC1020] <--- 空气---- >[CC1020]- MCU
对于基于 CC1120但软件兼容的新产品(MCU 中的软件无法更改):
MCU -[MCUb-CC1120]<--空气---- >[CC1120-MCUb]- MCU
在我之前的帖子(大约2个月前 、CC1120EMK-420-470:CC1120 -同步模式- SMARTRXEBK)中、我询问了一些有关硬件配置的帮助。
我发现它不起作用的原因、它是一个石英偏差。 我必须重新编程新频率以补偿偏差。
这一次、我需要您有关"功能"的帮助。 CC1120编程为同步串行模式、没有同步/前导码检测/生成功能、因此我的时钟始终运行。
我有一个主发送器和一个主接收器。 我们有两种通信类型(对于我的测试,发送器每隔100ms 发送一次消息):
1路: 发射器-->接收器
-2路: -->
发送 器接收器(在每次有效接收后发送响应)
<--
接收器侧有一个 LED、可在收到的每个有效消息中改变状态。
使用"1向模式"时、LED 每隔100ms 更改一次状态(表示 无数据丢失)
使用"2路模式"时、LED 会改变状态、但不稳定(表示数据丢失)
我的问题是:
——频带 RX 和 TX 是否足以正确切换到各自的模式? 我是否需要对其他寄存器重新编程?
您将在随附的配置代码和我的主(简化)程序中找到。
如果您需要补充信息、请不要犹豫。
此致
查尔斯
/*************************************************************** * SmartRF Studio(tm) Export * * Radio register settings specifed with C-code * compatible #define statements. * * RF device: CC1120 * ***************************************************************/ #ifndef SMARTRF_CC1120_H #define SMARTRF_CC1120_H #define SMARTRF_RADIO_CC1120 #define SMARTRF_SETTING_IOCFG3 0xB0 #define SMARTRF_SETTING_IOCFG2 0x08 #define SMARTRF_SETTING_IOCFG1 0xB0 #define SMARTRF_SETTING_IOCFG0 0x09 #define SMARTRF_SETTING_SYNC3 0xAA #define SMARTRF_SETTING_SYNC2 0xAA//0xD3 /**///TX #define SMARTRF_SETTING_SYNC1 0xAA//0x91 /**/// #define SMARTRF_SETTING_SYNC0 0xAA//0xDA /**/// #define SMARTRF_SETTING_SYNC_CFG1 0x1F//0x0B /**/// #define SMARTRF_SETTING_SYNC_CFG0 0x03 #define SMARTRF_SETTING_DEVIATION_M 0x7F//0xA0 #define SMARTRF_SETTING_MODCFG_DEV_E 0x03//0x04 #define SMARTRF_SETTING_DCFILT_CFG 0x1C #define SMARTRF_SETTING_PREAMBLE_CFG1 0x00 #define SMARTRF_SETTING_PREAMBLE_CFG0 0x2A #define SMARTRF_SETTING_FREQ_IF_CFG 0x40 #define SMARTRF_SETTING_IQIC 0xC6 #define SMARTRF_SETTING_CHAN_BW 0x08 #define SMARTRF_SETTING_MDMCFG1 0x06 #define SMARTRF_SETTING_MDMCFG0 0x0A//0x05 /**/// 05 TX #define SMARTRF_SETTING_SYMBOL_RATE2 0x73 #define SMARTRF_SETTING_SYMBOL_RATE1 0xA9 #define SMARTRF_SETTING_SYMBOL_RATE0 0x2A #define SMARTRF_SETTING_AGC_REF 0x20 #define SMARTRF_SETTING_AGC_CS_THR 0x19 #define SMARTRF_SETTING_AGC_GAIN_ADJUST 0x00 #define SMARTRF_SETTING_AGC_CFG3 0x91 #define SMARTRF_SETTING_AGC_CFG2 0x20 #define SMARTRF_SETTING_AGC_CFG1 0x0A//0xAA /**/// AA in TX Freeze both AGC and RSSi update #define SMARTRF_SETTING_AGC_CFG0 0xCF #define SMARTRF_SETTING_FIFO_CFG 0x00 #define SMARTRF_SETTING_DEV_ADDR 0x00 #define SMARTRF_SETTING_SETTLING_CFG 0x03 #define SMARTRF_SETTING_FS_CFG 0x14 #define SMARTRF_SETTING_WOR_CFG1 0x08 #define SMARTRF_SETTING_WOR_CFG0 0x21 #define SMARTRF_SETTING_WOR_EVENT0_MSB 0x00 #define SMARTRF_SETTING_WOR_EVENT0_LSB 0x00 #define SMARTRF_SETTING_PKT_CFG2 0x01 #define SMARTRF_SETTING_PKT_CFG1 0x00 #define SMARTRF_SETTING_PKT_CFG0 0x20 #define SMARTRF_SETTING_RFEND_CFG1 0x0F #define SMARTRF_SETTING_RFEND_CFG0 0x00 #define SMARTRF_SETTING_PA_CFG2 0x7F #define SMARTRF_SETTING_PA_CFG1 0x56 #define SMARTRF_SETTING_PA_CFG0 0x7D #define SMARTRF_SETTING_PKT_LEN 0x03 #define SMARTRF_SETTING_IF_MIX_CFG 0x00 #define SMARTRF_SETTING_FREQOFF_CFG 0x22 #define SMARTRF_SETTING_TOC_CFG 0x0B #define SMARTRF_SETTING_MARC_SPARE 0x00 #define SMARTRF_SETTING_ECG_CFG 0x00 #define SMARTRF_SETTING_CFM_DATA_CFG 0x00 #define SMARTRF_SETTING_EXT_CTRL 0x01 #define SMARTRF_SETTING_RCCAL_FINE 0x00 #define SMARTRF_SETTING_RCCAL_COARSE 0x00 #define SMARTRF_SETTING_RCCAL_OFFSET 0x00 #define SMARTRF_SETTING_FREQOFF1 0x00 #define SMARTRF_SETTING_FREQOFF0 0x00 #define SMARTRF_SETTING_FREQ2 0x6C #define SMARTRF_SETTING_FREQ1 0xAA//0xAB//0x46 #define SMARTRF_SETTING_FREQ0 0xB0//0x33//0x66 #define SMARTRF_SETTING_IF_ADC2 0x02 #define SMARTRF_SETTING_IF_ADC1 0xA6 #define SMARTRF_SETTING_IF_ADC0 0x04 #define SMARTRF_SETTING_FS_DIG1 0x00 #define SMARTRF_SETTING_FS_DIG0 0x5F #define SMARTRF_SETTING_FS_CAL3 0x00 #define SMARTRF_SETTING_FS_CAL2 0x20 #define SMARTRF_SETTING_FS_CAL1 0x40 #define SMARTRF_SETTING_FS_CAL0 0x0E #define SMARTRF_SETTING_FS_CHP 0x28 #define SMARTRF_SETTING_FS_DIVTWO 0x03 #define SMARTRF_SETTING_FS_DSM1 0x00 #define SMARTRF_SETTING_FS_DSM0 0x33 #define SMARTRF_SETTING_FS_DVC1 0xFF #define SMARTRF_SETTING_FS_DVC0 0x17 #define SMARTRF_SETTING_FS_LBI 0x00 #define SMARTRF_SETTING_FS_PFD 0x50 #define SMARTRF_SETTING_FS_PRE 0x6E #define SMARTRF_SETTING_FS_REG_DIV_CML 0x14 #define SMARTRF_SETTING_FS_SPARE 0xAC #define SMARTRF_SETTING_FS_VCO4 0x14 #define SMARTRF_SETTING_FS_VCO3 0x00 #define SMARTRF_SETTING_FS_VCO2 0x00 #define SMARTRF_SETTING_FS_VCO1 0x00 #define SMARTRF_SETTING_FS_VCO0 0xB4 #define SMARTRF_SETTING_GBIAS6 0x00 #define SMARTRF_SETTING_GBIAS5 0x02 #define SMARTRF_SETTING_GBIAS4 0x00 #define SMARTRF_SETTING_GBIAS3 0x00 #define SMARTRF_SETTING_GBIAS2 0x10 #define SMARTRF_SETTING_GBIAS1 0x00 #define SMARTRF_SETTING_GBIAS0 0x00 #define SMARTRF_SETTING_IFAMP 0x01 #define SMARTRF_SETTING_LNA 0x01 #define SMARTRF_SETTING_RXMIX 0x01 #define SMARTRF_SETTING_XOSC5 0x0E #define SMARTRF_SETTING_XOSC4 0xA0 #define SMARTRF_SETTING_XOSC3 0x03 #define SMARTRF_SETTING_XOSC2 0x04 #define SMARTRF_SETTING_XOSC1 0x03 #define SMARTRF_SETTING_XOSC0 0x00 #define SMARTRF_SETTING_ANALOG_SPARE 0x00 #define SMARTRF_SETTING_PA_CFG3 0x00 #define SMARTRF_SETTING_WOR_TIME1 0x00 #define SMARTRF_SETTING_WOR_TIME0 0x00 #define SMARTRF_SETTING_WOR_CAPTURE1 0x00 #define SMARTRF_SETTING_WOR_CAPTURE0 0x00 #define SMARTRF_SETTING_BIST 0x00 #define SMARTRF_SETTING_DCFILTOFFSET_I1 0x00 #define SMARTRF_SETTING_DCFILTOFFSET_I0 0x00 #define SMARTRF_SETTING_DCFILTOFFSET_Q1 0x00 #define SMARTRF_SETTING_DCFILTOFFSET_Q0 0x00 #define SMARTRF_SETTING_IQIE_I1 0x00 #define SMARTRF_SETTING_IQIE_I0 0x00 #define SMARTRF_SETTING_IQIE_Q1 0x00 #define SMARTRF_SETTING_IQIE_Q0 0x00 #define SMARTRF_SETTING_RSSI1 0x80 #define SMARTRF_SETTING_RSSI0 0x00 #define SMARTRF_SETTING_MARCSTATE 0x41 #define SMARTRF_SETTING_LQI_VAL 0x00 #define SMARTRF_SETTING_PQT_SYNC_ERR 0xFF #define SMARTRF_SETTING_DEM_STATUS 0x00 #define SMARTRF_SETTING_FREQOFF_EST1 0x00 #define SMARTRF_SETTING_FREQOFF_EST0 0x00 #define SMARTRF_SETTING_AGC_GAIN3 0x00 #define SMARTRF_SETTING_AGC_GAIN2 0xD1 #define SMARTRF_SETTING_AGC_GAIN1 0x00 #define SMARTRF_SETTING_AGC_GAIN0 0x3F #define SMARTRF_SETTING_CFM_RX_DATA_OUT 0x00 #define SMARTRF_SETTING_CFM_TX_DATA_IN 0x00 #define SMARTRF_SETTING_ASK_SOFT_RX_DATA 0x30 #define SMARTRF_SETTING_RNDGEN 0x7F #define SMARTRF_SETTING_MAGN2 0x00 #define SMARTRF_SETTING_MAGN1 0x00 #define SMARTRF_SETTING_MAGN0 0x00 #define SMARTRF_SETTING_ANG1 0x00 #define SMARTRF_SETTING_ANG0 0x00 #define SMARTRF_SETTING_CHFILT_I2 0x08 #define SMARTRF_SETTING_CHFILT_I1 0x00 #define SMARTRF_SETTING_CHFILT_I0 0x00 #define SMARTRF_SETTING_CHFILT_Q2 0x00 #define SMARTRF_SETTING_CHFILT_Q1 0x00 #define SMARTRF_SETTING_CHFILT_Q0 0x00 #define SMARTRF_SETTING_GPIO_STATUS 0x00 #define SMARTRF_SETTING_FSCAL_CTRL 0x01 #define SMARTRF_SETTING_PHASE_ADJUST 0x00 #define SMARTRF_SETTING_PARTNUMBER 0x48 #define SMARTRF_SETTING_PARTVERSION 0x21 #define SMARTRF_SETTING_SERIAL_STATUS 0x08 #define SMARTRF_SETTING_MODEM_STATUS1 0x10 #define SMARTRF_SETTING_MODEM_STATUS0 0x00 #define SMARTRF_SETTING_MARC_STATUS1 0x00 #define SMARTRF_SETTING_MARC_STATUS0 0x00 #define SMARTRF_SETTING_PA_IFAMP_TEST 0x00 #define SMARTRF_SETTING_FSRF_TEST 0x00 #define SMARTRF_SETTING_PRE_TEST 0x00 #define SMARTRF_SETTING_PRE_OVR 0x00 #define SMARTRF_SETTING_ADC_TEST 0x00 #define SMARTRF_SETTING_DVC_TEST 0x0B #define SMARTRF_SETTING_ATEST 0x40 #define SMARTRF_SETTING_ATEST_LVDS 0x00 #define SMARTRF_SETTING_ATEST_MODE 0x00 #define SMARTRF_SETTING_XOSC_TEST1 0x3C #define SMARTRF_SETTING_XOSC_TEST0 0x00 #define SMARTRF_SETTING_RXFIRST 0x00 #define SMARTRF_SETTING_TXFIRST 0x00 #define SMARTRF_SETTING_RXLAST 0x00 #define SMARTRF_SETTING_TXLAST 0x00 #define SMARTRF_SETTING_NUM_TXBYTES 0x00 #define SMARTRF_SETTING_NUM_RXBYTES 0x00 #define SMARTRF_SETTING_FIFO_NUM_TXBYTES 0x0F #define SMARTRF_SETTING_FIFO_NUM_RXBYTES 0x00 #endif
while(1){ if(End_Send){ /* response sent */ End_Send=0; switch(Config[HF_MODE]){ case 0x00:{ /*1way*/ //ret_fct = (unsigned char)(SetupCC1020RX(HF[0x17],0x00U)); /*CC1020*/ Write_StrobeRegister(CC112X_SRX); /*CC1120*/ What_Do_Hf=Receive_Mode; /*receive in interrupt*/ EX0=1; /*enable interrupt for receiving*/ break; } case 0x01:{ /*2way*/ What_Do_Hf=Receive_Mode; /*receive in interrupt*/ //ret_fct = (unsigned char)(SetupCC1020RX(HF[0x17],0x00U)); /*CC1020*/ Write_StrobeRegister(CC112X_SRX); /*CC1120*/ EX0=1; /*enable interrupt for receiving*/ break; } default:{ /*do nothing*/ break; } } } if(End_Receive){ /*Message received*/ End_Receive=0; EX0=0; switch(Config[HF_MODE]){ case 0x00:{ /*1way*/ What_Do_Hf=Receive_Mode; /*receive in interrupt*/ Write_StrobeRegister(CC112X_SRX); /*CC1120*/ EX0=1; /*enable interrupt for receiving*/ break; } case 0x01:{ /*2way*/ /* coding response */ What_Do_Hf=Transmit_Mode; /*transmit in interrupt*/ //ret_fct = (unsigned char)(SetupCC1020TX(HF[0x17],0xFFU)); /*CC1020*/ Write_StrobeRegister(CC112X_STX); /*CC1120*/ pos_bit=0U; EX0=1; /*enable interrupt for transmitting*/ break; } default:{ /*do nothing*/ break; } } } if(MESS_READY){ /*correct address received*/ for(i=0U;i!=NBRE_BYTE_IN;i++){ /*copy dans variable de travail*/ data_all[i]=data_in_tmp[i]; data_in_tmp[i]=0xF0U; } MESS_READY=0U; /*clear flag*/ if((crc_tmp==0x00U)&&(count_start==count_start_mini)){ /*CRC ok*/ /* decoding message */ LED^=1; for(i=0U;i!=NBRE_BYTE_IN;i++){ /*reset variable travail*/ data_all[i]=0xFBU; } } } }