ESP32 hang

Madbyte
Posts: 4
Joined: Mon Aug 28, 2023 2:56 pm

ESP32 hang

Postby Madbyte » Mon Aug 28, 2023 3:51 pm

Hi,

I'm new to ESP32 and FreeRTOS but not for microcontrollers. For developing I'm using an Dev Kit and Visual Studio Code with Platformio and Arduino framework. I have a code calculating RMS values from 3 analog signals sampled using the builtin adc_digi_read_bytes() and FreeRTOS tasks taking actions based in those RMS calculations. The code works ok but it hangs after some hours. I have the DevKit connected to my PC using a USB and like "extra hardware" there is only one led attached to GPIO 23. I'm using some GPIO ports changing their states to keep watch for running tasks and using Serial.pintln() in loop() for terminal communitacions, and BluetoothSerial too.

For example, before taking the samples, GPIO25 is set HIGH and set to LOW when all samples are manipulated.

Things that I noticed when the ESP32 hangs:
All GPIO outputs are in LOW state <- Can I eliminate the possibility of an infinite loop here?
No Serial communications.
No Bluetooth.

When I'm using Visual Studio Code and its terminal to read the data from the Dev Kit and then it is closed this action reset the DevKit. Is this normal?

Thanks.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 hang

Postby ESP_Sprite » Tue Aug 29, 2023 12:09 am

What is your power supply like? Possibly EMC problems from the motor?

Madbyte
Posts: 4
Joined: Mon Aug 28, 2023 2:56 pm

Re: ESP32 hang

Postby Madbyte » Tue Aug 29, 2023 3:43 am

The power supply cames from the PC USB port. I'm in early development stage, so there is no motor yet, the three phase signals cames from a simple 5V pwm sine generators, these are feeding my first prototype running a PIC microcontroller, that is in production right now, without any issue. I noticed that some times closing Visual Studio Code while it is receiving data through Serial Monitor hangs the ESP32 too.

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: ESP32 hang

Postby MicroController » Tue Aug 29, 2023 12:13 pm

When I'm using Visual Studio Code and its terminal to read the data from the Dev Kit and then it is closed this action reset the DevKit. Is this normal?
The ESP's "/reset" or "EN" and "BOOT" pins are controlled via the DTR and RTS signals of the (USB) serial port to enable PC software to reset the ESP and enter flash download mode automatically.
Depending on the PC application (and the USB-serial's driver) those signal lines may toggle or be set to a certain level upon opening or closing the virtual COM port, which can cause a reset ("EN" toggles) or disabling ("EN" stays low) of the ESP until the COM port is reconfigured by an application or the USB is disconnected.

So, yes, this is kind-of normal and not a sign of any problems with the ESP or its code.

Madbyte
Posts: 4
Joined: Mon Aug 28, 2023 2:56 pm

Re: ESP32 hang

Postby Madbyte » Tue Aug 29, 2023 1:13 pm

The ESP's "/reset" or "EN" and "BOOT" pins are controlled via the DTR and RTS signals of the (USB) serial port to enable PC software to reset the ESP and enter flash download mode automatically.
Depending on the PC application (and the USB-serial's driver) those signal lines may toggle or be set to a certain level upon opening or closing the virtual COM port, which can cause a reset ("EN" toggles) or disabling ("EN" stays low) of the ESP until the COM port is reconfigured by an application or the USB is disconnected.

So, yes, this is kind-of normal and not a sign of any problems with the ESP or its code.
Thank you for this info. This allows me to continue to find out what's going on

Who is online

Users browsing this forum: Bing [Bot] and 122 guests