diff --git a/src/machine/machine_atsamd21.go b/src/machine/machine_atsamd21.go index 1e1540ab..86491195 100644 --- a/src/machine/machine_atsamd21.go +++ b/src/machine/machine_atsamd21.go @@ -1477,8 +1477,6 @@ func handleUSB(intr interrupt.Interrupt) { // clear stall request setEPINTENCLR(0, sam.USB_DEVICE_EPINTENCLR_STALL1) } - } else { - sendZlp() } // Now the actual transfer handlers, ignore endpoint number 0 (setup) @@ -1749,6 +1747,7 @@ func sendUSBPacket(ep uint32, data []byte) { usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.ClearBits(usb_DEVICE_PCKSIZE_MULTI_PACKET_SIZE_Mask << usb_DEVICE_PCKSIZE_MULTI_PACKET_SIZE_Pos) // set byte count, which is total number of bytes to be sent + usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.ClearBits(usb_DEVICE_PCKSIZE_BYTE_COUNT_Mask << usb_DEVICE_PCKSIZE_BYTE_COUNT_Pos) usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.SetBits(uint32((len(data) & usb_DEVICE_PCKSIZE_BYTE_COUNT_Mask) << usb_DEVICE_PCKSIZE_BYTE_COUNT_Pos)) } diff --git a/src/machine/machine_atsamd51.go b/src/machine/machine_atsamd51.go index 11b3e34f..3879f037 100644 --- a/src/machine/machine_atsamd51.go +++ b/src/machine/machine_atsamd51.go @@ -1648,8 +1648,6 @@ func handleUSBIRQ(interrupt.Interrupt) { // clear stall request setEPINTENCLR(0, sam.USB_DEVICE_ENDPOINT_EPINTENCLR_STALL1) } - } else { - sendZlp() } // Now the actual transfer handlers, ignore endpoint number 0 (setup) @@ -1920,6 +1918,7 @@ func sendUSBPacket(ep uint32, data []byte) { usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.ClearBits(usb_DEVICE_PCKSIZE_MULTI_PACKET_SIZE_Mask << usb_DEVICE_PCKSIZE_MULTI_PACKET_SIZE_Pos) // set byte count, which is total number of bytes to be sent + usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.ClearBits(usb_DEVICE_PCKSIZE_BYTE_COUNT_Mask << usb_DEVICE_PCKSIZE_BYTE_COUNT_Pos) usbEndpointDescriptors[ep].DeviceDescBank[1].PCKSIZE.SetBits(uint32((len(data) & usb_DEVICE_PCKSIZE_BYTE_COUNT_Mask) << usb_DEVICE_PCKSIZE_BYTE_COUNT_Pos)) }