Skip to content

Commit bc4da20

Browse files
committed
samd: Fix a lock-up situation at high traffic.
This PR fixes a transmit lock-up, which happens, when data is received and sent at the sime time at moderate to high speeds, like code which just echoes incoming data. In my case, an issue was reported here: micropython/micropython#8521
1 parent 3ead682 commit bc4da20

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/portable/microchip/samd/dcd_samd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,14 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
286286
{
287287
bank->PCKSIZE.bit.MULTI_PACKET_SIZE = total_bytes;
288288
bank->PCKSIZE.bit.BYTE_COUNT = 0;
289-
ep->EPSTATUSCLR.reg |= USB_DEVICE_EPSTATUSCLR_BK0RDY;
290-
ep->EPINTFLAG.reg |= USB_DEVICE_EPINTFLAG_TRFAIL0;
289+
ep->EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK0RDY;
290+
ep->EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRFAIL0;
291291
} else
292292
{
293293
bank->PCKSIZE.bit.MULTI_PACKET_SIZE = 0;
294294
bank->PCKSIZE.bit.BYTE_COUNT = total_bytes;
295-
ep->EPSTATUSSET.reg |= USB_DEVICE_EPSTATUSSET_BK1RDY;
296-
ep->EPINTFLAG.reg |= USB_DEVICE_EPINTFLAG_TRFAIL1;
295+
ep->EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_BK1RDY;
296+
ep->EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRFAIL1;
297297
}
298298

299299
return true;

0 commit comments

Comments
 (0)