Skip to content

Commit 170dc00

Browse files
committed
Fixed auto-reset not working with some versions of Windows, other fixups
1 parent 914f38a commit 170dc00

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

cores/arduino/USB/USBCore.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,6 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len)
635635
uint32_t written = 0;
636636
uint32_t length = 0;
637637

638-
// if len is a multiple of EPX_SIZE an ZLP needs to be sent
639-
// to indicate end of transfer
640-
bool sendZlp = (len % EPX_SIZE) == 0;
641-
642638
if (!_usbConfiguration)
643639
return -1;
644640
if (len > 16384)
@@ -652,7 +648,7 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len)
652648
#endif
653649

654650
// Flash area
655-
while (len != 0 || sendZlp)
651+
while (len != 0)
656652
{
657653
if (usbd.epBank1IsReady(ep)) {
658654
// previous transfer is still not complete
@@ -697,12 +693,6 @@ uint32_t USBDeviceClass::send(uint32_t ep, const void *data, uint32_t len)
697693

698694
written += length;
699695
len -= length;
700-
701-
if (len == 0 && sendZlp) {
702-
// empty transfer sent
703-
sendZlp = false;
704-
}
705-
706696
data = (char *)data + length;
707697
}
708698
return written;

cores/arduino/USB/USBCore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ typedef struct
262262
_Pragma("pack()")
263263

264264
#define D_DEVICE(_class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs) \
265-
{ 18, 1, 0x200, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs }
265+
{ 18, 1, 0x110, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs }
266266
/* Table 9-8. Standard Device Descriptor
267267
* bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
268268
* idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */

cores/arduino/USB/samd21_host.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ extern "C" {
2525

2626
extern __attribute__((__aligned__(4))) volatile UsbHostDescriptor usb_pipe_table[USB_EPT_NUM];
2727

28+
#ifndef USB_HOST_PINTFLAG_TRCPT_Pos
2829
#define USB_HOST_PINTFLAG_TRCPT_Pos 0 /**< \brief (USB_HOST_PINTFLAG) Transfer Complete 0/1 Interrupt Flag */
2930
#define USB_HOST_PINTFLAG_TRCPT_Msk (0x3u << USB_HOST_PINTFLAG_TRCPT_Pos)
3031
#define USB_HOST_PINTFLAG_TRCPT(value) ((USB_HOST_PINTFLAG_TRCPT_Msk & ((value) << USB_HOST_PINTFLAG_TRCPT_Pos)))
32+
#endif
3133

3234
#define USB_EP_DIR_IN 0x80 // USB_SETUP_DEVICE_TO_HOST
3335
#define USB_EP_DIR_OUT 0x00 // USB_SETUP_HOST_TO_DEVICE

cores/arduino/startup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void SystemInit( void )
172172
*/
173173

174174
#if ((HS_CRYSTAL_FREQUENCY_HERTZ < 400000UL) || (HS_CRYSTAL_FREQUENCY_HERTZ > 32000000UL))
175-
#error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be between 4000000UL and 32000000UL"
175+
#error "board.init.c: HS_CRYSTAL_FREQUENCY_HERTZ must be between 400000UL and 32000000UL"
176176
#endif
177177

178178
#if defined(PLL_FAST_STARTUP)

0 commit comments

Comments
 (0)