2-way RF serial communication problem
Hello
I am having a problem to get a stable 2-way communication with the RF parallax reciever and transmitter. I have 2 BS2P units·and both have a transmitter and reciever each. When I have only 1 way communicaiton from unit 1 to unit 2 it works fine and also·the other way from unit 2 to unit 1. But when both are running I have problems with stability in the communication.
I have set the baud rate to a low 1200··and I also use have a wait qualifier and a time out on both recievers.·The power down pin is pulled low after transmission and recieving and is pulled high before sending and recieving on all 4 RF units. The code is set up so that the units alter in sending and recieving and have a short pause after recieving so that the other unit should be waiting for a transmission. I also use a "wake up" pulse so that I am sure the reciever has woken up before sending the important data. (I have also tried without the pulse out because I thought it· maybe was disturbing the timeout but the communication performance was even more degraded without it.)
With this set up it should be robust:
·-If unit 1·is not recieving the correct wait qualifier it should time out and continue the cycle and come into "phase" again.
- If unit 1 is recieving garbage and the time out is thereby overiden it should eventually recieve the correct transmission from unit 2 because·it should ·always be timing out on recieving and constantly resending.
But the communication is very unstable and the problems are·strange:
-The timeouts seem to·vary in length when·tracked in the debug window. Sometimes·it looks·like the program is just halting in wait mode and the timeout·can·take a very very long time. But still it looks like it is dependent on the time out value. The higher the timeout value these very long wait times increase.
-When the program seemingly is in wait mode (but strangely not timing out) it often helps to just touch the antennas. Then the it starts recieving and sending correclty again. But the units are only a few meters apart and the signal strength should be good.
So it look like the reciever is being disturbd and that a bad reception is leading to some recieving but nor correct and thereby not causing it to·time out but still not is recieving the defined correct data and thereby is just sitting there and waiting?? But why does it then work in 1-way config??
If anyone has any ideas or comments I would appreciate them because this problem is very frustrating.
Best Regards
Christer Modig
·
I am having a problem to get a stable 2-way communication with the RF parallax reciever and transmitter. I have 2 BS2P units·and both have a transmitter and reciever each. When I have only 1 way communicaiton from unit 1 to unit 2 it works fine and also·the other way from unit 2 to unit 1. But when both are running I have problems with stability in the communication.
I have set the baud rate to a low 1200··and I also use have a wait qualifier and a time out on both recievers.·The power down pin is pulled low after transmission and recieving and is pulled high before sending and recieving on all 4 RF units. The code is set up so that the units alter in sending and recieving and have a short pause after recieving so that the other unit should be waiting for a transmission. I also use a "wake up" pulse so that I am sure the reciever has woken up before sending the important data. (I have also tried without the pulse out because I thought it· maybe was disturbing the timeout but the communication performance was even more degraded without it.)
With this set up it should be robust:
·-If unit 1·is not recieving the correct wait qualifier it should time out and continue the cycle and come into "phase" again.
- If unit 1 is recieving garbage and the time out is thereby overiden it should eventually recieve the correct transmission from unit 2 because·it should ·always be timing out on recieving and constantly resending.
But the communication is very unstable and the problems are·strange:
-The timeouts seem to·vary in length when·tracked in the debug window. Sometimes·it looks·like the program is just halting in wait mode and the timeout·can·take a very very long time. But still it looks like it is dependent on the time out value. The higher the timeout value these very long wait times increase.
-When the program seemingly is in wait mode (but strangely not timing out) it often helps to just touch the antennas. Then the it starts recieving and sending correclty again. But the units are only a few meters apart and the signal strength should be good.
So it look like the reciever is being disturbd and that a bad reception is leading to some recieving but nor correct and thereby not causing it to·time out but still not is recieving the defined correct data and thereby is just sitting there and waiting?? But why does it then work in 1-way config??
If anyone has any ideas or comments I would appreciate them because this problem is very frustrating.
Best Regards
Christer Modig
·
Comments
Please attach a copy of your program, as that will help us in trying to trouble shoot the problem. Below, is just one caveat from the PBASIC Help File regarding an idiosyncracy of SERIN with a TIMEOUT specified. Please see the Help File for details:
"Here's a very important concept: this timeout feature is not picky about the kind of data SERIN receives; if any serial data is received, it prevents the timeout. In the example above, SERIN wants a decimal number. But even if SERIN received letters "ABCD..." at intervals of less than two seconds, it would never abort."
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thank you for your interest. The code is attached as text files and consists of 3 files. One is for the basement unit and the other two is for the other BS2P unit in the house (I use 2 banks/slots).· Please find "project background" below for better understanding of the code.
I plan to use the basement unit for measure humidity and temp in two locations in the basement·of my house and control (on/off) the de moisturising equipment (including the evacuation pump when the "bucket" is full of water)·and a distrubution fan in the basement. The level of condensated water··in the demoisturiser will be chacked with a ultrasonic distance measurement.
The sensors (2 temp/ 2 moisture ) are attached to a Maxim 8 channel serial ADC and the controll will be done via DIL outputrelays·(5 V operated) that when·closed send·12 v (externally supplied)·to the next·relay (coil voltage 12V) which closes the 230V·for evac pump, demoisturiser fan etc.
I shall be able to remotely controll this from the unit in the house via altering the set points and·also·present values, status, statistic·etc on an LCD. I will also attach a clock and log the values so that I will get monthly max / min, flows etc. Of course I will have manual overide possibilities from the house unit.
I am a beginner to this so if my coding is a bit "ad hoc" I appolgise. I hope that you can help me.
BR Christer
Although I can't give you an absolute reason for doing so, I'd be tempted to remove "abc" and "jkl" as WAIT character strings, and replace them with $55 (one character probably not found in the data) and $AA (one other character probably not found in the data).
Among other things, this will reduce the SERIN WAIT time by 1/3rd and I can't see that as a bad thing. Additionally, using characters with alternating ONES and ZEROS (look at the binary representations) tends to "warm up" the transmitter and receiver.
Give that a try and see if that helps.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I have imlemented your recomendations for the wait character but I can not say the performance has been improved.
Christer
I didn't realize this was primarily a perfromance problem. Boost the BAUD RATE above 1200 baud. I would be quite surprised if that didn't speed things up. You don't seem to indicate there are any particular errors at higher speeds.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I do not have the need for a high Baud rate but as I understand that the Basic Stamp is getting some problem due to a lack of input buffer at higher baud rates (>4800) I decided to use a low rate. But I have already tried higher rates and the symptoms and problems are the same.
The problem is a intermetent failure and halting of the serial link with strange behaviour of the timeout function.
Is there any good way to utilise flowcontrol when using·these RF units.
BR/Christer
Nothing really wrong with the logic in the program I looked at.
However, I usually do the communication in a tight block of code, then take that data and carry out the control functions outside the communication loop.
You can see that in the Transmitt and Receive subroutines there are some control and data handling done right in the middle of the serin/serout.
What I think is happening is that the extra time used to do the non-communication commands between the last SEROUT and the SERIN makes the system miss the characters being WAITed for. If you miss those, the system will sit and wait for a long time (for as long as any characters are being received, the timeout won't operate).
The only other suggestion would be to combine the bits into a byte or two and send only a byte rather than individual bits. After the byte is received, it can be chopped up into the bits you need.
The other thing I've noticed with transceivers is that they require a definite period of time to stabilize as they switch from receive to transmit.
Hope some of this helps!
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
As far as I'm aware the Parallax RF units do not support flow control. It might be interesting to remove the RF units from the test, transmit Stamp-to-Stamp (use the open baud mode - see the examples) and see if the problem is still there.
If it is NOT, the problem may be RF interference causing data errors. I'd even be tempted to raise the baud rate during this test to 9600 baud to see if that's attainable with a direct connection. If the problems are still there at least you've eliminated the RF portion as being part of the problem.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
One possible issue I see is that your Sync pulse is too long…This could actually be causing you problems. Try using 3000 in place of your 10000 value. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
I previously used the 3000 sync pulse value and had the same problems.
But maybe you can answer another question that could help me reducing the problem. I have seen that the problem is accentuated when I place the units further apart in distance. When I have them on the same table the problems are manageable but if placed in separate corners of house the problem is bigger and not acceptable. I checked·the linx homepage and discovered that the TX power could be adjusted with a resistance between pin 4 (LADJ) to VCC. Please see attached figure showing Output power vs LADJ resistance from the data sheet. When I measure the resistance on the parallax units I get a value of 26 kOhm. So my question is if it is theoretically possible to reduce this resistance··via soldering a wire to the Ladj pin and connect it to a lower value resistor and then VCC and thereby increasing to TX output and reducing my communication problems?
Best Regards
Christer