Skip to content
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

Fixes HW Serial attaching pins, PHY initialization, crash after end() #9365

Merged
merged 11 commits into from
Mar 14, 2024

Conversation

SuGlider
Copy link
Collaborator

@SuGlider SuGlider commented Mar 12, 2024

Description of Change

Fixes:

  • pin number error
  • PHY initialization that prevented HW Serial to start correctly and get enumerated after end() or detaching pins
  • crash after executing end()
  • force USB Host enumeration in order to set the right state to detect first time sending data to the HOST (CDC Connection)

Tests scenarios

Tested with ESP32-C3, ESP32-S3, ESP32-C6, ESP32-H2

// HW Serial CDC mode with CDC on boot enabled

void setup() {
  Serial.begin();
  Serial.end();
  Serial.begin();
  // waits until Serial Monitor is open
  while (!Serial) delay(100);
  Serial.println();
  Serial.println("Started!");
  Serial.println("");
}

void loop() {
  Serial.println("loop...");
  delay(1000);
}

Related links

Fixes #9360

Fixes HW Serial pin setup.

The pins were set up to the wrong value and it could not be correctly configured and used.
Fixes the PHY initialization.

After detaching the pin and ending the HW Serial, a new begin() wouldn't start the CDC because it lacked the proper PHY initialization.
Fixes a crash when calling end()

end() treminanates the `tx_ring_buf` but it was not tested for NULL in the ISR and in the cdc0_write_char() causing a crash if those are used. This depends on events and happens eventually.
@SuGlider SuGlider added the Type: Bug 🐛 All bugs label Mar 12, 2024
@SuGlider SuGlider added this to the 3.0.0-RC1 milestone Mar 12, 2024
@SuGlider SuGlider self-assigned this Mar 12, 2024
Copy link
Contributor

github-actions bot commented Mar 12, 2024

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "fix git stash/commit added lines":
    • summary looks empty
    • type/action looks empty
  • the commit message "fix: HWCDC pin number":
    • summary looks too short
  • the commit message "fix: PHY initialization":
    • body's lines must not be longer than 100 characters
    • summary looks too short
  • the commit message "fix: crashing end()":
    • body's lines must not be longer than 100 characters
    • summary looks too short
  • the commit message "fixes C6|H2 issue":
    • summary looks empty
    • type/action looks empty
  • the commit message "fixes usb_phy_ll include and call":
    • summary looks empty
    • type/action looks empty
  • the commit message "fixes":
    • summary looks empty
    • type/action looks empty
  • the commit message "github commit problem":
    • summary looks empty
    • type/action looks empty
  • the commit message "reduces number of debug messages":
    • summary looks empty
    • type/action looks empty
  • the commit message "roll back":
    • summary looks empty
    • type/action looks empty
  • the commit message "solves HWSerial initialization":
    • summary looks empty
    • type/action looks empty

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 20 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

⚠️ Please consider squashing your 11 commits (simplifying branch history).
⚠️

The source branch "HWCDC_pins" incorrect format:

  • contains uppercase letters. This can cause troubles on case-insensitive file systems (macOS).
    Please rename your branch.

👋 Hello SuGlider, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against e731329

@SuGlider SuGlider marked this pull request as draft March 12, 2024 16:04
@SuGlider SuGlider added the Status: In Progress Issue is in progress label Mar 12, 2024
cores/esp32/HWCDC.cpp Show resolved Hide resolved
cores/esp32/HWCDC.cpp Outdated Show resolved Hide resolved
@Jason2866
Copy link
Collaborator

Jason2866 commented Mar 12, 2024

The roll back re-introduces CI compile errors for the others CDC MCUs
Edit: since completely removed it is fine!

@SuGlider
Copy link
Collaborator Author

The roll back re-introduces CI compile errors for the others CDC MCUs Edit: since completely removed it is fine!

I decided to set the registers directly for all the SoC. It works fine now.

issue with `if(Serial)` not working always
@SuGlider SuGlider marked this pull request as ready for review March 13, 2024 02:49
Copy link
Member

@P-R-O-C-H-Y P-R-O-C-H-Y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tested with S3 and the issue is gone. Great job :)

@VojtechBartoska VojtechBartoska added the Status: Pending Merge Pull Request is ready to be merged label Mar 13, 2024
Copy link
Collaborator

@lucasssvaz lucasssvaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@lbernstone
Copy link
Contributor

Tested on C6 👍

@me-no-dev me-no-dev merged commit 0a26a8c into espressif:master Mar 14, 2024
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport needed 🔙 Status: In Progress Issue is in progress Status: Pending Merge Pull Request is ready to be merged Type: Bug 🐛 All bugs
Projects
Development

Successfully merging this pull request may close these issues.

HWCDC & periman broken
7 participants