View previous topic :: View next topic |
Author |
Message |
runtime
Joined: 15 Sep 2003 Posts: 36
|
How to send a "BREAK" to a modem? |
Posted: Wed Sep 15, 2004 8:45 am |
|
|
Hello,
I'm using a PIC18F252 interfaced to a Wavecom modem (GSM/GPRS), I'm only using the TX, RX and GND (RS232) pins of the modem to comunicate with the PIC. Sometimes the PIC looses comunication with the modem, maybe because I'm using software uart or maybe because the other pins are not used (CTS, RTS, DTR, DSR).
Anyway, I put a check subroutine that will check if communication is ok every minute sending an AT command to the modem, if it responds OK then everything is working well, otherwise I want to send a BREAK to the modem to reset the TX and RX lines...
Hope is clear enough.
Thank you in advance
Peter |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Sep 15, 2004 8:54 am |
|
|
As <break> is not an ASCII character you will have to bit-bang it. Between chars the line should be at Stop bit level. Set it to Start bit level for 10ms (IIRC) and then back to Stop bit level. That is all there is to it. _________________ The search for better is endless. Instead simply find very good and get the job done.
Last edited by SherpaDoug on Wed Sep 15, 2004 10:05 am; edited 1 time in total |
|
|
runtime
Joined: 15 Sep 2003 Posts: 36
|
|
Posted: Wed Sep 15, 2004 9:06 am |
|
|
hello SherpaDoug,
what do you mean for "Stop bit level" and "Start bit level", and what line should I use, TX or RX?
Thanx |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Sep 15, 2004 9:27 am |
|
|
You are sending the <break> to the modem so you would use the TX line. Normally Start is a logic 0 and Stop is a logic 1, unless you are using the "invert" software UART option option. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
runtime
Joined: 15 Sep 2003 Posts: 36
|
|
Posted: Wed Sep 15, 2004 10:04 am |
|
|
Hi SherpaDoug,
you said "Between chars the line should be at Stop bit level. Set it to Start bit level for 10ms (IIRC) and then back to Start bit level. That is all there is to it."
should it be: Set it to Start bit level for 10ms (IIRC) and then back to Stop bit level ?
thank you |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Sep 15, 2004 10:06 am |
|
|
Yes, you are right. I corrected my post. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
Guest
|
|
Posted: Wed Sep 15, 2004 11:05 am |
|
|
Don't worry about modem handshake signals.
Just connect pins 7-8 (one short circuit) and 11-12 (another short) (assumed that you use Fastrack series and not the Integra line ). |
|
|
Jeff King
Joined: 20 Oct 2003 Posts: 43 Location: Hillsdale, Michigan USA
|
|
Posted: Wed Sep 15, 2004 4:22 pm |
|
|
You also need to turn the uart off to gain control of the pin, if using a hardware uart. There is a command in CCS to do it or you can do it direct. |
|
|
Kieran
Joined: 28 Nov 2003 Posts: 39 Location: Essex UK
|
|
Posted: Thu Sep 16, 2004 5:17 am |
|
|
How about putc(0xFF); ?
Should send a start followed by stop level for one char duration.
saves the Tx pin bit banging. |
|
|
Ttelmah Guest
|
|
Posted: Thu Sep 16, 2004 5:53 am |
|
|
Kieran wrote: | How about putc(0xFF); ?
Should send a start followed by stop level for one char duration.
saves the Tx pin bit banging. |
A 'break', in the defintions, _must_ last longer than one character time (to avoid it being mistaken for the 'real' character represented by 0xFF).
Potentially, you could send a break (if you were operating at 9600bps), by coding something like:
set_uart_speed(110);
putc(0xFF);
set_uart_speed(9600);
which would potentially result in a 'zero' character being received, followed by a 72mSec 'break', which is enough for some standards (some require 128mSec).
Best Wishes |
|
|
Guest
|
|
Posted: Thu Sep 16, 2004 6:10 am |
|
|
Maybe 0x00 would be better. Sending 0xFF contains only one-bit time of break level (the start bit itself). |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Sep 16, 2004 2:15 pm |
|
|
edit |
|
|
Ttelmah Guest
|
|
Posted: Fri Sep 17, 2004 2:00 am |
|
|
Anonymous wrote: | Maybe 0x00 would be better. Sending 0xFF contains only one-bit time of break level (the start bit itself). |
Aargh!.
I just followed the 'level' suggested by the other poster, and didn't think to check which way the signalling should be...
This actually 'improves' things (since the start bit and data are the same level), and should make this a simple/reliable way to send a stop without having to do bit banging. :-)
Best Wishes |
|
|
|