@@ -114,6 +114,8 @@ pub fn Polled(config: Config) type {
114114
115115 // Setup request received?
116116 if (ints .SETUP_REQ != 0 ) {
117+ log .debug ("-- setup request --" , .{});
118+
117119 // Reset PID to 1 for EP0 IN. Every DATA packet we send in response
118120 // to an IN on EP0 needs to use PID DATA1.
119121 buffer_control [0 ].in .modify (.{ .PID_0 = 0 });
@@ -133,6 +135,8 @@ pub fn Polled(config: Config) type {
133135
134136 // Events on one or more buffers? (In practice, always one.)
135137 if (ints .BUFF_STATUS != 0 ) {
138+ log .debug ("-- buffer status --" , .{});
139+
136140 const buff_status = peripherals .USB .BUFF_STATUS .raw ;
137141
138142 inline for (0.. 2 * config .max_endpoints_count ) | shift | {
@@ -163,23 +167,20 @@ pub fn Polled(config: Config) type {
163167
164168 // Has the host signaled a bus reset?
165169 if (ints .BUS_RESET != 0 ) {
166- log .info ( " bus reset" , .{});
170+ log .debug ( "-- bus reset -- " , .{});
167171
168- // Abort all endpoints
169- peripherals .USB .EP_ABORT .raw = 0xFFFFFFFF ;
170- // Acknowledge by writing the write-one-to-clear status bit.
171172 peripherals .USB .SIE_STATUS .modify (.{ .BUS_RESET = 1 });
172173 set_address (& self .interface , 0 );
173174 controller .on_bus_reset (& self .interface );
174- while (peripherals .USB .EP_ABORT_DONE .raw != 0xFFFFFFFF ) {}
175- peripherals .USB .EP_ABORT .raw = 0 ;
176175 }
177176 }
178177
179178 pub fn init () @This () {
180179 if (chip == .RP2350 )
181180 peripherals .USB .MAIN_CTRL .write (.{ .PHY_ISO = 0 });
182181
182+ peripherals .USB .SIE_CTRL .modify (.{ .PULLUP_EN = 0 });
183+
183184 // Clear the control portion of DPRAM. This may not be necessary -- the
184185 // datasheet is ambiguous -- but the C examples do it, and so do we.
185186 peripherals .USB_DPRAM .SETUP_PACKET_LOW .write_raw (0 );
@@ -243,6 +244,7 @@ pub fn Polled(config: Config) type {
243244 };
244245
245246 @memset (std .mem .asBytes (& self .endpoints ), 0 );
247+
246248 // Set up endpoints.
247249 self .interface .ep_open (&.control (.in (.ep0 ), max_supported_packet_size ));
248250 self .interface .ep_open (&.control (.out (.ep0 ), max_supported_packet_size ));
0 commit comments