What's the Goal?
Trying to get two esp32's to communicate over their UART lines using RS-232.
My initial inspiration and idea for the connections was based on https://esp32io.com/tutorials/esp32-rs232
Devices / Setups
I have two ESP 32 devices and I have connected them over their UARTs with basic dupont jumpers. Successful communication - no problem!
I have next taken the same esp32 devices and then instead I have inserted RS-422 to TTL adapters and communication continues to flow perfectly!
I've then done the same with RS-485 to TTL adapters and all is well also with communication flowing in both directions!
The Challenge
I have the same ESP32's but am now using rs232 adapters. There's no communication going whatsoever apart from what 'appears' to be line noise...garbled chars like "0xFE', etc.
Steps
I have validated and verified that the TTL to RS232 adapters actually work by connecting them with DB9 serial cables to a PC (instead of using a USB cable) and seeing the REPL on both of them with my IDE, Thonny.
Now, I then use one of the same good cables to connect the RS-232/TTL adapters and the esp32s (on GPIO 13 and 14) and connect them back to USB power. But there's still no communication.
In terms of the physical setup it looks like this:
Each esp32 connects to the RS-232 with TX->TX, RX->RX and shares GND w/the module. Each module is powered independently (also tried sharing the same rail) with 5V rails. I put 14 millamps of current to the modules - I thought maybe there was not enough current to them so I tried various values.
I believe I have enough power going to each of the max 3232 modules as it appears the data sheet says it needs somewhere between 3 to 5 volts and seems like up to 20 mA should be fine. Not really sure what to try next. Any thoughts?
Update w/TX->TX
To share an update, I set RX->RX and TX-TX from each esp32 to the RS-232 modules. That did not correct the problem. I then also removed the cable and just have a gender changer. That did not correct the problem.
Code Snippet
NOTE these are esp32 with PSIRAM, so since I am using usb I am rerouting the UART to UART2 to avoid GPIO pin conflicts:
(Just a simple send or receive where appropriate)
uart = machine.UART(2, baudrate=115200, tx=13, rx=14)
#Have tried all the major baud rates...
uart.write(f"{str(time.localtime())}\n")
OR
uart.readline()
Power
Why are modules powered separately, and from where? The reason I am using separate power supplies is the I measured only 1.2 V from the 5V/GND on each esp32. I thought it should give 5V but since I am also doubting everything, I wanted to ensure proper power to the modules. They are both either USB wall plugs that are connected to little USB C converter to red/black cables or wall plug w/barrel adapter/term block - again w/red/black cables plugged into the breadboard.
Everything else worked perfectly -- and honestly speaking -- there seems to be lots of different opinions on what the 5V pin is capable of.
Pic (hope it helps)
Final Solution
As kruemi succinctly mentioned a null modem cable was required. I thought the cable I had was that.
- Esp32 TX (GPIOs remapped above) to TX of each module .
- Connect each module to it's own USB 5V power supply.
- Each module shares ground with attached esp32 only.