View previous topic :: View next topic |
Author |
Message |
BLL
Joined: 11 Nov 2006 Posts: 181 Location: Birmingham, UK
|
serial port on 18LF2620 |
Posted: Tue Aug 25, 2015 1:29 pm |
|
|
Hi, I have spent 2 days trying to solve what should be a simple problem and got nowhere! I have an 18LF2620 running on 3.3V. There is a 0.1uF capacitor across pins 19 & 20. I am using the HW uart at 9600,N,8,1. Connected to the uart is a PL2303 USB serial converter. The TX pin, RC6 goes directly to the uart. The RX wire needs its voltage reducing from 5V to 3.3V and I am doing this with a 2K7 to the pin and a 4K7 resistor to ground.
Using the very simple example in the handbook:
Code: |
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)
printf("start"):
while(TRUE)
putc(getc() + 1);
|
I see the word start and then if I press a letter, say a, I get not one but an infinite numbers of b's which you can only stop by turning the PIC off! The circuit is correct. I have tried more than 1 pic, more than 1 USB-serial lead, more than 1 terminal and more than 1 PC and always the same!!
I have used this PIC before with its serial port and no problems.
I have run out of ideas - can anyone help please?
Thanks
Brian |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Tue Aug 25, 2015 2:08 pm |
|
|
The voltage level that the PL2303 requires on it's input, to be seen as a logic '1', depends on the voltage on it's Vdd_325 pin. What is on this pin on the board you are using?. |
|
|
BLL
Joined: 11 Nov 2006 Posts: 181 Location: Birmingham, UK
|
18LF2620 |
Posted: Tue Aug 25, 2015 2:55 pm |
|
|
Thanks for the reply.
As the PIC power rail is 3.3V, the TX pin rises pretty much to this value, which should easily be seen as logic 1 on the 2303's 5V circuitry.
I have also checked that 5V from the 2303 TX line is giving me 3.1V at the pic pin. |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Tue Aug 25, 2015 4:47 pm |
|
|
Hi,
All these 'hardware interface' type questions should always include a link to the hardware in question, so we can look at the datasheet! _________________ John
If it's worth doing, it's worth doing in real hardware! |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Tue Aug 25, 2015 7:27 pm |
|
|
Watch out for cheap clone of PL2303 (ebay) I've seen official drivers from Prolific (detecting fake chip) playing with the data on the usb com port.
Be extremely careful... I trashed all my PL2303 recently because of this and went with genuine (yes the one at 20$ each) FTDI FT232R cables.
Btw, PL2303 is a bad choice for long term solution... it's discontinued and last driver update is from 2007 and doesn't support anything newer than windows 7.
Think twice about using it in any production boards. _________________ Regards,
Laurent
-----------
Here's my first visual theme for the CCS C Compiler. Enjoy! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Wed Aug 26, 2015 4:35 am |
|
|
Also, the point is that the serial I/O on this chip is _not_ 5v. It is determined by the voltage on the Vdd_325 pin. The chip is a multi voltage chip. It uses a 5v main supply, then has it's own internal 3.3v regulator that drives some parts, and I/O circuitry that can be fed off this, or off another supply. |
|
|
|