From 5636357243e6bc96fcd470473f14387a10e9a6ea Mon Sep 17 00:00:00 2001 From: Ivan Delamer Date: Sat, 1 Sep 2012 15:20:00 -0600 Subject: [PATCH] Fix RF230 transition: RX_AACK_ON -> TX_ARET_ON (go through PLL_ON, as per datasheet). Tested on RF230 and 128RFA1 (RF231). --- cpu/avr/radio/rf230bb/rf230bb.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/cpu/avr/radio/rf230bb/rf230bb.c b/cpu/avr/radio/rf230bb/rf230bb.c index 477c561fe..cc3eb4db4 100644 --- a/cpu/avr/radio/rf230bb/rf230bb.c +++ b/cpu/avr/radio/rf230bb/rf230bb.c @@ -443,19 +443,15 @@ radio_set_trx_state(uint8_t new_state) radio_reset_state_machine(); /* Go to TRX_OFF from any state. */ } else { /* 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. */ - if ((new_state == TX_ARET_ON) && - (original_state == RX_AACK_ON)){ - /* First do intermediate state transition to PLL_ON, then to TX_ARET_ON. */ - /* The final state transition to TX_ARET_ON is handled after the if-else if. */ + /* TX_AACK_ON or RX_AACK_ON respectively. Need to go via PLL_ON. */ + /* (Old datasheets allowed other transitions, but this code complies with */ + /* the current specification for RF230, RF231 and 128RFA1.) */ + if (((new_state == TX_ARET_ON) && (original_state == RX_AACK_ON)) || + ((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); 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. */