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

Serial port woes

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



Joined: 11 Nov 2006
Posts: 181
Location: Birmingham, UK

View user's profile Send private message

Serial port woes
PostPosted: Sat Sep 10, 2016 10:01 am     Reply with quote

Hi
I am experiencing very strange behaviour with an 18LF4620 on 5V.
I am using the h/w uart feeding a USB to serial converter at 9600Bd
If I plug the USB/serial adaptor into my PC and use Teraterm, all is well.
If I use putty, I get no comms at all, even though the settings are correct.
I have tried both an FTDI device and a pl2303 device and both behave exactly the same.
For hardware, I use a potential divider off the pic TX pin (10K and 18K in series to ground) to reduce the 5V to about 3V as the adaptors are specified as ttl 3.3V.
Since all is fine with Teraterm, that seems to eliminate hardware problems.
I just don't know what to try next!
Any ideas please?
Brian
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Sep 10, 2016 10:21 am     Reply with quote

Well it sure sounds like a 'putty' problem...as the same hardware works fine with terraterm.

1) Have you just used a 'loopback' wire on the TTL side of the USB<>TTL module to confirm the PC and 'putty' are OK?

2) I've never needed extra resistors on any of the USB<>TTL modules, they all work at 5 or 3 volts. These are $2 units and they've all worked...

3) I use 'RealTerm' for my terminal program, perhaps try it ??

Jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Sep 10, 2016 10:40 am     Reply with quote

Your complaint is that Putty won't work but TeraTerm does. This is
basically a Google question. Go to the Windows Device Manager and
see what COM port number is assigned to your converter cable.
Then enter it in the appropriate box. Help for both terminal programs:
http://www.microsemi.com/document-portal/doc_view/130815-configuring-serial-terminal-emulation-programs
BLL



Joined: 11 Nov 2006
Posts: 181
Location: Birmingham, UK

View user's profile Send private message

PostPosted: Sat Sep 10, 2016 12:36 pm     Reply with quote

Hi both
Thanks for the replies.
What I am trying to find is a logical explanation as to what the problem is.
Unfortunately, it is not just putty.
My PIC board is destined to communicate with a program I have written under lazarus on the RasPi model 3. It doesn't talk to it, nor does it talk to putty on the RasPi.
It does talk to Teraterm on my Windows 10 PC, but not to putty. It also talks to a program I wrote in C++.
Since it can talk to these 2 programs, that suggests that the hardware is fine and the PIC software is fine. I have used putty many times and know how to set it up. Yes, I am using the right port on the PC. Yes, loopback is fine, suggesting a PIC problem, but Teraterm works fine!
That is my problem, there seems NO logical explanation for the symptoms. That is why I am tearing out what little hair I have left!!
I did try bypassing the resistive divider and that made no difference with either the FTDI or pl2303 device.

Brian
BLL



Joined: 11 Nov 2006
Posts: 181
Location: Birmingham, UK

View user's profile Send private message

PostPosted: Sat Sep 10, 2016 3:07 pm     Reply with quote

Hi both
I have made some progress - it isn't a hardware fault.
I can get putty to work on both Windows and on linux by doing the following:

PuTTY has a setting for "Implicit CR in every LF" in the "Terminal" panel.
If you set that (and don't mind hitting CTRL/J rather than Enter),
that could work.

Well, it does.

My lazarus program adds a sLineBreak to a string before sending it, but this doesn't do it. I understood that only Windows used CR+LF, whereas linux uses just LF, so I am surprised that ctrl-J works in putty under linux.

I have now replaced slLineBreak with #10#13 and my program now talks to the PIC.

I am still not sure why this is necessary under linux, but my head hurts!

Brian
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sun Sep 11, 2016 8:44 am     Reply with quote

check this link: heading REPRESENTATIONS

https://en.wikipedia.org/wiki/Newline

I've used a naked CR for many years -
and since my designs are always meant to be connected
to a computer - with an application specific program receiving PIC data-
have never had a problem. I DO however "swallow" LF's in my command input
buffer parser and use CR exclusively as the EOL character. Just in case....

if you don't know what expectations your PC program has- it is easy enough to tag lines with \r\n
BLL



Joined: 11 Nov 2006
Posts: 181
Location: Birmingham, UK

View user's profile Send private message

PostPosted: Sun Sep 11, 2016 1:21 pm     Reply with quote

Hi, Thanks for the reply. I have read your link with interest. A shame that different operating systems have different views. CR+LF makes perfect sense as it ties in well with the actions of the old mechanical beasts.
Putty's ctrl-J seems very obscure, compared with Teraterm's menu setting.
Main thing, all is now working fine.
Thanks all for the help.

Brian
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Sep 11, 2016 2:50 pm     Reply with quote

glad all is good....

CR+LF makes perfect sense as it ties in well with the actions of the old mechanical beasts.

yeah like the ARS33s I used to keep running in the steel mill....
110 baud, all caps, paper tape reader/punches.

hmmm wonder how many KNOW what a paper tape reader looks like !

Jay
drolleman



Joined: 03 Feb 2011
Posts: 116

View user's profile Send private message

PostPosted: Sun Sep 11, 2016 6:18 pm     Reply with quote

I do an 800bpi 9 track tape drives with a storage of 20MB. Then we upgraded to a 1600/6250 drive that cost $70,000 in 1983. That increased the storage to 150MB per 2400' tape.

Dec pdp11/10 with a whopping 8kb core memory. and having to fix the cpu board not a chip! Then upgrading to pdp 11/04, the cpu was still a board. But they were very reliable.

Wow showing age!

dave
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