-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add network wide multicasting and multicast routing
- Multicasting works in levels, with each node on the same level sharing a multicast address (levels 1-6) - Direct child nodes are limited to 4-per-parent in multicast mode, but a multicast node can have unlimited children if they only need to receive. If more than 4 need to transmit, they can transmit to any node other than the parent/relay node by writing directly to it with a payload addressed to another node. - Nodes can be setup as multicast relays and will always relay multicast payloads onto the next level - Any node(s) can be assigned any multicast level - A network topology can combine multicast and non-multicast branches and nodes as required, along with standard network routing - Duplicate multicast payloads are automatically filtered out, so multiple multicast relay nodes can be active in the same area eg: Send to all level 1 nodes: network.multicast(header,&message,sizeof(unsigned long),1); Multicasting is enabled by uncommenting #define RF24NetworkMulticast in the RF24Network_config.h file
- Loading branch information
Showing
6 changed files
with
356 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some spare time so I decided to play around with the Development branch.
The RPi (Node 00) and it's direct children (Nodes 01-05) seem to interact perfectly. However, all communication to/from the children's children (e.g. Node 00 <=> Node 01 <=> Node 031) fails.
e.g.
MAC Send fail to 031 via 01 on pipe 5
MAC Network ACK fail from 031 via 01 on pipe 5
First I tried extending the network.txTimeout to 30, and then 50 & network.routeTimeout (using txTimeout + 35). I would randomly get "MAC: Network ACK Rcvd". When I changed the retries using setRetries([your retryVar formula], 15), communications seemed to start working again. All retries/timeout changes were made to both Arduino and RPi devices.
I haven't yet tested removing my extensions to network.txTimeout & network.routeTimeout; I wonder if maybe they're unnecessary after changing the number of retries.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be few strange things going on with it that I haven't put my finger on yet. Oddly enough, it seems to work OK for me, even with multiple levels of children nodes.
The txTimeout and routeTimeout numbers are related. The txTimeout must be greater than the total retry period (if retries are 5,15 then 250 * 6 * 15 = 22500us or 22.5ms. The route timeout needs to be about 25-35ms greater than the txTimeout period, or it might not wait long enough for network ACKs.
Im not sure this is the problem you are having though, so I'm kind of confused as to why changing the retry values would have fixed it for you. In looking at the timeout periods, I do notice that there is a difference between the RPi and Arduino timeout settings, so maybe thats why? I've since made them the same locally, but haven't updated the dev branch.
In any case, I won't be able to do a whole lot on the dev branch for probably a week or two, but if you have a chance in the mean-time, maybe revert some or all your changes to see if the issue returns, to figure out what exactly is going on. If you can re-create the issue, then I should be able to re-create it as well.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt it makes a difference, but my adjustments were made outside of the library (in my code) after calling network.begin().
Did you make the RPi retry/timeouts the same as the Arudino or the Arduino retry/timeouts the same as the RPi? I'll remove my adjustments, match your changes, and see if that makes a difference.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, well maybe it is related to the timeouts?
Right now I have this for both Arduino and RPi in the
void RF24Network::begin(uint8_t _channel, uint16_t _node_address )
section of RF24Network.cpp:The txTimeout value could be a little higher I think, but 20ms should account for most delays.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some testing last night...
After some adjustments to my code running on Node 031, I can confirm it's receiving packets from Node 00, but Node 00 still reports that the send/network ack failed.
I also realized this morning that I'm using the 250KBPS data rate and not the default of 1MBPS. I should try using the 1MBPS data rate and see if my problems go away.
I'll do more testing tonight.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, although not sure what is going on with it. Hopefully I can get some more work done soon on it, and get my changes committed to github so we're working with the exact same code to make things a little easier.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries; I'm sure it'll get worked out eventually. I like the bleeding edge/testing new things :)
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I finally managed to clean the dev code up enough to check this out and make a few changes. I'm hoping the latest commit and recent RF24 fixes combined will address any issues.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, I'm not so sure now.
Since it was saying MAC Send fail to 031 via 01, I just realized there was a problem with the multicast write, since that would be a routed payload from 00 > 01 > 031 (no_ack). Due to this, I set the same addressing and tested some more sending from my RPi, and spotted (I think) the same issue. I just updated the RPi RF24 lib because dynamic no_ack writes were being sent as normal auto_ack writes from RPi devices, but it was also waiting for a network_ack. I only realized it after introducing connection problems, like disconnecting node 01, but I was able to recreate it and resolve it as far as I can tell. This affected all multicast/no_ack writes from RPi.
The commit I committed is nRF24/RF24@9e12c23 but somehow that commit didnt reference this commit properly when I committed it.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6e25453
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was the last bit! I added a small delay and now everything is working.
Thanks again for your work on RF24/RF24Network! 👍