View previous topic :: View next topic |
Author |
Message |
ktallevi
Joined: 17 Dec 2005 Posts: 58
|
Using a phono cable for serial data, PIC freezing |
Posted: Tue Oct 09, 2007 4:33 pm |
|
|
Im using a PIC18 to interface with a serial device that uses a phono cable for its serial interface. Im finding sometimes when the phono cable is inserted or removed it causes the PIC to freeze.
I imagine it is due to a momentary shorting of the 2 TX outputs, which idle at 3.3 volts. I also find sometimes instead of freezing the PIC, it will just cause the serial port on the PIC to not respond to any incoming data until it is reset.
This posting is probably not software or CCS related but I thought someone in here might have an idea. The TX/RX pins are connected directly to the female phono jack, no additional components. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 09, 2007 6:31 pm |
|
|
Add the ERRORS parameter to your #use rs232 statement. This will
clear any error conditions that could cause the UART to lock up. |
|
|
ktallevi
Joined: 17 Dec 2005 Posts: 58
|
|
Posted: Tue Oct 09, 2007 6:43 pm |
|
|
ERRORS is already defined, the PIC is in sleep mode (external XTAL disabled), until there it has been woken up by incoming serial data.
Perhaps enabling a very short watchdog timer could provide a partial solution. The WDT would start up upon 'waking up', and expire if no real serial data has come in... of course reset the watchdog if usable data comes in..
what do you think? |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Tue Oct 09, 2007 7:41 pm |
|
|
Could the problem be ESD (static electricity)? That could disrupt the PIC hardware in ways that only a reset or power cycle could recover from. Try adding some series resistance between the PIC and connector, and some capacitance on the PIC pins. Set the RC time constant to about 10% of the serial bit length, so it won't hurt serial comms but will limit and damp the ESD pulse when contact is made. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
|