Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nRF receiving wrong payload? #16

Closed
njtrettel opened this issue Sep 20, 2016 · 9 comments
Closed

nRF receiving wrong payload? #16

njtrettel opened this issue Sep 20, 2016 · 9 comments

Comments

@njtrettel
Copy link

njtrettel commented Sep 20, 2016

Hey there. I downloaded your library (and the RF24 library). So now I'm trying a simple send/receive example. I can send packets from the nRF and pick them up on my phone, but I can't get the reverse. I don't want to complicate things but here's a snippet:

Serial.print(btle.listen());
Serial.println(btle.buffer.pl_size);

for (int i = 0; i < btle.buffer.pl_size; i++) {
Serial.print(btle.buffer.payload[i], HEX);
Serial.print(" ");
}

I first tested this without advertising anything from my phone. When I don't call btle.listen() and just print out the buffer anyway, I get 0 for size and nothing for payload (as expected). So then I re-ran, calling listen() first, and I get 3 different payloads, repeated indefinitely... but nothing is advertising. Then I tried btle.buffer.payload[i] = 0 in my loop, to "reset it". It did not like that... but this time I only got 1 payload over and over again.

What am I doing wrong? I know it's happening within listen() because I correctly get all 0's when I do not call listen. I think it has something to do with the communication between this library and the nRF, or maybe the buffer is at the wrong address. Here is a line of output from the for loop:

75 31 11 48 96 77 F8 E3 46 E9 AB D0 9E 53 33 D8 BA 98 8 24 CB 3B FC 71 4B 1 0 F 1 9 A 0 0 0 20�(�ª�adv recv
That "adv recv" is coming from the "BTLE adv recv" output in the setup()...

@floe
Copy link
Owner

floe commented Sep 20, 2016

Is it possible that the packets sent from your phone are simply too large? If it's more than ~21 bytes of payload, then the internal buffer of the nRF24 will overflow and you will get garbage.

@njtrettel
Copy link
Author

This was my original thought too, but this doesn't explain where the exact same garbage is coming from when there are no ADV packets in the air. Any help on this is really appreciated. I'm also going to try using a different nRF/breakout combo in case it might be broken.

@njtrettel
Copy link
Author

Figured it out! Didn't realize our breakout took a 5V input not a 3.3V...

@floe
Copy link
Owner

floe commented Sep 21, 2016

So sending & receiving now both work? For reference, what phone are you using?

@njtrettel
Copy link
Author

Yes sending and receiving both work fine. I'm using a Samsung Note 5.
Running Android 6.0.1. I use the nRF Connect app. By the way is this
library finished? There are a few things that I might add to the library
and if they work out I would be happy to push them.

On Sep 21, 2016 3:18 AM, "Florian Echtler" notifications@github.com wrote:

So sending & receiving now both work? For reference, what phone are you
using?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#16 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AKZpvqqTVD0uVUgZAVfoqMFSYaJZpm43ks5qsNpXgaJpZM4KBJDU
.

@floe
Copy link
Owner

floe commented Sep 21, 2016

Great to hear, thanks! I haven't been using the library myself for a while (as the nRF52 series are so incredibly cheap), but I'd be happy to take pull requests.

@njtrettel
Copy link
Author

Alright cool. I have a lot of ideas but not sure if most of them are
possible, but I will definitely push the stuff that works.

On Sep 21, 2016 9:25 AM, "Florian Echtler" notifications@github.com wrote:

Great to hear, thanks! I haven't been using the library myself for a while
(as the nRF52 series are so incredibly cheap), but I'd be happy to take
pull requests.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#16 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AKZpvgEAQ4cfGQaiSgRo9miAW5Qy7FT4ks5qsTBMgaJpZM4KBJDU
.

@floe
Copy link
Owner

floe commented Sep 22, 2016

Looking forward to it. BTW, what Arduino did you use?

@njtrettel
Copy link
Author

I'm using an Uno. With an ATMEGA328

On Sep 22, 2016 4:48 AM, "Florian Echtler" notifications@github.com wrote:

Looking forward to it. BTW, what Arduino did you use?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#16 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AKZpvgN34uQsirTFUH_KKWnUiiYIxJwBks5qskDRgaJpZM4KBJDU
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants