From 43f7e7a3cf384e880bfefa6257f15c8915b02e3b Mon Sep 17 00:00:00 2001 From: Allen Ibara Date: Wed, 27 Mar 2013 12:09:49 -0700 Subject: Changes to the USBUART to make it less likely to drop characters at higher baud rates. USB UART seems to work fine at 115.2Kbps or 230.4Kbps, but starts to drop characters as the data rate goes higher. This commit changes the usbuart ISR to fill a software FIFO, and adds a low priority timer interrupt to run deferred processing to drain a FIFO and send USB CDCACM packets, rather than calling the usb send within the UART ISR. Tested on native platform, up to 1.5MBps. --- src/platforms/stlink/platform.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/platforms/stlink') diff --git a/src/platforms/stlink/platform.h b/src/platforms/stlink/platform.h index cbfc0ba..09fab96 100644 --- a/src/platforms/stlink/platform.h +++ b/src/platforms/stlink/platform.h @@ -107,6 +107,7 @@ extern usbd_device *usbdev; */ #define IRQ_PRI_USB (2 << 4) #define IRQ_PRI_USBUSART (1 << 4) +#define IRQ_PRI_USBUSART_TIM (3 << 4) #define IRQ_PRI_USB_VBUS (14 << 4) #define IRQ_PRI_TIM3 (0 << 4) @@ -118,6 +119,10 @@ extern usbd_device *usbdev; #define USBUSART_PORT GPIOA #define USBUSART_TX_PIN GPIO2 #define USBUSART_ISR usart2_isr +#define USBUSART_TIM TIM4 +#define USBUSART_TIM_CLK_EN() rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_TIM4EN) +#define USBUSART_TIM_IRQ NVIC_TIM4_IRQ +#define USBUSART_TIM_ISR tim4_isr #define DEBUG(...) -- cgit v1.2.3