-
-
Notifications
You must be signed in to change notification settings - Fork 643
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
Fix duplicate packet reception on Arduino MKR 1310 #664
base: master
Are you sure you want to change the base?
Conversation
Have you thoroughly checked the rest of your code to ensure something else isn't causing the duplicate? I've never encountered a situation where the IRQ doesn't clear. |
The program I have that showed this happening rather easily was basically broadcasting a counter variable every second and checking for received packets all the time. I don't have enough knowledge to investigate further why the IRQs are not clearing, but after searching online I came across this issue describing the same problem but on a different board, and this fix was suggested. After trying the same fix on my board I could confirm that there are no longer duplicated received packets. I understand that this looks like a hack and the problem may come from somewhere else, so I understand if you don't want to merge it as is. But the patch as is should also only affect the MKR 1310 board which is already misbehaving (the duplicates) with the original code. |
There's an easy experiment you can try. Replace the new |
It would also be helpful to understand this issue better if you could share the code around the call to |
Replacing My sample application is doing this when sending a packet:
On the receptor end, I receive data like so:
|
I got the same error on an MKR WAN 1300. I am reading the IRQ flags before and after the call of parsePacket(). Whenever a packet gets duplicated, the IRQ flags were not cleared after the call to parsePacket() but stayed at 64 instead. I was able to fix this by checking the content of the IRQ flag register after the return of the call to parsePacket() and clearing the register again if it is not 0 at that point. I only have to clear it once and it works immediately. If I don't clear it again, it never clears by itself, so another writing to it is necessary. |
Without this change there is a chance that we receive duplicate packets