diff --git a/drivers/cc2420/cc2420.c b/drivers/cc2420/cc2420.c index 69df2cfa5273e864f88bad884826bd581828f97e..6fe3e764d8f6ce049942c3097276c97fcbc96c1f 100644 --- a/drivers/cc2420/cc2420.c +++ b/drivers/cc2420/cc2420.c @@ -158,6 +158,15 @@ void cc2420_tx_exec(cc2420_t *dev) } } +static inline void _flush_rx_fifo(cc2420_t *dev) +{ + /* as stated in the CC2420 datasheet (section 14.3), the SFLUSHRX command + * strobe should be issued twice to ensure that the SFD pin goes back to its + * idle state */ + cc2420_strobe(dev, CC2420_STROBE_FLUSHRX); + cc2420_strobe(dev, CC2420_STROBE_FLUSHRX); +} + int cc2420_rx(cc2420_t *dev, uint8_t *buf, size_t max_len, void *info) { (void)info; @@ -202,8 +211,7 @@ int cc2420_rx(cc2420_t *dev, uint8_t *buf, size_t max_len, void *info) } /* finally flush the FIFO */ - cc2420_strobe(dev, CC2420_STROBE_FLUSHRX); - cc2420_strobe(dev, CC2420_STROBE_FLUSHRX); + _flush_rx_fifo(dev); } return (int)len;