I observed two issues with automatic frequency correction (AFC) and OOK reception:
- The AFC value does not get cleared by switching to sleep mode and back to receive
- AFC in continuous OOK mode can yield extreme values, setting the receiver totally off-band.
AFC should not be used in continuous OOK receive mode. I am not sure whether it is designed to work in this mode (I doubt it). When signal is detected by a high RSSI, an controlled AFC may very well be to late for the OOK pulse. But even not enabling AFC in OOK imposses a risk.
When switching between FSK-packet mode for communication with the sensor network, and receiving external OOK signals, the AFC does not get resetted to zero. It can only be done by a HW-reset or power cycle, Or by explicitely clearing the AFC Value:
template< typename SPI > void RF69A<SPI>::setThd (uint8_t thd) { this->writeReg(REG_AFCFEI, (1<<1)); this->setMode(MODE_SLEEP); this->writeReg(REG_OOKFIX, thd); chThdSleepMilliseconds(400); this->setMode(MODE_RECEIVE); }