From bcba3ee4a9279863bcff7a6d99f62da81f4e158f Mon Sep 17 00:00:00 2001 From: Piotr Esden-Tempski Date: Sun, 9 Jan 2022 16:12:21 -0800 Subject: [PATCH] native: Fixed hw6 USBUSART support. --- src/platforms/native/platform.h | 12 ++++++------ src/platforms/stm32/usbuart.c | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/platforms/native/platform.h b/src/platforms/native/platform.h index 368c2fb..e5ea0c4 100644 --- a/src/platforms/native/platform.h +++ b/src/platforms/native/platform.h @@ -254,12 +254,12 @@ int usbuart_debug_write(const char *buf, size_t len); #define USBUSART2 USART2 #define USBUSART2_IRQ NVIC_USART2_IRQ #define USBUSART2_ISR(x) usart2_isr(x) -#define USBUSART2_DMA_TX_CHAN DMA_CHANNEL6 -#define USBUSART2_DMA_TX_IRQ NVIC_DMA1_CHANNEL6_IRQ -#define USBUSART2_DMA_TX_ISR(x) dma1_channel6_isr(x) -#define USBUSART2_DMA_RX_CHAN DMA_CHANNEL7 -#define USBUSART2_DMA_RX_IRQ NVIC_DMA1_CHANNEL7_IRQ -#define USBUSART2_DMA_RX_ISR(x) dma1_channel7_isr(x) +#define USBUSART2_DMA_TX_CHAN DMA_CHANNEL7 +#define USBUSART2_DMA_TX_IRQ NVIC_DMA1_CHANNEL7_IRQ +#define USBUSART2_DMA_TX_ISR(x) dma1_channel7_isr(x) +#define USBUSART2_DMA_RX_CHAN DMA_CHANNEL6 +#define USBUSART2_DMA_RX_IRQ NVIC_DMA1_CHANNEL6_IRQ +#define USBUSART2_DMA_RX_ISR(x) dma1_channel6_isr(x) #define TRACE_TIM TIM3 #define TRACE_TIM_CLK_EN() rcc_periph_clock_enable(RCC_TIM3) diff --git a/src/platforms/stm32/usbuart.c b/src/platforms/stm32/usbuart.c index 332ec57..7e0b6de 100644 --- a/src/platforms/stm32/usbuart.c +++ b/src/platforms/stm32/usbuart.c @@ -274,7 +274,8 @@ void usbuart_usb_out_cb(usbd_device *dev, uint8_t ep) /* Don't bother if uart is disabled. * This will be the case on mini while we're being debugged. */ - if(!(RCC_APB2ENR & RCC_APB2ENR_USART1EN)) + if(!(RCC_APB2ENR & RCC_APB2ENR_USART1EN) && + !(RCC_APB1ENR & RCC_APB1ENR_USART2EN)) { usbd_ep_nak_set(dev, CDCACM_UART_ENDPOINT, 0); return;