Author Topic: Sending just after receiving needs a delay  (Read 2303 times)

gussabina

  • NewMember
  • *
  • Posts: 42
  • Country: us
Sending just after receiving needs a delay
« on: December 26, 2016, 02:25:16 PM »
Hello All:

It seems the RFM69HW can't send a packet just after receiving, unless there is small delay (3ms according the library). I read the Datasheet but I couldn't find information justifying this behavior. Does someone know why this delay is necessary?

Thanks
Gus

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: Sending just after receiving needs a delay...
« Reply #1 on: December 26, 2016, 04:35:15 PM »
unless there is small delay (3ms according the library)

Can you share where the 3ms delay is that you refer to?

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: Sending just after receiving needs a delay...
« Reply #2 on: December 26, 2016, 04:44:48 PM »
Quote
It seems the RFM69HW can't send a packet just after receiving, unless there is small delay (3ms according the library).

It takes a tiny bit of time for the other side to go back into rx, setup the filter correctly etc. But hardly 3ms at Felix settings.

I think the 3ms wait period in Felix gateway sketch comes from the 3ms synchronous LED blinks his node sketch performs after sending a packet and before switching the radio back into RX. You would obviously not want to do that in production code.

Joe

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: Sending just after receiving needs a delay...
« Reply #3 on: December 26, 2016, 04:46:03 PM »
Sure, he was saying that's in the library though...  ???

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: Sending just after receiving needs a delay...
« Reply #4 on: December 26, 2016, 04:50:05 PM »
Quote
Sure, he was saying that's in the library though...  ???

Yeah - well library examples in this case. I don't think there's anything in the library itself.

gussabina

  • NewMember
  • *
  • Posts: 42
  • Country: us
Re: Sending just after receiving needs a delay...
« Reply #5 on: December 26, 2016, 06:23:32 PM »
Yes, I was referring to the Gateway sample code;

       Serial.print(" - ACK...");
        delay(3); //need this when sending right after reception .. ?
        if (radio.sendWithRetry(theNodeID, "ACK TEST", cmdLen, 0))  // 0 = only 1 attempt, no retries

or any example where you need to transmit just after receiving....

BTW, what Felix refers as a library is not a library anyway....Library is a set of object code, and the "library" he refers is in source code (.cpp)

Thanks
Gus

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: Sending just after receiving needs a delay...
« Reply #6 on: December 26, 2016, 06:39:17 PM »
If you want a simple workaround call receiveDone prior to blink.

gussabina

  • NewMember
  • *
  • Posts: 42
  • Country: us
Re: Sending just after receiving needs a delay...
« Reply #7 on: December 26, 2016, 06:55:43 PM »
Thank you, joelucid.

I'm having issues and since I saw the above comment in the code  (  //need this when sending right after reception .. ?) I though this could be a known issue, but I didn't find anything in the Datasheet.

Thanks
Gus

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: Sending just after receiving needs a delay...
« Reply #8 on: December 26, 2016, 07:18:18 PM »
I may have some loosey code around in examples with some delays.
However most examples have no such delays after reception and it's not implied anywhere you need that, in fact you do not.

By library I understand/mean RFM69.h and RFM69.cpp along with any secondary headers and source code (ex RFM69_ATC or OTA). The examples illustrate using the library, and are *NOT* part of the library code - ie they don't get compiled into your own sketches, only the library code does. Getting lost in translation here I guess but it's good to be more specific so we're all on the same page.

joelucid

  • Hero Member
  • *****
  • Posts: 868
Re: Sending just after receiving needs a delay
« Reply #9 on: December 26, 2016, 07:47:32 PM »
Quote
I'm having issues

Maybe if you describe the issues we could help you address them. As Felix says rfm69 certainly doesn't have any intrinsic need for such delays so your problems might be caused by something completely different.

Joe