File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
src/r3_support_rp2040/src Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,7 @@ impl usb_device::bus::UsbBus for UsbBus {
233
233
x. set ( * y) ;
234
234
}
235
235
236
+ // Set `buf_ctrl`, toggle PID
236
237
buf_ctrl. set (
237
238
buf_ctrl. get ( ) & !EP_BUF_CTRL_AVAIL & !EP_BUF_CTRL_LEN_MASK ^ EP_BUF_CTRL_PID_DATA1
238
239
| buf. len ( ) as u32
@@ -284,11 +285,13 @@ impl usb_device::bus::UsbBus for UsbBus {
284
285
. sie_status
285
286
. write ( |b| b. setup_rec ( ) . set_bit ( ) ) ;
286
287
287
- // Reset EP0
288
- self . ep_buf_ctrl ( EndpointAddress :: from_parts ( 0 , UsbDirection :: In ) )
289
- . set ( 0 ) ;
290
- self . ep_buf_ctrl ( EndpointAddress :: from_parts ( 0 , UsbDirection :: Out ) )
291
- . set ( EP_BUF_CTRL_PID_DATA1 | EP_BUF_CTRL_AVAIL ) ;
288
+ // the first OUT data packet must be DATA1
289
+ let buf_ctrl = self . ep_buf_ctrl ( EndpointAddress :: from_parts ( 0 , UsbDirection :: Out ) ) ;
290
+ buf_ctrl. set ( buf_ctrl. get ( ) | EP_BUF_CTRL_PID_DATA1 ) ;
291
+
292
+ // should respond by DATA1
293
+ let buf_ctrl = self . ep_buf_ctrl ( EndpointAddress :: from_parts ( 0 , UsbDirection :: In ) ) ;
294
+ buf_ctrl. set ( buf_ctrl. get ( ) & !EP_BUF_CTRL_PID_DATA1 ) ;
292
295
293
296
return Ok ( 8 ) ;
294
297
}
You can’t perform that action at this time.
0 commit comments