Can I connect the RX to TX within the same MCU

Discussion in 'General Electronics Chat' started by bug13, Nov 2, 2015.

  1. bug13

    Thread Starter Senior Member

    Feb 13, 2012
    1,257
    41
    Hi guys

    It may sound like a silly question, can I connect the TX and RX (of usart) within the same pic (or other MCUs), and if I send one byte out, I can received the same byte?

    I have tried it, but it doesn't seem to work in my pic18f24j10. my RX is handle in interrupt.

    I have only 0 out, but if I connect my RX to some random signal, I can get some data out.
     
  2. Papabravo

    Expert

    Feb 24, 2006
    11,081
    2,159
    It should be possible regardless of how the receiver is implemented in firmware.
     
  3. bug13

    Thread Starter Senior Member

    Feb 13, 2012
    1,257
    41
    Hmm, I agree with you, as the datasheet says the usart (in asyn mode) is full duplex, but I can't get it to work. :mad:
     
  4. bug13

    Thread Starter Senior Member

    Feb 13, 2012
    1,257
    41
    One thing I need to point out is that I am not using standard baud rate, does it make any different?
     
  5. Papabravo

    Expert

    Feb 24, 2006
    11,081
    2,159
    No that should not make a difference. Of course you should make sure you are actually transmitting before you do the loopback.
     
  6. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,964
    3,790
    Yes. I do this to 'self-check' the comms on some of my products.

    In one case, I have an optical interface. I use a mirror to bounce back a test code...confirming both transmission and reception.
     
Loading...