Page 1 of 1

RS-232 Modules are not working with ESP32's

Posted: Fri May 31, 2024 3:42 am
by modulusmath
Howdy,

Hello I have two ESP 32 devices and I have successfully connected them to communicate over UARTs using the standard TTL interface with basic dupont jumpers. :D

I have next taken the same esp32 devices and then instead I have inserted rs422 to TTL adapters and communication continues to flow perfectly. :D

I've then done the same with rs485 to TTL adapters and all is well also with communication flowing in both directions. :D

The challenge I'm having now is that I have the same ESP32's but am now using rs232 adapters. There's no communication going whatsoever. :oops: , I do see what 'appears' to be line noise...garbled chars like "0xFE', etc.

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.

I then used the same good cable to connect to esp32s 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?
PXL_20240531_033215447.jpg
PXL_20240531_033215447.jpg (1.08 MiB) Viewed 2327 times

Re: RS-232 Modules are not working with ESP32's

Posted: Fri May 31, 2024 9:10 am
by ESP_krzychb
Howdy,
The brown wire on the left is connected to the blue bus on the breadboard and looks like ground. I do not see it connected to any other ground. The blue buses on the breadboard are not connected to each other.

Re: RS-232 Modules are not working with ESP32's

Posted: Fri May 31, 2024 5:14 pm
by modulusmath
You are correct. I fixed that! I think the problem is because I am not using a null cable. I just bought one and will update once it arrives. Thanks!

Re: RS-232 Modules are not working with ESP32's

Posted: Sun Jun 02, 2024 3:41 am
by modulusmath
modulusmath wrote:
Fri May 31, 2024 5:14 pm
You are correct. I fixed that! I think the problem is because I am not using a null cable. I just bought one and will update once it arrives. Thanks!
A null modem cable was required. I thought the cable I had was that.

To recap:

- 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.
ard1.jpg
ard1.jpg (906.83 KiB) Viewed 2070 times

Re: RS-232 Modules are not working with ESP32's

Posted: Sun Jun 09, 2024 11:19 am
by RandomInternetGuy
Congrats.

Board convention is to change your subject to include "Solved:" as you see on other posts.

It's late now, but here's a helpful tip when debugging 232 connections and trying to figure out if you need to introduce a RX/TX flip (the "null modem") of if cabling has already done so for you.

Whip out your meter and note the voltage on the tx and rx pins on each side. No matter what you THINK is RX and TX, the TX pin will have a fixed voltage present where it's driving the pin in a MARK (idle) state. The RX pin is in INPUT to the device and will thus present no voltage.

This means if you're connecting two identical (or identical enough) voltages, they can't both be listening on one pin and both be sending on the other. One flip needs to be introduced. Once you do this, you should be able to see about the same voltage on both pins as both will be mostly in the idle state - and there's so much idle time on the line that even if you were saturating a connection at 115200bps, you'd _still_ see that pin look mostly idle, but still a distinctively different voltage than the near-zero of a floating input.

This is a trick we learned back when LED cable testers were part of every tech's toolbox
https://www.amazon.com/dp/B07KVFX5FH/
..and we all carried both adapters to do the flipping for us if there were control signals that also needed flipping and pin extraction/insertion tools for moving the pins inside the shell without resoldering them. The TX and RX colors should be mostly the same. If either is OFF, but the same pin is on each side tested in isolation, you need some null modem action.

Of course, if NEITHER RX nor TX lights up on one end, it's broken. In the days of 1488/1489 line drivers and receivers, they were the usual suspect, but these days when we're moving 232 signals 10cm instead of 100M, additional drivers and receivers and swing up to 12 or even 24V are rather less common.

Do this now, with your working circuit, as a skill builder. Never again be trapped by what you THINK about a cable setup when you can confidently KNOW.

Enjoy.