View previous topic :: View next topic |
Author |
Message |
BLL
Joined: 11 Nov 2006 Posts: 181 Location: Birmingham, UK
|
Serial port woes |
Posted: Sat Sep 10, 2016 10:01 am |
|
|
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
|
|
Posted: Sat Sep 10, 2016 10:21 am |
|
|
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
|
|
|
BLL
Joined: 11 Nov 2006 Posts: 181 Location: Birmingham, UK
|
|
Posted: Sat Sep 10, 2016 12:36 pm |
|
|
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
|
|
Posted: Sat Sep 10, 2016 3:07 pm |
|
|
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
|
|
Posted: Sun Sep 11, 2016 8:44 am |
|
|
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
|
|
Posted: Sun Sep 11, 2016 1:21 pm |
|
|
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
|
|
Posted: Sun Sep 11, 2016 2:50 pm |
|
|
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
|
|
Posted: Sun Sep 11, 2016 6:18 pm |
|
|
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 |
|
|
|