PIR motions sensor to RFM69OOK hangs after first receive

Started by AxisRobotics, May 30, 2018, 04:47:28 PM

AxisRobotics

I've been at this for about a week so it's time to post. We're attempting to receive a signal from a 1byOne wireless PIR sensor with a Feather 32u RFM69HCW running the RFM69OOK lib. We have a logic analyzer on DIO2 and it starts off clean, grabs the transmission just fine from the PIR sensor, then it's stuck just receiving all kinds of noise and we can't get it back into receive mode. Obviously, poll() only fires once, then is stuck at 1 until we reset the MCU. It's almost like the RFM is in a "one shot" mode or something but we can't seem to configure this thing so that the poll() routine works as expected in the RFM69OOK lib. Any guidance or direction here would be appreciated.



const byte CONFIG[][2] =
  {
    /* 0x01 */ { REG_OPMODE, RF_OPMODE_SEQUENCER_OFF | RF_OPMODE_LISTEN_OFF | RF_OPMODE_STANDBY },
    /* 0x02 */ { REG_DATAMODUL, RF_DATAMODUL_DATAMODE_CONTINUOUSNOBSYNC | RF_DATAMODUL_MODULATIONTYPE_OOK | RF_DATAMODUL_MODULATIONSHAPING_00 }, // no shaping
    
    /* 0x03 */ //{ REG_BITRATEMSB, RF_BITRATEMSB_32768}, // bitrate: 32768 Hz (number of bits that can be transferred per second)
    /* 0x04 */ //{ REG_BITRATELSB, RF_BITRATELSB_32768},
    
    /* 0x05 */ //{ REG_FDEVMSB, RF_FDEVMSB_50000}, // default: 5KHz, (FDEV + BitRate / 2 <= 500KHz)
    /* 0x06 */ //{ REG_FDEVLSB, RF_FDEVLSB_50000},

    /* 0x0B */ //{ REG_AFCCTRL, 0x20}, //AfcCtrl, afclowbetaon
    /* 0x0D */ { REG_LISTEN1, 0xF4 },  //0x92 Listen mode settings
    /* 0x0E */ { REG_LISTEN2, 0x49 },  //Listen mode idle duration
    /* 0x0F */ { REG_LISTEN3, 0xAA },  //Listen mode Rx duration

    /* 0x19 */ //{ REG_RXBW, OOK_BW_250_0 | RF_RXBW_MANT_16 | RF_RXBW_EXP_0}, // BW: 250 kHz rx bandwidth (sample rate must be at least 2x the bandwidth)
    /* 0x1B */ { REG_OOKPEAK, RF_OOKPEAK_THRESHTYPE_PEAK | RF_OOKPEAK_PEAKTHRESHSTEP_000 | RF_OOKPEAK_PEAKTHRESHDEC_000 },
    /* 0x1C */ { REG_OOKAVG, 0x00},
    /* 0x1D */ { REG_OOKFIX, 7 }, // Fixed threshold value (in dB) in the OOK demodulator, used when OokThreshType = 00
    /* 0x1E */ { REG_AFCFEI, 0x00}, //No auto AFC
    /* 0x2A */ { REG_RXTIMEOUT1, 0x00}, //disable rx timeout if nothing received
    /* 0x25 */ { REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_10 }, // for mapping DIO0 thru DIO3 - route RSSI to DIO0
    /* 0x26 */ { REG_DIOMAPPING2, RF_DIOMAPPING2_DIO5_01 }, // for mapping DIO4 thru DIO5
    /* 0x2E */ { REG_SYNCCONFIG, RF_SYNC_OFF }, // | RF_SYNC_FIFOFILL_AUTO | RF_SYNC_SIZE_2 | RF_SYNC_TOL_0 },

    /* 0x28 */ //{ REG_IRQFLAGS2, RF_IRQFLAGS2_FIFOOVERRUN }, // Writing to this bit ensures the FIFO & status flags are reset
    /* 0x29 */ { REG_RSSITHRESH, 0x64 }, //A6, B4 must be set to dBm = (-Sensitivity / 2) - default is 0xE4=228 so -114dBm
    /* 0x6F */ { REG_TESTDAGC, RF_DAGC_IMPROVED_LOWBETA0 }, // run DAGC continuously in RX mode, recommended default for AfcLowBetaOn=0
    /* 0x58 */ //{ REG_TESTLNA, 0x2D },   // == SENSITIVITY_BOOST_HIGH
    {255, 0}
  };

TomWS

This probably won't be much help as I only use the RFM69OOK library for TX, not RX.  But, looking at my code, I'm reminded that DIO2 needed to be wired to two pins, the standard IRQ 1 (pin 2 on 328P), and another pin (I use D3) for data.  I don't remember why this was, but it works  ;)

Tom

AxisRobotics

Thanks Tom. I think I found the answer here:
https://lowpowerlab.com/forum/rf-range-antennas-rfm69-library/real-time-rssi-measurement-broken-rfm69cw/30/

It appears that we're seeing this same issue almost exactly as described with the RSSI bouncing all over and never settling until tx is reset.

Dave