Real time RSSI measurement broken RFM69CW?

Started by perky, December 12, 2015, 05:49:59 AM

WhiteHare

1.  I tried out 10K pull down resistors again.  No effect.  The previous trial of pull down resistors should be thrown out, because of the break that had occured between DIO0 and D2.
2.  As discussed above, I tried mapping DIO4 to RxReady and wiring to D3, hoping to circumvent the issues surrounding RSSI.  Nope.  Same issues.

perky

Did you try going into sleep mode rather than standby before rx mode? (idle mode is mapped to standby in the Radiohead libraries. It can be mapped to sleep mode instead). I saw a real difference with this.

Mark.

WhiteHare

By sleep mode do you mean listen-mode (i.e. the rfm69 sleeps, but uses its clock to wake itself up at regular intervals)?  The reason I ask is that if it were just sleep mode, I'm not sure how it would ever wake up, as the atmega would be sleeping too.

I experimented a bit more with pulldown resistors.  It turns out 27 ohms still isn't low enough, whereas 22 ohms is already too low.  So, I don't think a pulldown resistor is going to solve it.

perky

No, I mean when the radio is put into RX mode from either standby or sleep, this is supposed to 'reset' the logic but I saw a difference when going from standby to rx to when going from sleep to rx. This might not be relevant to what you're doing though.

I hope you don't mean 22 ohms, that'll take 150mA at 3.3V! The sx1231h can supply +/-1mA from it's pin (up to close to the rails), the resistance has to be 3k3 or greater.
Mark.

WhiteHare

If there were an emoticon for face-palm, I'd be inserting it here. ::) 

It just dawned on me that during full power down the clock is turned off, so there's no way to check elapsed time.  So, it's quite likely the atmega328p actually did go into full powerdown, and it only appeared that it didn't because the clock counter was suspended while it slept.   Of course, with benefit of hindsight, it becomes completely obvious.  Just not obvious when I was in the thick of it.

I'll check it  out, but very likely that's a factor, if not the entire explanation. 

WhiteHare

#95
OK, I checked it out more thoroughly this time by using the scope by adjusting the code to set a pin HIGH when SleepNow() was invoked and LOW after it woke up.

Bottom line:  It *was* getting prematurely woken up by the PllLock pulse (see previous o-scope pictures above).  However, the workaround really does work: just wait until after PllLock goes HIGH, and then sleep in deep powerdown mode.  After doing that, nothing else woke it up prematurely.  The scope shows that after RSSI goes HIGH, the atmega wakes up 2.1ms later and records the RSSI values at that time. 

My initial impression is that it does look as though there may be some reduction in average noise by capturing RSSI while the moteino is asleep, and fortunately it's very easy to do.  So, as a practical matter, if listening to very faint signals, it may be worthwhile to put the atmega into deep powerdown sleep while leaving the RFM69 in Rx mode.  However, it would probably only matter at the margin, for signals that are very near the noise floor.

joelucid

QuoteIt *was* getting prematurely woken up by the PllLock

This is normal - the 11 DIO mapping gives you RSSI during RX and Plllock during FS which is an intermediate state before the sequencer switches to RX.

WhiteHare

Quote from: joelucid on February 18, 2016, 09:13:37 AM
QuoteIt *was* getting prematurely woken up by the PllLock

This is normal - the 11 DIO mapping gives you RSSI during RX and Plllock during FS which is an intermediate state before the sequencer switches to RX.

Interesting.  That sharpens my understanding of how it all really works.

Hence, it should be more efficient to shift into FS mode rather than Standby mode before shifting back into Rx mode.  Then one wouldn't need to spin wheels waiting for PllLock to go high before sleeping.

WhiteHare

For a moteino with the antenna solder tacked to ground, with voltage regulator removed, and connected to a computer via Felix's FTDI connector, the average RSSI (averaged over 1,000 samples) measured while the Moteino slept is -124:

http://pastebin.com/cxjdN9S3

emjay

@WhiteHare,

Interesting results - the spread (127 <-> 118) would imply that there is still EMI injected from direct coupling to the ANT pin components. This suggests a tricky balance for setting the RSSI threshold low enough to see weak real signals versus excessive triggering from the general noise floor.
LoRa sort of side steps this by an elaborate Rx signal present detection method, at the expense of keeping the Rx section active for relatively long periods.

perky

@WhiteHare: Good work. Do you have any results when the MCU is not asleep but actively doing something, like continually polling the SPI registers?

WhiteHare

Quote from: perky on February 19, 2016, 11:16:44 AM
@WhiteHare: Good work. Do you have any results when the MCU is not asleep but actively doing something, like continually polling the SPI registers?

That's a worthwhile question, and so I just now ran that test.  Here are the results:  http://pastebin.com/VAbX37nk

In this particular case, the average RSSI (the average of a thousand measurements) with the atmega awake (specifically, polling in a tight loop for the RSSI flag to go HIGH) was -123.  However, that number is so close to the -124 average that was measured with the atmega328p asleep that I think it would take a lot more measurements to be confident as to whether or not there is really any difference between the two.

WhiteHare

#102
So, I finally captured the objective, which was to measure the RSSI inside a sealed metal can, while the atmega328p was sleeping (as described above), and while powered directly from battery with no voltage regulator.  What surprised me is that the average of 1,000 measurements is still -124:

http://pastebin.com/TC4fqw7v

So, I guess whatever noise is there must be coming from the rfm69 module itself?

[Edit1: Since you'll probably ask, below are the same measurements inside the sealed metal can, while powered directly from battery with no voltage regulator, but this time with the atmega awake rather than sleeping during the RSSI measurements.   The average RSSI again came out to -123:   http://pastebin.com/jV0eHp5q  ]

[Edit2: Come to think of it, I never did put the Flash Memory into Powerdown mode on any of the test runs so far.  Do you suppose it might  be having any effect?]

WhiteHare

#103
So, to finally settle it, I did the experiment where the  Moteino with antenna solder tacked to GND is run direct from 2 AA batteries, with no voltage converter, inside a sealed metal can, and RSSI is measured while the atmega is sleeping and also while the winbond flash memory is sleeping.  In order for the flash memory to later be woken up so as to record the values, I had to add a 400K pulldown resistor between D12 and GND.  Aside from that, the hardware configuration was the same as before.

http://pastebin.com/PGcsNrr7

Felix

Interesting. I am puzzled by the 400k pulldown. I've never had to do anything like that on a SPI device. Not sure what to say about that.