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 Well-Known Member

    Feb 13, 2012
    1,208
    38
    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
    10,136
    1,786
    It should be possible regardless of how the receiver is implemented in firmware.
     
  3. bug13

    Thread Starter Well-Known Member

    Feb 13, 2012
    1,208
    38
    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 Well-Known Member

    Feb 13, 2012
    1,208
    38
    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
    10,136
    1,786
    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,674
    2,717
    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...