Fix RF230 transition: RX_AACK_ON -> TX_ARET_ON (go through PLL_ON,

as per datasheet). Tested on RF230 and 128RFA1 (RF231).
This commit is contained in:
Ivan Delamer 2012-09-01 15:20:00 -06:00
parent 1bb055bae6
commit 5636357243

View file

@ -443,19 +443,15 @@ radio_set_trx_state(uint8_t new_state)
radio_reset_state_machine(); /* Go to TRX_OFF from any state. */ radio_reset_state_machine(); /* Go to TRX_OFF from any state. */
} else { } else {
/* It is not allowed to go from RX_AACK_ON or TX_AACK_ON and directly to */ /* It is not allowed to go from RX_AACK_ON or TX_AACK_ON and directly to */
/* TX_AACK_ON or RX_AACK_ON respectively. Need to go via RX_ON or PLL_ON. */ /* TX_AACK_ON or RX_AACK_ON respectively. Need to go via PLL_ON. */
if ((new_state == TX_ARET_ON) && /* (Old datasheets allowed other transitions, but this code complies with */
(original_state == RX_AACK_ON)){ /* the current specification for RF230, RF231 and 128RFA1.) */
/* First do intermediate state transition to PLL_ON, then to TX_ARET_ON. */ if (((new_state == TX_ARET_ON) && (original_state == RX_AACK_ON)) ||
/* The final state transition to TX_ARET_ON is handled after the if-else if. */ ((new_state == RX_AACK_ON) && (original_state == TX_ARET_ON))){
/* First do intermediate state transition to PLL_ON. */
/* The final state transition is handled after the if-else if. */
hal_subregister_write(SR_TRX_CMD, PLL_ON); hal_subregister_write(SR_TRX_CMD, PLL_ON);
delay_us(TIME_STATE_TRANSITION_PLL_ACTIVE); delay_us(TIME_STATE_TRANSITION_PLL_ACTIVE);
} else if ((new_state == RX_AACK_ON) &&
(original_state == TX_ARET_ON)){
/* First do intermediate state transition to RX_ON, then to RX_AACK_ON. */
/* The final state transition to RX_AACK_ON is handled after the if-else if. */
hal_subregister_write(SR_TRX_CMD, RX_ON);
delay_us(TIME_STATE_TRANSITION_PLL_ACTIVE);
} }
/* Any other state transition can be done directly. */ /* Any other state transition can be done directly. */