@@ -118,10 +118,12 @@ void USBEndpoint::setState(USB_TYPE st)
118
118
USBx_HC (hced->ch_num )->HCCHAR |= USB_OTG_HCCHAR_CHDIS;
119
119
// Disable the channel
120
120
USBx_HC (hced->ch_num )->HCCHAR |= USB_OTG_HCCHAR_CHDIS | USB_OTG_HCCHAR_CHENA;
121
- // <-- Notice the lack of error handling here - after testing a lot of
122
- // combinations, it seems that the USB host controller doesn't work fully
123
- // according to the reference manual in this aspect, which might also
124
- // be the reason for lacking error handling in the ST USB LL
121
+ // Notice the lack of error handling here - after testing a lot of
122
+ // combinations, it seems that the USB host controller doesn't work fully
123
+ // according to the reference manual in this aspect, which might also
124
+ // be the reason for lacking error handling in the ST USB LL - instead,
125
+ // we use a 50 us delay to wait for the channel to disable
126
+ wait_us (50 );
125
127
126
128
HAL_HCD_DisableInt ((HCD_HandleTypeDef *)hced->hhcd , hced->ch_num );
127
129
*addr = 0 ;
@@ -132,10 +134,12 @@ void USBEndpoint::setState(USB_TYPE st)
132
134
USBx_HC (hced->ch_num )->HCCHAR |= USB_OTG_HCCHAR_CHDIS;
133
135
// Disable the channel
134
136
USBx_HC (hced->ch_num )->HCCHAR |= USB_OTG_HCCHAR_CHDIS | USB_OTG_HCCHAR_CHENA;
135
- // <-- Notice the lack of error handling here - after testing a lot of
136
- // combinations, it seems that the USB host controller doesn't work fully
137
- // according to the reference manual in this aspect, which might also
138
- // be the reason for lacking error handling in the ST USB LL
137
+ // Notice the lack of error handling here - after testing a lot of
138
+ // combinations, it seems that the USB host controller doesn't work fully
139
+ // according to the reference manual in this aspect, which might also
140
+ // be the reason for lacking error handling in the ST USB LL - instead,
141
+ // we use a 50 us delay to wait for the channel to disable
142
+ wait_us (50 );
139
143
140
144
HAL_HCD_DisableInt ((HCD_HandleTypeDef *)hced->hhcd , hced->ch_num );
141
145
uint8_t hcd_speed = HCD_SPEED_FULL;
0 commit comments