Thanks to visit codestin.com
Credit goes to github.com

Skip to content

samd/mphalport: Fix USB CDC RX handling to not block when unprocessed. #8520

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
wants to merge 2 commits into from

Conversation

robert-hh
Copy link
Contributor

** Draft **

Porting PR #8040 of @hoihu for SAMD, following the commit
5873390.


Issue:

This PR unveils an issue of the port and is made to have a working
example for easily reproducing the fault.
USB locks up almost immediately if charaters at the input arrive too
fast, when they are echoed. That happens for instance in REPL.
This issue is present in the actual master branch as well, but requires
much higher input symbol frequency and is hard to reproce.

Addition:

Temporary add a function mp_hal_time_ns() to please the linker when
built with DEBUG=1.

@robert-hh robert-hh marked this pull request as draft April 11, 2022 15:54
Porting PR micropython#8040 of @hoihu for SAMD, following the commit
5873390.

---

Issue:

This PR unveils an issue of the port and is made to have a working
example for easily reproducing the fault.
USB locks up almost immediately if charaters at the input arrive too
fast, when they are echoed. That happens for instance in REPL.
This issue is present in the actual master branch as well, but requires
much higher input symbol frequency and is hard to reproce.

Addition:

Temporary add  a function mp_hal_time_ns() to please the linker when
built with DEBUG=1.
- Support executing .mpy files.
- Fix UART REPL config error
- Enable Pull on UART RX.
  Now, that UART works, it avoids a crosstalk when the input not wired.
- Do not use UART for REPL when not initialized.
  The standard behavior enables REPL on UART at boot time. That can be
  disabled using machine.uart_deinit() and re-enabled again with
  machine.uart_init(). uart_deinit() disabled until now only the gpio
  port configuration, but data was still sent to the UART module. This
  commit stops using UART after uart_deinit() was called.
- use -Og for DEBUG builds, whuch creates a smaller image.
- Skip mp_hal_time_ns() for regular builds.
- Set the CPU freq to 120MHz for SAM51 devices.

This is temporary and does not fit to the SAMD21 build with DEBUG enabled.
@robert-hh
Copy link
Contributor Author

It seems that this lock-up is a problem in tinyusb, maybe related to the issue for which PR #8040 was a workaround. So I close this PR. Even if it is a useful change, it makes the port practically unusable. And since there are changes ongoing in the SAMD port to the same files, it just creates more confusion.

@robert-hh robert-hh closed this May 27, 2022
@robert-hh robert-hh deleted the samd_usb_rx branch May 27, 2022 19:24
tannewt added a commit to tannewt/circuitpython that referenced this pull request Jan 31, 2024
According to micropython#8520 it was never fully implemented and the IDF API
has changed in 5.2, which we haven't switched to yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants