Author Topic: [SOLVED] RX & TX are confusing :(  (Read 3695 times)

0 Members and 1 Guest are viewing this topic.

Offline Sudo_apt-get_install_yumTopic starter

  • Regular Contributor
  • *
  • Posts: 165
  • Country: se
[SOLVED] RX & TX are confusing :(
« on: March 12, 2019, 08:12:28 am »
Hey all this is a quick and simple question!

So I’m trying to communicate with a device over RS232 but the simplified schematic is confusing me.

The image below is from the simplified schematic.
It clearly shows that

MCU --   Device
RXD <-- RX
TXD --> TX



Pin description

MCU
"RXD0: Receive Data (Data input pin for the USART0)"
"TXD0: Transmit Data (Data output pin for the USART0)"


Device
"RX, receive data output to the local controller"
"TX, transmit data input from the local controller"


So by reading the pin descriptions I think that RXD0 should connect to TX and TXD0 should be connected to RX

Is the simplified schematic wrong or am I thinking wrong?
« Last Edit: March 12, 2019, 09:10:15 am by Sudo_apt-get_install_yum »
 

Offline Arznei

  • Contributor
  • Posts: 32
  • Country: de
Re: RX & TX are confusing :(
« Reply #1 on: March 12, 2019, 09:04:28 am »
The shown schematic seems to be correct. The devices RX pin is described as "receive data output" while the MCUs RX pin is described as "data input".

This is a bit confusing, because the devices "RX" pin is actually its sending pin, but they labeled it RX in the sense of "connect your MCUs RX pin here".
« Last Edit: March 12, 2019, 09:06:02 am by Arznei »
 
The following users thanked this post: Sudo_apt-get_install_yum

Offline lordium

  • Regular Contributor
  • *
  • Posts: 62
  • Country: cn
Re: [SOLVED] RX & TX are confusing :(
« Reply #2 on: March 12, 2019, 09:53:39 am »
Usually like this:

DTE1 <-> DCE1 <======> DCE2 <-> DTE2

Usually goes like this, DTE is computer/mcu and DCE is the modem/transceiver. Computer talk to modem, which talks to another modem though some cable, which talk to another computer. On both sides you connect TX from DTE to TX on DCE. It's a little counter intuitive, unless you remember that TX and RX are specified from the terminal equipment side. TX to RX when you want to bypass the DCE and connect DTE1 to DTE2 directly. Probably lots of exceptions to this, but this is how I think of it.

(PS it's usually a DE9 connector, not a DB9! for rs232)

https://en.wikipedia.org/wiki/RS-232
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9933
  • Country: us
Re: [SOLVED] RX & TX are confusing :(
« Reply #3 on: March 12, 2019, 02:23:12 pm »
It is confusing.  I usually look very carefully at the pin descriptions for words like 'input' and 'output'.  I hook the 'input' of one to the 'output' of the other and pretty much ignore the symbols Rx and Tx.  It get problematic on intermediate devices like USB->RS232 adapters.
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2287
  • Country: ca
Re: [SOLVED] RX & TX are confusing :(
« Reply #4 on: March 12, 2019, 03:00:43 pm »
You need to convince yourself that Rx or Tx (and variants like RXD, TXD) are signal names, rather than indicating direction of data flow. The descriptions of the pins in that you quoted do indicate direction by the use of the words input and output. An output generally connects to an input.

When you connect an SPI "slave" and a "master" device together, you connect the MISO pins of the two devices together, likewise the MOSI pins together, and same again for the CLK. On one of those devices, each of those is an input and on the other, an output (e.g. MISO is an input on the master device and an output on the slave).

Usually, when connecting a UART type perhipheral to a microcontroller (etc.), you likewise need to match signal names, so RX to RX and TX to TX. This moves the "TX" data from one device to the other. The exception is when connecting two peer devices together (e.g. the UART Tx/Rx pins of two microcontrollers so they can talk to each other). Think about why.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9933
  • Country: us
Re: [SOLVED] RX & TX are confusing :(
« Reply #5 on: March 12, 2019, 03:53:04 pm »
Sometimes it is so confusing that I use a scope to find out which pins send data.  At the output side of a USB->Serial gadget, I use something like TeraTerm to send data continuously while I watch the pins.  Same thing on the microcontroller end, I write a little code to continuously send data.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf