Author Topic: AFC v FEI and correction range for RFM69  (Read 4116 times)

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
AFC v FEI and correction range for RFM69
« on: January 22, 2017, 12:38:49 PM »
A couple of questions for the forum:

What is the difference between the FeiValue and AfcValue registers? Is it that the AfcValue is directly used to modifiy the PLL (along with LowBetaOffset if used), and the FeiValue is copied to this register internally when doing an AFC, but since the FEI can be triggered independently of AFC they are independent registers?

The other is the correction range of AFC. If I had a LO offset of 54kHz but using an Fdev of 5kHz, will the AFC be able to correct? (In that case the modulated frequencies either side of the receiver's carrier can be on the same side of the transmitter's carrier). Anyone know the actual range and specifically whether it's dependent on Fdev?

Mark.

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: AFC v FEI and correction range for RFM69
« Reply #1 on: January 22, 2017, 02:39:56 PM »
Fei is the frequency error indicator and Afc is Auto frequency correction. Fei can measure an error between a signal and the local oscillator. Afc uses fei to allow automatic frequency correction when receiving a packet. So yeah I think what you state is exactly right.

The Afc or fei for that matter looks at the filtered signal. So the rxbw needs to be wide enough for the entire signal to fit.

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: AFC v FEI and correction range for RFM69
« Reply #2 on: January 22, 2017, 03:02:02 PM »
That's what I thought, thanks.

Any views on the range thing? My RxBwAfc is wide enough for all the signal, but the Fdev is small. Are there any limits on correction range versus Fdev? I can't find any info other than the Freescale AFC app note which has +/-150kHz correction with Fdev of 25kHz, I've got 5kHz Fdev and 54kHz offset.

Mark.

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: AFC v FEI and correction range for RFM69
« Reply #3 on: January 22, 2017, 06:21:05 PM »
Oh that's what you meant. No I don't know. I'd probably just detune two motes on purpose and see if afc can fix it.

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: AFC v FEI and correction range for RFM69
« Reply #4 on: January 22, 2017, 07:36:37 PM »
I'll do that.

BTW do you know whether if incoming TX frequency was greater than the LO frequency, would the AfcValue be positive or negative? There's the description about FEI "This function provides information about the frequency error of the local oscillator (LO) compared with the carrier frequency of a modulated signal at the input of the receiver" so I'm reading that as the 'error' is LO - TX (i.e. positive if LO is greater than TX, negative if LO is less than TX), so I assume you have to subtract it from the FRF register value to match the incoming TX frequency.

Mark.

Edit: I've answered my question, it's much clearer in the Freescale AFC app note: "The Frequency Error Indicator block stores the result and that FEI value is used by the AFC block, which then subtracts the value from the RF Carrier Frequency registers, driving the LO to the desired frequency."
« Last Edit: January 22, 2017, 07:55:42 PM by perky »

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: AFC v FEI and correction range for RFM69
« Reply #5 on: January 23, 2017, 09:03:19 AM »
Quote
"The Frequency Error Indicator block stores the result and that FEI value is used by the AFC block, which then subtracts the value from the RF Carrier Frequency registers, driving the LO to the desired frequency."

That's funny. Here's what my code does: I ping the gw to send the sensor a packet which the sensor then does AFC on. The sensor then ADDs what it finds in REG_AFC to its normal frequency to get the to the same frequency as the server.

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: AFC v FEI and correction range for RFM69
« Reply #6 on: January 23, 2017, 12:53:48 PM »
That's funny. Here's what my code does: I ping the gw to send the sensor a packet which the sensor then does AFC on. The sensor then ADDs what it finds in REG_AFC to its normal frequency to get the to the same frequency as the server.
The documentation in the sx1231h datasheet is a little ambiguous, it talks about 'subtracting to' the register rather than 'subtracting from', but the Freescale document seems to have removed that ambiguity.

So, did you check at the server that what was sent back was actually correct and not off by twice the value of afcValue at the sensor?

Mark.

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: AFC v FEI and correction range for RFM69
« Reply #7 on: January 23, 2017, 06:23:23 PM »
Don't panic Joe, you are correct! The Freescale app note is wrong, you do indeed need to ADD the AfcValue to the FRF register to align the frequencies.

As an aside, since I tried subtracting it this had the effect of increasing the error packet by packet, and it was still able to receive and do its AFC stuff even with 100kHz error (and by that time the RxBwAfc was significantly outside the signal bandwidth anyway) so that answers my other question too.

Mark.

fgomes

  • Jr. Member
  • **
  • Posts: 65
Re: AFC v FEI and correction range for RFM69
« Reply #8 on: February 01, 2017, 04:35:21 AM »
That's funny. Here's what my code does: I ping the gw to send the sensor a packet which the sensor then does AFC on. The sensor then ADDs what it finds in REG_AFC to its normal frequency to get the to the same frequency as the server.
Hi Joe, so you use this procedure for frequency "auto-calibration"? So the node sends a message to the gateway and activates its own AFC, the gateway replies and the node checks the REG_AFC value after receiving the message from the gateway, and uses this error to correct its own frequency, not using AFC again? Do you have good results with this method? My previous attempts to narrow the bandwidth I faced some big frequency errors, specially between RFM boards from different batches, perhaps it could be also the ageing effect on the crystal.

Best regards

Fernando

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: AFC v FEI and correction range for RFM69
« Reply #9 on: February 01, 2017, 08:52:00 AM »
Quote
Hi Joe, so you use this procedure for frequency "auto-calibration"? So the node sends a message to the gateway and activates its own AFC, the gateway replies and the node checks the REG_AFC value after receiving the message from the gateway, and uses this error to correct its own frequency, not using AFC again? Do you have good results with this method? My previous attempts to narrow the bandwidth I faced some big frequency errors, specially between RFM boards from different batches, perhaps it could be also the ageing effect on the crystal.

Yeah - sort of. Note that this is what I currently do, I might switch to TCXO's later. First I calibrate the GW by heating it up and pinging a node at constant temperature while cooling down, noting frequency offset and temperature as measured by the radio temp sensor. I apply linear regression and temp correct the gw frequency using the calculated intercept and slope.

Since the GW now always communicates at the same frequency regardless of temperature all nodes can then use AFC as you describe. First they pair at 100khz, get the GW to send a packet at 1.2kbaud with long preamble and establish a baseline measurement. I can then switch to 1.2kbaud and just take an offset measurement whenever I get a new temperature. I average over up to 5 measurements per temperature. When I have those I don't do any further AFC.

Once a day or so I'll throw out one value so age drift will get captured.

Works well.

Joe
« Last Edit: February 01, 2017, 08:56:19 AM by joelucid »