Conflicting Serail Objects
davidpzk
Posts: 19
Has anyone else had problems with serial objects conflicting with each other?
I am using "Full-Duplex_COMEngine" to send commands at 300 baud to a serial device.
I am simultaniously using "Parallax Serial Terminal" at 9600 baud to do code troubleshooting and debugging.
When both are started, I get conflicts/unwanted characters/noise on both of them.
If I comment out one or another, all is well.
Anyone else see this happen?
I am using "Full-Duplex_COMEngine" to send commands at 300 baud to a serial device.
I am simultaniously using "Parallax Serial Terminal" at 9600 baud to do code troubleshooting and debugging.
When both are started, I get conflicts/unwanted characters/noise on both of them.
If I comment out one or another, all is well.
Anyone else see this happen?
Comments
You should only use one serial driver per set of IO pins. You can use the same serial driver from multiple cogs by using locks to keep the output from mixing together.
I believe there's a multicog debug object that takes care of this for you (I haven't used it).
Kye's objects often use locks, "Full-Duplex_COMEngine" might be usable from multiple cogs (I haven't used it in a long time).
While I have not used either of the serial objects you mention - I use FullDuplexSerial or my modified version (..._rr004) and do not have any problems at 115,200 baud.
It may be better to post your code. You can zip it with proptool and post that, or if short, post the code between {code} ... {/code} tags using square brackets instead of the braces shown here.
A guess could be as simple as not enough stack space.
Are the serial objects sharing IO pins? If not, then there's some other problem like Cluso99 suggests.
I believe you want something like
The line below says print from the address RecievedBufferCount until we see a terminating zero.
I made your code suggesion chage(s) but still have the same problem. Part of the string that is clearly intended for pin 7 is making it to pin 30.
See updated code...
Could you provide a link?
Says go to the memory address RecievedBufferCount, which is whatever was in Serial.receivedNumber, then start transmitting until we find a zero. Anything can be in memory starting at Serial.receivedNumber
In the mean time, Im looking into kwinn's suggestion and seeing if I can make use of the 4port serial object instead...
Thanks for posting the driver.
I like to think I improved a good thing. I have a couple of modified versions of Tim Moore's four port driver here. The 128 byte rx buffer version gives you a bigger buffer at the cost of a few longs in increased program size. (Most of the increase is due to fixing the Dec method's bug in the original.)
I don't see the need for:
I think the above code would adds two zeros after number of bytes in the buffer.
I think this would work.
Since only one byte of data was stored. (I think that's what the program is doing.)
Which is a good idea.
I'd suggest separating the bytes.
Or adding a carraige return between bytes.
The 4 port serial object is really cool. Preliminary tests show it is pretty good at serial traffic control across multiple ports. I dont think I need it for this project but its nice to have around for larger serial project needs. Very good to know it exists!
Turns out the heart of the problem was me needing to use the term.dec command instead of the term.str command.
Problem solved.
In case just use -1 as rx/tx pin for the dummy ports..
http://forums.parallax.com/showthread.php?129776-Anybody-aware-of-high-accuracy-%280.7-or-less%29-serial-full-duplex-driver
Massimo