diff options
author | Damien <damien.p.george@gmail.com> | 2013-10-21 09:56:56 +0100 |
---|---|---|
committer | Damien <damien.p.george@gmail.com> | 2013-10-21 09:56:56 +0100 |
commit | 4b6e85ca26ac9cacf578862688f3c2a77a9090a1 (patch) | |
tree | 5872f1d70b721861250c3f61cf1b70a2856f565d /stm/lib | |
parent | fa2162bc77b22fd135fd059219191ac91449b3fa (diff) |
Try to get REPL working, but bug with CDC VCP...
Diffstat (limited to 'stm/lib')
-rw-r--r-- | stm/lib/usb_dcd_int.c | 10 | ||||
-rw-r--r-- | stm/lib/usbd_cdc_vcp.c | 3 | ||||
-rw-r--r-- | stm/lib/usbd_pyb_core.c | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/stm/lib/usb_dcd_int.c b/stm/lib/usb_dcd_int.c index 32984e610..abdb686c6 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);
}
diff --git a/stm/lib/usbd_cdc_vcp.c b/stm/lib/usbd_cdc_vcp.c index b7330d9f6..985b0b4fd 100644 --- a/stm/lib/usbd_cdc_vcp.c +++ b/stm/lib/usbd_cdc_vcp.c @@ -212,7 +212,8 @@ static uint16_t VCP_DataTx (const uint8_t* Buf, uint32_t Len) * @retval Result of the opeartion: USBD_OK if all operations are OK else VCP_FAIL
*/
static uint16_t VCP_DataRx (uint8_t* Buf, uint32_t Len) {
- //printf("%.*s", (int)Len, Buf);
+ extern void usb_vcp_receive(uint8_t *buf, uint32_t len);
+ usb_vcp_receive(Buf, Len);
return USBD_OK;
}
diff --git a/stm/lib/usbd_pyb_core.c b/stm/lib/usbd_pyb_core.c index 5d6e6d9b9..f388361aa 100644 --- a/stm/lib/usbd_pyb_core.c +++ b/stm/lib/usbd_pyb_core.c @@ -73,7 +73,8 @@ #include "usbd_msc_bot.h"
#include "usbd_msc_mem.h"
-#define USB_PYB_CONFIG_DESC_SIZ (98)
+#define USB_PYB_CONFIG_DESC_SIZ (98) // for both CDC VCP and MSC interfaces
+//#define USB_PYB_CONFIG_DESC_SIZ (67) // for only CDC VCP interfaces
#define MSC_EPIN_SIZE MSC_MAX_PACKET
#define MSC_EPOUT_SIZE MSC_MAX_PACKET
|