Problem with P2P communication

73 views
Skip to first unread message

Matej

unread,
Jul 6, 2017, 6:03:53 AM7/6/17
to souliss
I have a problem I cannot figure out...any help would be greatly appreciated.
For the first time I am trying to use P2P communication, none of them are working as expected. It probably will be something trivial, but I have really no clue...
The problem :
I am trying to PullData from one node to another. The result is always the same - the state is bouncing - on / off at random. If the sending typical is 0, the receiving note is also at 0. But as soon as the sending note goes to 1, the receiving node starts going high/low...
First I thought it could be the network adapter - I used RS485. Changed this to Ethernet, same result.
The code I am using

FAST_x10ms(9)  {
    PullData(78, MotionSensor1, 7, 1);
    if(mInput(MotionSensor1) ==1) mInput(MotionSensor1) = 2;
    else if (mInput(MotionSensor1) == 0) mInput(MotionSensor1) = 4;
    Logic_T11(MotionSensor1);

Thank You all in advance
M

Matej

unread,
Jul 7, 2017, 1:22:30 AM7/7/17
to souliss
Managed to get things moving in the right direction, with publish / subscribe, it is kind of working.
I have some questions maybe someone can help me with - how long should it take for a publish - subscribe cycle to make happen? It is taking 1-5 seconds for the subscribing node to notice the published data..

Di Maio, Dario

unread,
Jul 7, 2017, 2:17:04 AM7/7/17
to sou...@googlegroups.com

Hi,

likely your problem is in the speed, RS485 has a very limited bandwitdh and pulling data at 10ms result in a lot of miss communication.

You have two options, the first is a FAST with PullData only at no less than a second, then another FAST with your logic.
As rule of thumb on AVR no more than 1 communication for each second.

Pub/sub time will depend on how often you execute your FASTs, the overall time is more or less the sum of all FAST involved in the communication. If you need faster performance go to esp8266 in wifi.

Regards,
Dario.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+unsubscribe@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/souliss/6faa1f1b-79e5-4e69-9e2a-eab2cb520c07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matej

unread,
Jul 7, 2017, 2:43:15 AM7/7/17
to souliss
Thank You Dario for Your reply.
I switched all the nodes to Ethernet, since I suspected this to be the problem. It was not.
PullData did not work for me at all, I am sure I have to be doing something very wrong..
It is starting to look like I am flooding the network, and some commands are lost in there somehow - sometimes it works, sometimes it does not. 
All FAST parts involved in communication are set to 1110ms, but still the subscribing node sees the published data in 5 seconds, or sometimes not at all.
Is there an working example, or something that could explain p2p to me in better detail than the wiki article? Maybe with PullData, and/or publish/subscribe?

Thank You agin
Best regards,
M


Di Maio, Dario

unread,
Jul 8, 2017, 8:27:20 AM7/8/17
to sou...@googlegroups.com

Your nodes have a small buffer in RAM and low througput, you are flooding your network and you miss data.

Show your code.

Dario.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+unsubscribe@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
Message has been deleted

Matej

unread,
Jul 16, 2017, 2:22:03 PM7/16/17
to souliss
Hello Dario,

I uploaded the sketches, please keep in mind that this is my first souliss / arduino attempt, just piecing together some sketches. 
These two are supposed to work together, my goal would be to get a stable response from one to the other, in a reasonable time - a delay of 1-5 seconds is not a problem, but the faster, the better..

Ethernet_Souliss.ino
Alarm_Bridge.ino

Di Maio, Dario

unread,
Jul 16, 2017, 5:43:52 PM7/16/17
to sou...@googlegroups.com
You cannot use multiple publish commands at once, because you fill the queue. You should instead run a publish at no less that 1 or 2 seconds each, so that the node can process the communication in between.

Use SHIFT to split the code.

Dario.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+unsubscribe@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages