{
for (;;) {
uint8_t state = (ao_radio_strobe(CC1200_SIDLE) >> CC1200_STATUS_STATE) & CC1200_STATUS_STATE_MASK;
- if (state == CC1200_STATUS_STATE_IDLE) {
- ao_radio_strobe(CC1200_SFTX);
- ao_radio_strobe(CC1200_SFRX);
+ if (state == CC1200_STATUS_STATE_IDLE)
break;
- }
if (state == CC1200_STATUS_STATE_TX_FIFO_ERROR)
ao_radio_strobe(CC1200_SFTX);
if (state == CC1200_STATUS_STATE_RX_FIFO_ERROR)
ao_radio_strobe(CC1200_SFRX);
}
- /* Flush any pending TX bytes */
+ /* Flush any pending data in the fifos */
ao_radio_strobe(CC1200_SFTX);
+ ao_radio_strobe(CC1200_SFRX);
+ /* Make sure the RF calibration is current */
+ ao_radio_strobe(CC1200_SCAL);
}
/*
ao_radio_mode = 0;
+ ao_radio_idle();
+
ao_config_get();
ao_radio_configured = 1;
ao_radio_reg_write(CC1200_FREQ1, ao_config.radio_setting >> 8);
ao_radio_reg_write(CC1200_FREQ0, ao_config.radio_setting);
last_radio_setting = ao_config.radio_setting;
+ ao_radio_strobe(CC1200_SCAL);
}
if (ao_config.radio_rate != last_radio_rate) {
ao_radio_mode &= ~AO_RADIO_MODE_BITS_PACKET;
ao_radio_recv(__xdata void *d, uint8_t size, uint8_t timeout)
{
ao_radio_abort = 0;
- ao_radio_wake = 0;
+
ao_radio_get(size - 2);
- ao_radio_idle();
ao_radio_set_mode(AO_RADIO_MODE_PACKET_RX);
ao_radio_wake = 0;
ao_radio_start_rx();
CC1200_SYNC0, 0x91, /* Sync Word Configuration [7:0] */
CC1200_SYNC_CFG1, /* Sync Word Detection Configuration Reg. 1 */
((CC1200_SYNC_CFG1_SYNC_MODE_16_BITS << CC1200_SYNC_CFG1_SYNC_MODE) |
- (12 << CC1200_SYNC_CFG1_SYNC_THR)),
+ (11 << CC1200_SYNC_CFG1_SYNC_THR)),
CC1200_SYNC_CFG0, /* Sync Word Detection Configuration Reg. 0 */
((1 << CC1200_SYNC_CFG0_AUTO_CLEAR) |
(0 << CC1200_SYNC_CFG0_RX_CONFIG_LIMITATION) |
CC1200_PREAMBLE_CFG0, /* Preamble Detection Configuration Reg. 0 */
((1 << CC1200_PREAMBLE_CFG0_PQT_EN) |
(CC1200_PREAMBLE_CFG0_PQT_VALID_TIMEOUT_11 << CC1200_PREAMBLE_CFG0_PQT_VALID_TIMEOUT) |
- (12 << CC1200_PREAMBLE_CFG0_PQT)),
+ (6 << CC1200_PREAMBLE_CFG0_PQT)),
CC1200_IQIC, 0xcb, /* Digital Image Channel Compensation Configuration */
CC1200_CHAN_BW, 0x11, /* Channel Filter Configuration */
CC1200_MDMCFG1, 0x40, /* General Modem Parameter Configuration Reg. 1 */
CC1200_AGC_CFG0, 0x87, /* Automatic Gain Control Configuration Reg. 0 */
CC1200_FIFO_CFG, 0x40, /* FIFO Configuration */
CC1200_SETTLING_CFG, /* Frequency Synthesizer Calibration and Settling Configuration */
- ((CC1200_SETTLING_CFG_FS_AUTOCAL_IDLE_TO_ON << CC1200_SETTLING_CFG_FS_AUTOCAL) |
+ ((CC1200_SETTLING_CFG_FS_AUTOCAL_EVERY_4TH_TIME << CC1200_SETTLING_CFG_FS_AUTOCAL) |
(CC1200_SETTLING_CFG_LOCK_TIME_75_30 << CC1200_SETTLING_CFG_LOCK_TIME) |
(CC1200_SETTLING_CFG_FSREG_TIME_60 << CC1200_SETTLING_CFG_FSREG_TIME)),
CC1200_FS_CFG, /* Frequency Synthesizer Configuration */