Skip to content

Commit d8287c3

Browse files
author
Alrik Vidstrom
committed
Add warning about some errors possibly going unreported
Setting state to USB_TYPE_IDLE allows the library to recover from an error after the channels have been cleared. But this might lead to some errors going unreported, and should be improved in the future - but at least the library passes all our tests from higher levels in the stack at this point, which it didn't before. Our tests don't show any signs of data loss when the error recovery kicks in with the current solution. Fixing this last problem will probably take quite some effort (time), which isn't possible at the moment.
1 parent 641c316 commit d8287c3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/targets/TARGET_STM/USBEndpoint_STM.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ void USBEndpoint::setState(USB_TYPE st)
153153
USBx_HC(hced->ch_num)->HCCHAR &= ~USB_OTG_HCCHAR_CHDIS;
154154
USBx_HC(hced->ch_num)->HCCHAR |= USB_OTG_HCCHAR_CHENA;
155155
// <--
156+
// Set state to USB_TYPE_IDLE to allow the library to recover from the error.
157+
// WARNING: This might lead to some errors going unreported, and should be improved in the future, but
158+
// at least the library passes all our tests from higher levels at this point, which it didn't
159+
// do before.
156160
state = USB_TYPE_IDLE;
157161
}
158162
}

0 commit comments

Comments
 (0)