CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC serial switching off!

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
stma



Joined: 16 Feb 2004
Posts: 26

View user's profile Send private message

PIC serial switching off!
PostPosted: Wed Oct 31, 2007 7:22 am     Reply with quote

Hi,
I have a board which uses pinsB6 and B7 as a serial port connected via 1k resistors to a PC. Never have any problems with it receiving or sending data.
It is a data logger for want of a better word (it does have other jobs). It reads in data, transmits it to the serial port and also stores it on an I2C eeprom. This is done under interrupt from an external trigger. Otherwise the PIC is asleep (@sleep)
Occasionally after a while the PIC will stop sending data to the serial port although it does send to the eeprom as normal.
The only thing I do on programming is disable the brownout (as it is a 3.3v device).
Any ideas why this may happen with not showing the serial data but still writes to eeprom?
Thanks in advance
Steve
Edit/Delete Message
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Wed Oct 31, 2007 7:41 am     Reply with quote

Need to see some code + info on how the PC is recieving the data. Are you sure it is the PIC NOT sending it ?
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Oct 31, 2007 8:12 am     Reply with quote

If the PIC goes to sleep while the UART still has data to send the data may not get sent. Might this be your problem.
_________________
The search for better is endless. Instead simply find very good and get the job done.
stma



Joined: 16 Feb 2004
Posts: 26

View user's profile Send private message

PostPosted: Wed Oct 31, 2007 8:39 am     Reply with quote

Interesting thought. As the data is sent to the EEPROM first then outputted serially ( just using printf) then goes straight to sleep.
The PC just uses any terminal program.
Thanks for the help
Steve
Ttelmah
Guest







PostPosted: Wed Oct 31, 2007 10:22 am     Reply with quote

Seriously, resistor serial connections, are not 'nice'. The _minimum_ voltage warranted as a 'space' in RS232, is 3v, into 3KR. With a chip at 3.3v, and 1KR serial resistors, you are only going to be generating about 2.5V. I'd suspect you are just running into your serial connection being occassionally unreliable. Possibly something simple like temperature affecting the input range of the receive buffer.
Try the test, of adding a proper RS232 buffer external to the board, and removing the invert in the RS232 definition, and see if the problem disappears.
Also, there is a good chance that the PIC is actually running off more than 3.3v at times, if the receive serial line is driving (high), with 1KR, unless there are other loads on the PIC's supply rail, it may well be being raised by quite a few hundred mV, by the current from the PC's RS232.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 31, 2007 11:59 am     Reply with quote

Quote:

I have a board which uses pinsB6 and B7 as a serial port connected
via 1k resistors to a PC

The 'standard' way of doing the cheap RS232 connection is by putting
a 22K series resistor on the Rx pin of the PIC. Don't put any resistor
on the Tx pin of the PIC.

The 22K resistor limits the current going into the protection diodes on
the Rx pin of the PIC when the RS232 signal from the PC swings between
+10v and -10v.

The Tx pin of the PIC doesn't need a series resistor because it's just
driving the input pin of an MAX232-equivalent chip in the PC. That
input only has a 5K pull-down on it. So there's no voltage on it that
could damage the PIC's Tx pin.

You need to use a software UART with the INVERT option when you do
this.
stma



Joined: 16 Feb 2004
Posts: 26

View user's profile Send private message

PostPosted: Thu Nov 01, 2007 1:45 am     Reply with quote

Thanks for all the help. Im convinced there is the solution in there.
I never liked the cheap serial port myself and all future versions include a 'proper' rs232 chip.
Thanks again, much appreciated
Steve
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group