Reset MCU while opening serial port

ogedik
Posts: 35
Joined: Wed Jun 28, 2023 8:32 pm

Reset MCU while opening serial port

Postby ogedik » Tue Sep 12, 2023 3:41 pm

Hi,

I am working on a circuit based on AiThinker ESP32-C3-13/13U-Kit and communicating ESP32 kit with my computer through GPIO18 and GPIO19. The problem is when I open COM port on my .Net application, MCU resets and boot itself. So I made a research and found out that RTS pin is connected to ESP32-C3 EN pin so that when I open port by my .Net appliction on my computer to ESP32 kit through COM port, MCU get reset signal and reboot.

To solve this problem I set properties as below;

Code: Select all

                    _serialPort.PortName = port;
                    _serialPort.BaudRate = 115200;
                    _serialPort.DtrEnable = true;
                    _serialPort.RtsEnable = false;

                    // Set the read/write timeouts
                    _serialPort.ReadTimeout = 1000;
                    _serialPort.WriteTimeout = 1000;

                   try
                    {
                        _serialPort.Open();
                        message = _serialPort.ReadLine();

                        if (message == "HELLO\r")
                        {
                            // device connected                            
                            _serialPort.Close();

                            statusLabel.Text = "Cihaz bulundu";

                            return (port);
                        }
                    }
Even though I disable RTS, MCU still resets and boot itself. I tried all combinations for DtrEnable and RtsEnable properties. But result didn't change.

Anybody can help me to solve this issue?

Thank you

Orkun Gedik

ogedik
Posts: 35
Joined: Wed Jun 28, 2023 8:32 pm

Re: Reset MCU while opening serial port

Postby ogedik » Tue Sep 12, 2023 6:21 pm

Hi Orkun,

You should set handshake after set property RtsEnable = true. Use properties as below;

Code: Select all

                _serialPort.RtsEnable = true;
                _serialPort.Handshake = System.IO.Ports.Handshake.RequestToSend;
                _serialPort.RtsEnable = false;

ogedik
Posts: 35
Joined: Wed Jun 28, 2023 8:32 pm

Re: Reset MCU while opening serial port

Postby ogedik » Tue Sep 12, 2023 8:33 pm

ogedik wrote:
Tue Sep 12, 2023 6:21 pm
Hi Orkun,

You should set handshake after set property RtsEnable = true. Use properties as below;

Code: Select all

                _serialPort.RtsEnable = true;
                _serialPort.Handshake = System.IO.Ports.Handshake.RequestToSend;
                _serialPort.RtsEnable = false;
It worked as you suggested. Thank you

Who is online

Users browsing this forum: No registered users and 89 guests