[nRF24L01P] problem in setting 250kbps data rate

2,368 views
Skip to first unread message

Khyale Nascimento

unread,
Apr 13, 2013, 9:59:50 PM4/13/13
to nrf24-...@googlegroups.com
Hi,

I am using the Arduino library NRF24 to implement a wireless link between two
Arduinos UNO with nRF24L01P modules. But, when I try to change the
data rate to 250kbps the communication stops. At 1Mbps and 2Mbps the communication is established again.

I reviewed the souce code of the library NRF24.cpp, but I can not figure
out what/where is the problem. I am using the version 1.7.

Do you have the same problem?

Thanks,

Khyale.


Mike McCauley

unread,
Apr 13, 2013, 10:32:15 PM4/13/13
to nrf24-...@googlegroups.com, Khyale Nascimento
Hello,
Yes, I have seen similar behaviour, but only with some sketches.
Unknown reason.

Cheers.

>
> Thanks,
>
> Khyale.
--
Mike McCauley mi...@open.com.au
Open System Consultants Pty. Ltd
9 Bulbul Place Currumbin Waters QLD 4223 Australia http://www.open.com.au
Phone +61 7 5598-7474 Fax +61 7 5598-7070

Radiator: the most portable, flexible and configurable RADIUS server
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
Platypus, Freeside, TACACS+, PAM, external, Active Directory, EAP, TLS,
TTLS, PEAP, TNC, WiMAX, RSA, Vasco, Yubikey, MOTP, HOTP, TOTP,
DIAMETER etc. Full source on Unix, Windows, MacOSX, Solaris, VMS, NetWare etc.

Jake L. Tag

unread,
May 18, 2014, 10:01:11 AM5/18/14
to nrf24-...@googlegroups.com, Khyale Nascimento
Hello all,

I report the same problem, I have a set of NRF24L01+ 's with external antenna, works well @ 1Mbps and 2Mbps, I can't seem to get a connection @ 250kbps. Any new insights on this matter ?

Cheers,

Jack

Mike McCauley

unread,
May 18, 2014, 4:48:16 PM5/18/14
to nrf24-...@googlegroups.com
On Sunday, May 18, 2014 07:01:11 AM Jake L. Tag wrote:
> Hello all,
>
> I report the same problem, I have a set of NRF24L01+ 's with external
> antenna, works well @ 1Mbps and 2Mbps, I can't seem to get a connection @
> 250kbps. Any new insights on this matter ?

No.

Cheers.

>
> Cheers,
>
> Jack
>
> On Sunday, April 14, 2013 4:32:15 AM UTC+2, mikem wrote:
> > Hello,
> >
> > On Saturday, April 13, 2013 06:59:50 PM Khyale Nascimento wrote:
> > > Hi,
> > >
> > > I am using the Arduino library NRF24 to implement a wireless link
> >
> > between
> >
> > > two
> > > Arduinos UNO with nRF24L01P modules. But, when I try to change the
> > > data rate to 250kbps the communication stops. At 1Mbps and 2Mbps the
> > > communication is established again.
> > >
> > > I reviewed the souce code of the library NRF24.cpp, but I can not figure
> > > out what/where is the problem. I am using the version 1.7.
> > >
> > > Do you have the same problem?
> >
> > Yes, I have seen similar behaviour, but only with some sketches.
> > Unknown reason.
> >
> > Cheers.
> >
> > > Thanks,
> > >
> > > Khyale.
> >
> > Radiator: the most portable, flexible and configurable RADIUS server
> > anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
> > Platypus, Freeside, TACACS+, PAM, external, Active Directory, EAP, TLS,
> > TTLS, PEAP, TNC, WiMAX, RSA, Vasco, Yubikey, MOTP, HOTP, TOTP,
> > DIAMETER etc. Full source on Unix, Windows, MacOSX, Solaris, VMS, NetWare
> > etc.

--
Mike McCauley VK4AMM mi...@airspayce.com
Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
http://www.airspayce.com

Colin Cooper

unread,
May 18, 2014, 6:37:03 PM5/18/14
to nrf24-...@googlegroups.com
A couple of wild guesses:
  • Are you 100% certain they are all NRF24L01+ 's?  The older NRF24L01 doesn't support 250k.
  • If you are using Auto Retransmission, is your Auto Retransmit Delay long enough?  Try 1500μs or more.

  Regards,
  Colin



--
You received this message because you are subscribed to the Google Groups "NRF24-Arduino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nrf24-arduin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Khyale Nascimento

unread,
May 19, 2014, 11:07:24 PM5/19/14
to nrf24-...@googlegroups.com
The code of NRF24's Arduino library has a bug in function setRF in NRF24.cpp. Copy the code below and replace it into NRF24.cpp file.

boolean NRF24::setRF(uint8_t data_rate, uint8_t power)
{
    uint8_t value = power & NRF24_PWR;  /* line modified */
    // Ugly mapping of data rates to noncontiguous 2 bits:
    if (data_rate == NRF24DataRate250kbps)
       value |= NRF24_RF_DR_LOW;
    else if (data_rate == NRF24DataRate2Mbps)
value |= NRF24_RF_DR_HIGH;
    // else NRF24DataRate1Mbps, 00
    spiWriteRegister(NRF24_REG_06_RF_SETUP, value);
    return true;
}

Mike McCauley

unread,
May 20, 2014, 2:11:27 AM5/20/14
to nrf24-...@googlegroups.com
Hi,

No, there is no bug there (at least nothing that your change fixes).

In fact it will break the power setting bits.

Do not apply this patch.
--
Mike McCauley VK4AMM mi...@airspayce.com
Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
http://www.airspayce.com

Mike McCauley

unread,
May 20, 2014, 2:21:23 AM5/20/14
to nrf24-...@googlegroups.com
Hi,

in fact it turns out this problem is caused by the auto retransmit delay not
being long enough for 250kbps.
Fixed in 1.14.

There will be no more updates to NRF24.
Use RadioHead instead.
http://www.airspayce.com/mikem/arduino/RadioHead

Cheers

Jake L. Tag

unread,
Jun 7, 2014, 6:36:33 AM6/7/14
to nrf24-...@googlegroups.com
Dear Mike,

my apologies for the late reply, since you always respond in such timely fashion. I will move over to the new RadioHead library (some impressive mesh network functions) and see how it goes. If my range with the lower data rate is not sufficient I might get into the mesh network. I would like to ask a question about that, but it might be more appropriate to post it on the RadioHead forum.

Cheers,

Jack

Jake L. Tag

unread,
Jun 7, 2014, 8:50:00 AM6/7/14
to nrf24-...@googlegroups.com
Dear all, Mike,

I have tried the RadioHead library: it works @250kbps for all my NRF24L01+ modules. However, using the manager it takes about 500 ms to send a message over 250kbps, with the wait. I'm still interested to see how this works out if I use the old library and get auto ACK to work. However, my problem persists. Even with version 1.14 I cannot get the auto ACK to work @250kps. Has anyone tested this and can confirm it works ? I'm heading into the nrf datasheet now to see if I have missed anything.

Cheers,

Jack

Jake L. Tag

unread,
Jun 7, 2014, 9:11:09 AM6/7/14
to nrf24-...@googlegroups.com
To be precise: I get the waitPacketSent error.

I have changed the Auto Retransmit Delay to 4000 us in the library:

boolean NRF24::setRF(uint8_t data_rate, uint8_t power)
{
    uint8_t value = (power << 1) & NRF24_PWR;
    // Ugly mapping of data rates to noncontiguous 2 bits:
    if (data_rate == NRF24DataRate250kbps)
value |= NRF24_RF_DR_LOW;
    else if (data_rate == NRF24DataRate2Mbps)
value |= NRF24_RF_DR_HIGH;
    // else NRF24DataRate1Mbps, 00
    spiWriteRegister(NRF24_REG_06_RF_SETUP, value);

    if (data_rate == NRF24DataRate250kbps)
spiWriteRegister(NRF24_REG_04_SETUP_RETR, 0xF3); // 1250usecs, 3 retries   <==== CHANGED TO 4000 US
    else
spiWriteRegister(NRF24_REG_04_SETUP_RETR, 0x03); // 250us, 3 retries

    return true;
}

To no avail. There must be a problem with the ACK, because the modules work with the radiohead library at that rate.

Cheers,

Jack

Mike McCauley

unread,
Jun 7, 2014, 4:47:52 PM6/7/14
to nrf24-...@googlegroups.com
Hello,

this was a known problem with th NRF24 librray that was subsequently fixed in
the RadioHead library RH_NRF24 library.

Cheers.

Jake L. Tag

unread,
Jun 8, 2014, 5:13:29 AM6/8/14
to nrf24-...@googlegroups.com
Hello Mike,

I'm trying to figure something out: the driver in the RadioHead library for the nrf24 does not use auto ACK, from what I can tell from the code: it's the managers that provide this functionality.

A (possible) advantage the auto ACK offers me is that my processor is not used for sending these packets back: it's all done by the nrf module.

However: for using the auto ACK feature the RadioHead library refers back to the old library. You mentioned the problem with auto ACK @250kbps was fixed in the last update (1.14) prior to migration to RadioHead, but alas - I can't get it to work.

Basically my question boils down to this: have you ever confirmed the nrf24l01's working @250kbps with auto ACK?

Cheers and thanks,

Jack

Mike McCauley

unread,
Jun 8, 2014, 5:32:46 AM6/8/14
to nrf24-...@googlegroups.com
On Sunday, June 08, 2014 02:13:29 AM Jake L. Tag wrote:
> Hello Mike,
>
> I'm trying to figure something out: the driver in the RadioHead library for
> the nrf24 does not use auto ACK, from what I can tell from the code: it's
> the managers that provide this functionality.

That is correct.

>
> A (possible) advantage the auto ACK offers me is that my processor is not
> used for sending these packets back: it's all done by the nrf module.

That is true.

>
> However: for using the auto ACK feature the RadioHead library refers back
> to the old library. You mentioned the problem with auto ACK @250kbps was
> fixed in the last update (1.14) prior to migration to RadioHead, but alas -
> I can't get it to work.
>
> Basically my question boils down to this: have you ever confirmed the
> nrf24l01's working @250kbps with auto ACK?

Yes, using version 1.14 of NRF24.

Cheers.

Jake L. Tag

unread,
Jun 8, 2014, 10:51:10 AM6/8/14
to nrf24-...@googlegroups.com
Thanks. That means I'm doing something wrong. The setup works @2Mbps, so I thought that rules out any wiring problems. I'll rebuild my setup, check all libraries and give it another go. If you have any idea what else to check, I'm much obliged to hear it.

Cheers,

Jack
Reply all
Reply to author
Forward
0 new messages