serial RX problems...
Jack Buffington
Posts: 115
I have encountered a strange issue when using fullDuplexSerial, the propeller professional development board using the programming cable as my serial connection to the computer, and the Parallax serial terminal. I'm not sure what the problem is.
I am working to emulate a program that I once wrote for the PIC processor. I have a PC-side program that queries the processor with four bytes of data and then receives about a hundred bytes in response. The very simple propeller tester that just fakes its return data wasn't responding to the queries from the computer so I have done some testing today and have found that it is incorrectly receiving bytes with a value greater than 126 (it would be easier to understand if it were greater than 127...) I query the processor with (255)(data1)(data2)(data3). It is missing the 255 for some reason.
Here is a list of values
I send --- Propeller sees
127 --- 166
128 --- 199
129 --- 252
130 --- 233
131 --- 226
132 --- 228
133 --- 224
Here is the test code that I have used to determine these values:
Maybe the issue is my command of spin? I have spent most of my time working in propeller assembly. I can't see any rhyme or reason for the changes in the bit pattern for the improperly received bytes.
I am working to emulate a program that I once wrote for the PIC processor. I have a PC-side program that queries the processor with four bytes of data and then receives about a hundred bytes in response. The very simple propeller tester that just fakes its return data wasn't responding to the queries from the computer so I have done some testing today and have found that it is incorrectly receiving bytes with a value greater than 126 (it would be easier to understand if it were greater than 127...) I query the processor with (255)(data1)(data2)(data3). It is missing the 255 for some reason.
Here is a list of values
I send --- Propeller sees
127 --- 166
128 --- 199
129 --- 252
130 --- 233
131 --- 226
132 --- 228
133 --- 224
Here is the test code that I have used to determine these values:
SERIAL.Start(31,30,0,115200) repeat temp := SERIAL.rx serial.tx(temp) ' send the same value right back hundreds := temp / 100 temp := temp - (hundreds * 100) tens := temp / 10 temp := temp - (tens * 10) oness := temp serial.tx(hundreds + 48) ' + 48 to turn the numeric value into an ASCII character for that value serial.tx(tens + 48) serial.tx(oness + 48)
Maybe the issue is my command of spin? I have spent most of my time working in propeller assembly. I can't see any rhyme or reason for the changes in the bit pattern for the improperly received bytes.
Comments
Never mind I see it now...
I've not heard of problems at 115200 baud, but I'm sure Mike knows better...
What are you using for a crystal? What is your PLL setting?
Maybe you don't have a high enough clock frequency?
see attachment
I tried a different computer with Windows 7 instead of Vista. Same result.
I tried running the code that Stefan posted. Same result...
I haven't had a chance to take a look at things on my oscilloscope. Maybe that will help sort things out.
How did you send your bytes to the PPDB Stefan? I am holding down Alt and then typing the ASCII code on the numeric key pad to generate my bytes. The Propeller Serial Terminal is showing the correct characters (according to asciitable.com) so I am assuming that the proper characters are being sent.
catched it.
I just typed the characters themselves on the keyboard.
I tried your method and get the same results as you
example Alt-130 prop echoes back 233.
So simply try typing the letters directly
anyway thank you very much for posting this question. It shows perfectly that every dammed detail is important.
Some general advice:
for narrowing down a problem divide the whole thing into small parts
one part: what does PST.EXE send?
This question can be answered through making a loop-back connection. Means connect Tx and Rx directly together that each byte gets echoed back to PST.EXE
With doing this you would have found the same result Alt-130 = 233 but now knowing the problem is caused by PST.EXE, because nothing else than PST.EXE was involved using the direct loop-back.
This was standard-checking for me when setting up a new PC for industrial controls.
From your own tests you can conclude. It's not the PC it's not the OS, it's not the RS232-Chip
it's not the USB-serial adapater as you changed all these. So what could it be then?
The PC-software itself or the propeller-code. Propeller-code can be excluded as my code worked
on my PPDB. What stays left? PST.EXE when creating the characters through ALT-#
best regards
Stefan
Instead of ALT 130, try ALT 0130 and see what happens (i.e., add a leading zero). If the result isn't any different, then I expect that Windows is doing some sort of additional interpretation of what you're typing.
schill is right, you need to put a zero first...