diff options
author | Keith Packard <keithp@keithp.com> | 2013-01-10 21:27:32 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-01-10 21:44:18 -0800 |
commit | acff2f466031fd1a8533fc315411c3734a8bacc6 (patch) | |
tree | 422038f3380f0f7e7cdb1febd7afbe9fc60c7b8a | |
parent | f715b5da3424adacc5a7f1e001e1dd7fa6f50385 (diff) |
altos: Time out reading packet data from cc1120 after 100ms
Sometimes the radio will give a spurious wakeup indicating that a
preamble seems to have arrived, but no packet data will appear. In
this case, abandon the packet reception and go back to waiting for a
preamble again. This releases the SPI bus for other users and also
avoids missing packets.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/drivers/ao_cc1120.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c index 63d2f955..35be54a4 100644 --- a/src/drivers/ao_cc1120.c +++ b/src/drivers/ao_cc1120.c @@ -862,6 +862,7 @@ ao_radio_rx_wait(void) do { if (ao_radio_mcu_wake) ao_radio_check_marc_status(); + ao_alarm(AO_MS_TO_TICKS(100)); ao_arch_block_interrupts(); rx_waiting = 1; while (rx_data_cur - rx_data_consumed < AO_FEC_DECODE_BLOCK && @@ -873,6 +874,7 @@ ao_radio_rx_wait(void) } rx_waiting = 0; ao_arch_release_interrupts(); + ao_clear_alarm(); } while (ao_radio_mcu_wake); if (ao_radio_abort) return 0; |