Trouble with RS-232 BS2px on Professional Development board.
Firestone1
Posts: 5
Hi.
This is my first post on this forum, but i have been looking for a while.
Im trying to send commands to a external modem using serin, serout through the extra rs232 port om pro development board.
The problem is that its not reliable. Some times it working fine and sometimes i get what looks like the signal out of sync.
I've tried everything I can think of now. Switching powersupplies, cables, extra grounding etc.
I have stripped the code for everything, without success.
This is what debugwindow should look like and some times it does:
+IPR: (0,300,1200,2400,4800,9600,19200,38400,57600,115200)
OK
But most of the time it looks like:
Hh) bš‚‚bŠ’‚‚b
’¢‚‚b¢Â‚‚bʲ‚‚bŠÊ’‚‚bšÂ¢‚‚bªº²‚‚bŠŠª’‚‚Jj
OK
... The strange thing is that its not garbage. when it dont work it always looks like this. Also that OK at the end always is correct.
I have set the modem to Fixed 1200 baudrate and flowcontrol off. I've also tried flowcontrol RTS/CTR But with the same result.
I've tried autobaud.. I've tried other speeds, 2400 always produce garbage, 9600 dont seem to work at all.
When connecting the modem to a computer using hyperterminal everything works perfect.
Code:
Does anyone have an idea? Is the goto command to slow even for 1200 baud? Why does it works sometimes..
Please anyone, help!
Modem type is: GPRS Terminal Modem, Ter-gx101 S from Round Solutions.
/ Rickard
This is my first post on this forum, but i have been looking for a while.
Im trying to send commands to a external modem using serin, serout through the extra rs232 port om pro development board.
The problem is that its not reliable. Some times it working fine and sometimes i get what looks like the signal out of sync.
I've tried everything I can think of now. Switching powersupplies, cables, extra grounding etc.
I have stripped the code for everything, without success.
This is what debugwindow should look like and some times it does:
+IPR: (0,300,1200,2400,4800,9600,19200,38400,57600,115200)
OK
But most of the time it looks like:
Hh) bš‚‚bŠ’‚‚b
’¢‚‚b¢Â‚‚bʲ‚‚bŠÊ’‚‚bšÂ¢‚‚bªº²‚‚bŠŠª’‚‚Jj
OK
... The strange thing is that its not garbage. when it dont work it always looks like this. Also that OK at the end always is correct.
I have set the modem to Fixed 1200 baudrate and flowcontrol off. I've also tried flowcontrol RTS/CTR But with the same result.
I've tried autobaud.. I've tried other speeds, 2400 always produce garbage, 9600 dont seem to work at all.
When connecting the modem to a computer using hyperterminal everything works perfect.
Code:
' {$STAMP BS2px} ' {$PBASIC 2.5} test VAR Byte start: PAUSE 3000 SEROUT 14, 3313, [noparse][[/noparse]"AT+IPR=?", CR, LF ] main: SERIN 12, 3313,[noparse][[/noparse]test] DEBUG test GOTO main
Does anyone have an idea? Is the goto command to slow even for 1200 baud? Why does it works sometimes..
Please anyone, help!
Modem type is: GPRS Terminal Modem, Ter-gx101 S from Round Solutions.
/ Rickard
Comments
You are sending the command once, then fetching the reply once. That apears to work okay, but then you go back to re-fetch the reply again and again, without issuing another command. Is that what you really want to be doing. or do you want to send the command, receive a reply, and then go back and repeat the ENTIRE process? If so, the last instruction should be GOTO Start, not GOTO Main.
Regards,
Bruce Bates
You might want to add a Conditional Compilation block to set the baudmode as well -- this will make it easier to experiment with different baud rates and ensure you get the right values in the program.· I've attached a StampWorks 2 program that uses the external serial port on the PDB (with flow control).· It has a CC block that you can paste write into your program.
In the end, you might end up with something like this:
· SERIN Rx, Baud, (SPSTR 58)··· ' capture 58 characters from modem
· FOR idx = 0 TO 57·············' display capture
··· GET idx, char
··· DEBUG char
· NEXT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Bruce: Yes I know. This was just a test loop but thanks for the note. I have restarted the program for every run.
Jon:·Many thanks for the tip.·I'll try that and see what I get. (Its 9pm here in sweden and I have promised my family some really late dinner..:-))
I'll get back...
/Rickard
I thougt I noticed a change when I hade the board turned off for a while. Then I got three correct answers in a row before getting a wrong one. It's like the stamp doesn't get the first bit and then go wild for a while. Then there is a small break before the modem writes OK and the stamp have time to catch up.
Can I in some way se if the flowcontrol works as it should? I cant see any kind of difference.
Wrote the output in hex to see if it is a bit swap of some kind but I haven't found a pattern yet anyway..
Faulty:
48 68 29 A 25 A5 2 42 82 62 9A 82 82 62 8A 92 82 82 62 92 A2 82 82 62 A2 C2
82 82 62 CA B2 82 82 62 8A CA 92 82 82 62 9A C2 A2 82 82 62 AA BA B2 82 82 6
2 8A 8A AA 92 82 82 4A 6A A
Correct:
A 2B 49 50 52 3A 20 28 30 2C 33 30 30 2C 31 32 30 30 2C 32 34 30 30 2C 34 38
30 30 2C 39 36 30 30 2C 31 39 32 30 30 2C 33 38 34 30 30 2C 35 37 36 30 30
2C 31 31 35 32 30 30 29 D A
As usual I thougt this should be the easy part...
/Rickard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Tried both Low CTS and HIGH CTS and in combination both directions to se if the modem doesn't understand. Nothing worked. Also if I take the comment away for the pause after serout it never works. Shouldn't that work if CTS works as it should. I will take my ocilloscope at work and look whats really happens on the serial port. My guess is that something is broken. I still also have a feeling that it works better when the board have been switched of for a while. I really dont like that kind of symptoms.
I also dont like that the manual states that the modem pauses 100ms before returning response for almost every command.
As you can se I switched to 7E1 to se if that helped, I was told that parity would be more reliable. Yea, right..
Many, many thanks for the help so far. I really apprichiate the rapid response. Sorry for the sometimes bad english.
// Rickard
Problem solved.
As always its some kind of not understanding whats happening. In this case the modem had a "local echo" Doesn't all modems?
When I switched that of, it all started to work correctly. (ATE0)
So now you know.
Best regards
Rickard