1
\$\begingroup\$

I recently joined a new project where two ESP32-WROOM-32UE modules on separate circuit boards talk to each other via the UART pins. The distance between the two boards is roughly 1 meter of cable apart, so the board designers integrated level shifters on each board to shift the 3.3V ESP32 logic levels to 5V, then back down to 3.3V. Here is the level shifter schematic:

enter image description here

Current values for the resistors are: R5 = R6 = 1K, R7 = R8 = 499K

The problem occurs when the two ESP32 tries to talk to each other. ESP32 #1 is able to receive messages from ESP32 #2 with no issues. ESP32 #2 is not able to receive messages from ESP32 #1. The signal scoped between the two level shifters when ESP #1 is transmitting has a high level of 5V and a low level of 3V (Sorry I forgot to save the plot of the scoped signals).

I have eliminated the possibility that the serial port is incorrectly setup in the firmware, so I think that it is due to the selection of pull-up resistors. I do not have much experience tweaking pull-up resistors for level shifters and would love some assistance. What do I look for in the datasheet to calculate the correct values of the pull-up resistors?

\$\endgroup\$
4
  • \$\begingroup\$ Do the two modules share a common ground? You need three connections between them, ground, Rx and Tx. Also, any reason why you didn't go with R5=R6=R7=R8=10k, like the other side? 10k is a perfectly reasonable value. \$\endgroup\$ Apr 23, 2023 at 2:07
  • \$\begingroup\$ What baud rate you expect to pass? 3 megabauds won't work well anyway, but 9600 might with proper values. The 500k pull-up makes the signal rise time absurdly slow. \$\endgroup\$
    – Justme
    Apr 23, 2023 at 5:38
  • \$\begingroup\$ @SimonFitch Yes, I forgot to include that the grounds are shared. I joined the project late, so I do not know the design considerations of having a 1k and 499k resistor on esp32 #2 side. \$\endgroup\$ Apr 23, 2023 at 7:39
  • \$\begingroup\$ @Justme We had 115200 baud going through. I was wondering about the 500k pull-up as well. At this point, I just want to salvage it enough for testing, then change the design to be more robust \$\endgroup\$ Apr 23, 2023 at 7:46

1 Answer 1

1
\$\begingroup\$

This seems superfluous. Use a shielded cable with shields terminated well to 0V on both ends - as a most basic but functional ESD protection for 3V lines and don't bother level shifting. Add a 1k series protection resistor on each end of the line between the wire and GPIO. If that's not enough, then you need something a wee bit better than single-ended crude translators.

Toss an ESD-protected 3.3V RS422 transceiver on each end and call it a day. No additional work needed, no 5V needed, it'll be very robust, deal with several volts of common-mode voltage between the devices, and so on. That's pretty much exactly what I think you need in this application.

So, the simple answer:

How to choose pull-up resistor values for level shifting circuitry for serial communications

It's an XY problem. You don't want those level shifters anyway.

so the board designers integrated level shifters on each board to shift the 3.3V ESP32 logic levels to 5V, then back down to 3.3V

So, inventing barely-functional solutions to well-solved problems? Yeah, just because they put nonsense on a PCB doesn't meant that's what's needed.

There are so many questions here when someone puts a non-functional untested circuit on a production PCB and then the "bring up" is expected after apparently a production run or a large prototype batch has already been made - and no one competent was asked to review the thing beforehand. I understand that not every team can afford an experienced engineer to ensure such fiascos don't make it to hardware, but at the very least it'd be wise to pay for an hour or two of someone's time to at least point out the obvious snafus and provide some direction both before the schematic/design phase is finalized and after the layout is done.

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.