EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Does a PIC16F628 Serial Port Go To Sleep?

Started by Ike September 27, 2005
Hello!

I am working on an serial RS232 RF link between two PIC16F628's.

The master uses SEROUT to send a serial command such as "*0001-5260*F"
out to the cloud of slaves.  The "*0001-5260*" is the address of one of
the slaves, and the "F" is the command.  The slave with that serial
number responds, receives the string with SERIN, then verifies that the
whole command was read (it must match the master's serial number and
have either an A, B, C, D, E or F after the serial number), then the
slave peels off the "F" which is the command to turn on pin B7 and
turns on pin B7, waits a second, then turns it off.  The slave then
uses SEROUT to echo the command that was received back to the master
with an "OK" appended to the end, so the slave sends the string
"*0003-9659*FOK" (the *0003-9659*" is the address of the master's RF
modem).  The master uses SERIN to receive the "FOK" and knows that the
slave received the command, and if no confirmation is received from the
slave, the master resends the command once more, then gives up if there
is still no response from the slave.

The RF modems are serial RF modems running at 9600 baud, and their
internal sleep and time-out modes have been disabled.

I am using a Max232 to make the PIC's serial signals correct.

I am not using handshaking...just TX and RX.

The problem is that if I send a command to the slave from a terminal
program on my PC, it works great.  But if I wait for 10 or 20 minutes
or so and send the command again, I get garbage echoed back from the
PIC.

If I send the command a second time, it responds correctly, but then
will do the same garbage sthing after another 10 or 20 minutes or so.

I can't figure out why the PIC would spit out garbage characters after
not communicating for a while.

I have the slave flash it's status LED once every 3 seconds, so I can
see that the PIC hasn't crashed.

I even tried having the pic send a character to the RF modem every so
often to see if the serial port or modem was timing out, but the same
thing happened.

Does the PIC's serial circuit time out after a while, or does the
Max232 go to sleep?  What could cause this?

Any ideas?

Thanks!

"Ike" <ikenewton@gmail.com> wrote in message
news:1127816595.285220.168640@z14g2000cwz.googlegroups.com...
> > Hello! > > I am working on an serial RS232 RF link between two PIC16F628's. > > The master uses SEROUT to send a serial command such as "*0001-5260*F" > out to the cloud of slaves. The "*0001-5260*" is the address of one of > the slaves, and the "F" is the command. The slave with that serial > number responds, receives the string with SERIN, then verifies that the > whole command was read (it must match the master's serial number and > have either an A, B, C, D, E or F after the serial number), then the > slave peels off the "F" which is the command to turn on pin B7 and > turns on pin B7, waits a second, then turns it off. The slave then > uses SEROUT to echo the command that was received back to the master > with an "OK" appended to the end, so the slave sends the string > "*0003-9659*FOK" (the *0003-9659*" is the address of the master's RF > modem). The master uses SERIN to receive the "FOK" and knows that the > slave received the command, and if no confirmation is received from the > slave, the master resends the command once more, then gives up if there > is still no response from the slave. > > The RF modems are serial RF modems running at 9600 baud, and their > internal sleep and time-out modes have been disabled. > > I am using a Max232 to make the PIC's serial signals correct. > > I am not using handshaking...just TX and RX. > > The problem is that if I send a command to the slave from a terminal > program on my PC, it works great. But if I wait for 10 or 20 minutes > or so and send the command again, I get garbage echoed back from the > PIC.
Normally, things do not go alseep unless you set the configuration in the PIC to do that. The MAX232 does not go asleep either. The only thin I can think of is garbage received by the master over this long period of time. Meindert
> > I am working on an serial RS232 RF link between two PIC16F628's. >
> The problem is that if I send a command to the slave from a terminal > program on my PC, it works great. But if I wait for 10 or 20 minutes > or so and send the command again, I get garbage echoed back from the > PIC. > > If I send the command a second time, it responds correctly, but then > will do the same garbage sthing after another 10 or 20 minutes or so.
Sounds like niose is comming in the RF link when there is no activity.
Ike wrote:


> I am working on an serial RS232 RF link between two PIC16F628's.
Does the RF link use CRCs to only deliver verified data, or pass through data on a best effort basis?
> The problem is that if I send a command to the slave from a terminal > program on my PC, it works great. But if I wait for 10 or 20 minutes > or so and send the command again, I get garbage echoed back from the > PIC. > > If I send the command a second time, it responds correctly, but then > will do the same garbage sthing after another 10 or 20 minutes or so.
I don't know what your problem is, but I would use a digital scope or serial data analyzer to monitor to links: PIC to modem, modem to PIC. You should be able to find where the problem is occurring. It could be something within the modem. It might have to do with how your slave handles comm noise. Thad

The 2024 Embedded Online Conference