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

SN32: Fixed USB sending errors under certain conditions #371

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions os/hal/ports/SN32/LLD/SN32F2xx/USB/hal_usb_lld.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,12 @@ void usb_serve_endpoints(USBDriver* usbp, usbep_t ep, bool in) {
/* IN endpoint, transmission.*/
USBInEndpointState *isp = epcp->in_state;

if (isp->txcnt >= isp->txsize) {
/* Transfer completed, invokes the callback.*/
_usb_isr_invoke_in_cb(usbp, ep);
return;
}

isp->txcnt += isp->txlast;
n = isp->txsize - isp->txcnt;

Expand Down