ESP32 and RS485 causing Restart loop

Hello there

I got a problem and have been looking around for answers for my project in communication using RS485 in ESP32.

The problem I get is that whenever I start the ESP32 while connected to the RS485 it will enter a restart loop

10:29:15.311 -> rst:0x10 (RTCWDT_RTC_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
10:29:15.311 -> flash read err, 1000
10:29:15.311 -> ets_main.c 371 
10:29:15.653 -> ets Jun  8 2016 00:22:57

right now im just using blink example fot it knowing that the loop happen before any script is executed.

the wiring basically like this.

but im using pin :
RO - GPIO12
DI - GPIO13
RE DE - GPIO4
VCC - 5V
GND - GND

The restart loops stops when I unplug RO pin for a while and plugging it back.

Is there a workaround for this problem?

Thank you

Use a 3.3V RS485 adapter with a 3.3V MCU, like the ESP32.

Or, use a logic level shifter for the 5V to 3.3V I/O connections.

is there an exambple for the rs485 adapter? because most of the module here and the example uses 5v

FTDI makes a 3.3V chip, but if you can't find a module, use something like this logic level shifter.

is there like a dirty workaround? cause I'm limited at resource for a moment and need it fast, will other pins work like the RX TX GPIO on the ESP32?

The ESP32 is a 3.3V device, so a level shifter is required when connecting a 5V output to a 3.3V input.

A resistive voltage divider, e.g. 2.2K and 3.3K, works for most people, at least at low Baud rates.

The RS-485 signal has two balanced differential outputs A and B. One should be high when the other is low.

Why have you grounded the B output?
And why do the A and B signals even go to your ESP32? They should go to another RS-485 transceiver.

owh sorry I forgot to mention that the A and B signals doesn't connected to anywhere right now it's empty at the moment (I got the picture form the internet gonna find a better one)

.....but with unmentioned differences

ALWAYS post your own, correctly drawn wiring diagram. Hand drawn is preferred, especially over Fritzing idiot diagrams, which are often wrong, and almost always misleading.

sorry about that, I've changed it to my own wiring now

I found a Logic converter to try but i still got the same problem

(note : I'm note really used to use Logic converter so i might doing this the other way around)

here is the schematics right now

the buck converter is 5V and im powering my esp through USB

Hi,
Can you post some images of your project?
So we can see your component layout.

Can you please post your code?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia: :santa:

It would appear that the mcu cannot access the SPI flash.
Try switching the pins you use (especuially the GPIO12 and GPIO13)

1 Like

Why do you think that unplugging and plugging back in a wire to the ESP32 and the ESP32 having issue with the plugging is a problem?

GPIO_NUM_12 and GPIO_NUM_13 can be tricky to use on a ESP32 with those lines being used for boot and program load. I recommend against using GPIO_NUM_12.

esp32-pinout-use-gpio-pins is a useful guide to use of ESP32 pins

the wiring image at the first post is all there is I haven't connected it to anything yet

for the code im just using a simple blink script to check if the program is running or not. when I plug in the ESP32 to power it should've blink but it doesn't

int LED_BUILTIN = 2;
void setup() {
pinMode (LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}

I have a simple blink script just to tell if the ESP32 Script is running or not. Whenever I power the ESP32 (with RS485 connected) the ESP doesn't blink, I tried to plug and unplug all of the connection to the RS485 ant the script starts to work.

Then I tried to do the same thing but this time I unplug the pins one by one (except the GND and VCC pins) and when I unplug the RO pin the blink started.

owh this explains it ok gonna try other pins.