From 7730d3b198d71eb103ba3d67255c4207b9451dde Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Tue, 22 Nov 2016 12:45:59 +1300 Subject: [PATCH] Don't enable usb uart on v2 when debugging --- src/platforms/native/platform.c | 8 ++++++-- src/platforms/stm32/usbuart.c | 8 -------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/platforms/native/platform.c b/src/platforms/native/platform.c index 8e0cde38..7af41e2b 100644 --- a/src/platforms/native/platform.c +++ b/src/platforms/native/platform.c @@ -164,7 +164,12 @@ void platform_init(void) platform_timing_init(); cdcacm_init(); - usbuart_init(); + + /* On mini hardware, UART and SWD share connector pins. + * Don't enable UART if we're being debugged. */ + if ((platform_hwversion() == 0) || !(SCS_DEMCR & SCS_DEMCR_TRCENA)) + usbuart_init(); + setup_vbus_irq(); } @@ -347,4 +352,3 @@ asm(".globl debug_monitor_handler\n" " b debug_monitor_handler_c\n"); #endif - diff --git a/src/platforms/stm32/usbuart.c b/src/platforms/stm32/usbuart.c index 77c959b1..ed74d36c 100644 --- a/src/platforms/stm32/usbuart.c +++ b/src/platforms/stm32/usbuart.c @@ -46,13 +46,6 @@ static void usbuart_run(void); void usbuart_init(void) { -#if defined(BLACKMAGIC) - /* On mini hardware, UART and SWD share connector pins. - * Don't enable UART if we're being debugged. */ - if ((platform_hwversion() == 1) && (SCS_DEMCR & SCS_DEMCR_TRCENA)) - return; -#endif - rcc_periph_clock_enable(USBUSART_CLK); UART_PIN_SETUP(); @@ -257,4 +250,3 @@ void USBUSART_TIM_ISR(void) /* process FIFO */ usbuart_run(); } -