Skip to content

Commit beaac15

Browse files
committed
Fix clearing of ISTAT in Kinetis USB
The ISTAT register is write 1 to clear. Because of this ORing this register with itself fill clear all bits that are set. This patch updates the code to use plain assignment so only desired bit is cleared.
1 parent 48cf4d8 commit beaac15

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

features/unsupported/USBDevice/targets/TARGET_Freescale/USBHAL_KL25Z.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ void USBHAL::usbisr(void) {
438438
if (istat & 1<<7) {
439439
if (USB0->ENDPOINT[0].ENDPT & USB_ENDPT_EPSTALL_MASK)
440440
USB0->ENDPOINT[0].ENDPT &= ~USB_ENDPT_EPSTALL_MASK;
441-
USB0->ISTAT |= USB_ISTAT_STALL_MASK;
441+
USB0->ISTAT = USB_ISTAT_STALL_MASK;
442442
}
443443

444444
// token interrupt
@@ -493,13 +493,13 @@ void USBHAL::usbisr(void) {
493493

494494
// sleep interrupt
495495
if (istat & 1<<4) {
496-
USB0->ISTAT |= USB_ISTAT_SLEEP_MASK;
496+
USB0->ISTAT = USB_ISTAT_SLEEP_MASK;
497497
}
498498

499499
// error interrupt
500500
if (istat & USB_ISTAT_ERROR_MASK) {
501501
USB0->ERRSTAT = 0xFF;
502-
USB0->ISTAT |= USB_ISTAT_ERROR_MASK;
502+
USB0->ISTAT = USB_ISTAT_ERROR_MASK;
503503
}
504504
}
505505

0 commit comments

Comments
 (0)