Browse Source

Don't crash when USB_USBCMD_ATDTW isn't working

teensy4-core
PaulStoffregen 4 years ago
parent
commit
b141c8b562
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      teensy4/usb.c

+ 2
- 2
teensy4/usb.c View File

@@ -848,11 +848,11 @@ static void schedule_transfer(endpoint_t *endpoint, uint32_t epmask, transfer_t
if (USB1_ENDPTPRIME & epmask) goto end;
//digitalWriteFast(2, HIGH);
//ret |= 0x01;
uint32_t status;
uint32_t status, cyccnt=ARM_DWT_CYCCNT;
do {
USB1_USBCMD |= USB_USBCMD_ATDTW;
status = USB1_ENDPTSTATUS;
} while (!(USB1_USBCMD & USB_USBCMD_ATDTW));
} while (!(USB1_USBCMD & USB_USBCMD_ATDTW) && (ARM_DWT_CYCCNT - cyccnt < 2400));
//USB1_USBCMD &= ~USB_USBCMD_ATDTW;
if (status & epmask) goto end;
//ret |= 0x02;

Loading…
Cancel
Save