I am using PIC18F4520. The project requirement is to interface GSM module with uC as well as receive commands from PC via serial port.

to achieve this I have connected Microcontroller- TX to GSM module- RX, as GSM module is used just for sending SMS. It is working OK with this connection.(this connection is on TTL level.)

but i want to receive command from PC , so I have connected PC- TX to uC -RX (this connection is through MAX232). when i connect PC-TX to uC-RX the serial terminal s/w (PC) shows garbage values on RX, and uC also receives garbage values (As I am not sending anything but still Receive interrupt routines gets called continuously ) . there is no issue in program.

but meanwhile the GSM module working fine.

Do i need to terminate the TX line? I am using just 2 wire serial cable for connection to PC.

Thank You

  • \$\begingroup\$ Does that 2-wire serial cable to the PC carry ground? \$\endgroup\$ Commented Apr 8, 2016 at 19:23
  • \$\begingroup\$ yes! Ground and signal wire \$\endgroup\$ Commented Apr 8, 2016 at 19:24
  • 3
    \$\begingroup\$ This sounds very much like you have the wrong baud rate. A few devices can probably have distinct transmit and receive baud rates, but many cannot. So you should probably set the PC to talk at the same baud rate as the GSM module to simplify things for your "split" UART. Beware that operating the GSM module "one way" may not be wise - without receiving and parsing its responses you won't know if it is accepting your commands or even registered on the network. Though if the system is unattended there may not be a lot you can do in that case, except perhaps eventually resetting the GSM module. \$\endgroup\$ Commented Apr 8, 2016 at 19:52
  • \$\begingroup\$ Let me understand: Did you connect BOTH the GSM module's TX and RX pins to the PIC's RX and TX respectively? What baud rate are you using for this communication b/w PIC and GSM module? Did you simultaneously connect the PC's TX and/or RX to the PIC's RX and/or TX respectively, while the PIC is connected to the GSM module? This is wrong. If you didnt, then what baud rate is used between PC and PIC? Also provide any code you have written, as well as schematic. \$\endgroup\$ Commented Apr 8, 2016 at 22:21
  • \$\begingroup\$ The PC will obviously show junk at its RX cos you havent connected uC TX to PC RX. As for your uC not reciving proper data from PC,it has to baud rate mismatch between uC and PC. \$\endgroup\$
    – AlphaGoku
    Commented Apr 18, 2016 at 7:48

2 Answers 2


What you want to do can be done, but there are limitations

1) A uart runs at one speed, so you will have to run RX and TX at the same speed.

2) Make sure the logic levels are compatible.

3) Make sure that both the PC and the GSM have the same uart setup, ie stop bits partity bits ect.

Trouble shoot them one at a time. Note the settings and when you get them both working independently then combine them. I would make life easy on yourself and put them on separate uarts.


THanks all of you for your help. The issue is not of baud rate.

The problem is solved by connecting 10k pullup on RX of PIC.

Sorry for late reply


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.