I would like to read the serial data with a C# Windows Forms Application. The data is send with an ESP32 C3 Super Mini. When I use the Serial Monitor from the Arduino IDE everything works fine.
If I'm reading the serial data with my C# Application (serialPort1.ReadLine(); or serialPort1.ReadExisting();) I will get the data only once and then the ESP resets with this reason: rst:0x15 (USB_UART_CHIP_RESET),boot:0xc (SPI_FAST_FLASH_BOOT)
C# Code
private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e) { lblState1.Invoke(new MethodInvoker(ProcessData1)); } private async void ProcessData1() { //MessageBox.Show(serialPort1.ReadLine()); MessageBox.Show(serialPort1.ReadExisting()); } Arduino Code
unsigned long last_time = 0; void setup() { Serial.begin(9600); } void loop() { // Print a heartbeat if (millis() > last_time + 2000) { Serial.println("Arduino is alive!!"); last_time = millis(); } } A few days ago the application worked fine. After I upload a new programm to the ESP32 I got this problem and can't fix it.
Edit
DtrEnable and RtsEnable are set to false.
serialPort1.ReadExisting();I got the same error.void Read(): The connection is closed