From 13004f81ee77b2a8e30cb8702c6b4fa8a349e4cb Mon Sep 17 00:00:00 2001 From: Frantisek Burian Date: Fri, 19 Dec 2014 00:34:01 +0100 Subject: [PATCH] usb_f103: Clear ISR bit as soon as possible, as for the other IRQs. Reported by Uwe in https://github.com/libopencm3/libopencm3/pull/274 but expanded and provided by BuFran finally. --- lib/usb/usb_f103.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/usb/usb_f103.c b/lib/usb/usb_f103.c index 2985650b..26c27941 100644 --- a/lib/usb/usb_f103.c +++ b/lib/usb/usb_f103.c @@ -300,9 +300,9 @@ static void stm32f103_poll(usbd_device *dev) uint16_t istr = *USB_ISTR_REG; if (istr & USB_ISTR_RESET) { + USB_CLR_ISTR_RESET(); dev->pm_top = 0x40; _usbd_reset(dev); - USB_CLR_ISTR_RESET(); return; } @@ -338,9 +338,9 @@ static void stm32f103_poll(usbd_device *dev) } if (istr & USB_ISTR_SOF) { + USB_CLR_ISTR_SOF(); if (dev->user_callback_sof) { dev->user_callback_sof(); } - USB_CLR_ISTR_SOF(); } }