Skip to content

fix: HWCDC removed clearing USB Serial/JTAG interrupts during begin (#9316) #9327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

kiran-desilva
Copy link

Description of Change

Fixes (#9316) where ESP may not respond over the USB Serial/JTAG interface if bytes are sent before HWCDC::begin(...) is called. Clearing of the interrupt status has been removed from HWCDC::begin(...) so that if the USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT is already set, the isr handler can process the interrupt status correctly.

Tests scenarios

Tested with ESP32-S3:

#include <Arduino.h>
#include <HWCDC.h>
#include <hal/usb_serial_jtag_ll.h>
#include <string>


uint32_t prevTime = 0;


void setup() {
  
  delay(5000);

  Serial.begin(115200);
  Serial.println("begin");
}

void loop() {

  if (millis() - prevTime > 500)
  {
    prevTime = millis();
    std::string output;
    output += "rxFifo: " + std::to_string(usb_serial_jtag_ll_rxfifo_data_available());
    output += " Serial avaliable: " + std::to_string(Serial.available());
    Serial.println(output.c_str());

  }

  while (Serial.available())
  {
    uint8_t b = Serial.read();
    Serial.print(Serial.available());
    Serial.print(" - ");
    Serial.write(b);
    Serial.println();
  }
  vTaskDelay(1); // watchdog
}

Related links

Closes (#9316)

@CLAassistant
Copy link

CLAassistant commented Mar 3, 2024

CLA assistant check
All committers have signed the CLA.

@SuGlider SuGlider self-assigned this Mar 3, 2024
@P-R-O-C-H-Y
Copy link
Member

@kiran-desilva Please use release/v2.x. branch as a base for the PR. Thanks

@VojtechBartoska VojtechBartoska added this to the 2.0.15 milestone Mar 4, 2024
@VojtechBartoska VojtechBartoska added the Resolution: Awaiting response Waiting for response of author label Mar 4, 2024
@SuGlider SuGlider mentioned this pull request Mar 4, 2024
@VojtechBartoska VojtechBartoska requested a review from SuGlider March 4, 2024 13:06
@kiran-desilva kiran-desilva changed the base branch from idf-release/v4.4 to release/v2.x March 4, 2024 23:23
@SuGlider
Copy link
Collaborator

SuGlider commented Mar 5, 2024

@kiran-desilva - We have another problem now... the rebasing added a thousand changed files.
Can you fix it? If necessary, you can close it and open a new PR directly forked from "release/v2.x".

@kiran-desilva
Copy link
Author

@kiran-desilva - We have another problem now... the rebasing added a thousand changed files.
Can you fix it? If necessary, you can close it and open a new PR directly forked from "release/v2.x".

Yep I'll close and re-open a new pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Awaiting response Waiting for response of author
Projects
Development

Successfully merging this pull request may close these issues.

6 participants