summaryrefslogtreecommitdiffstatshomepage
path: root/stm/lib/usb_dcd_int.c
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-10-21 09:56:56 +0100
committerDamien <damien.p.george@gmail.com>2013-10-21 09:56:56 +0100
commit4b6e85ca26ac9cacf578862688f3c2a77a9090a1 (patch)
tree5872f1d70b721861250c3f61cf1b70a2856f565d /stm/lib/usb_dcd_int.c
parentfa2162bc77b22fd135fd059219191ac91449b3fa (diff)
downloadmicropython-4b6e85ca26ac9cacf578862688f3c2a77a9090a1.tar.gz
micropython-4b6e85ca26ac9cacf578862688f3c2a77a9090a1.zip
Try to get REPL working, but bug with CDC VCP...
Diffstat (limited to 'stm/lib/usb_dcd_int.c')
-rw-r--r--stm/lib/usb_dcd_int.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/stm/lib/usb_dcd_int.c b/stm/lib/usb_dcd_int.c
index 32984e610c..abdb686c6a 100644
--- a/stm/lib/usb_dcd_int.c
+++ b/stm/lib/usb_dcd_int.c
@@ -675,6 +675,16 @@ static uint32_t DCD_WriteEmptyTxFifo(USB_OTG_CORE_HANDLE *pdev, uint32_t epnum)
ep->xfer_buff += len;
ep->xfer_count += len;
+ // this code turns off the "empty interrupt"
+ // without it the USB is subject to perpetual interrupts
+ // see my.st.com, "Yet another STM32F105/7 USB OTG driver issue (VCP device)"
+ // this code might also work if put in DCD_HandleInEP_ISR
+ if (ep->xfer_count >= ep->xfer_len) {
+ uint32_t fifoemptymsk = 1 << ep->num;
+ USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DIEPEMPMSK, fifoemptymsk, 0);
+ break;
+ }
+
txstatus.d32 = USB_OTG_READ_REG32(&pdev->regs.INEP_REGS[epnum]->DTXFSTS);
}