From 9e2d49e225aa1dd0d8c53ee29a18576e2c28c6d8 Mon Sep 17 00:00:00 2001 From: Firmware Batman Date: Sat, 29 Jul 2017 19:50:35 -0700 Subject: [PATCH] and fixed a UART noise bug --- board/bootstub.c | 1 - board/main.c | 8 ++++++-- board/spi_flasher.h | 3 --- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/board/bootstub.c b/board/bootstub.c index 16bc992e4..e53a6d2fe 100644 --- a/board/bootstub.c +++ b/board/bootstub.c @@ -23,7 +23,6 @@ #include "drivers/usb.h" //#include "drivers/uart.h" -void uart_init(USART_TypeDef *u, int baud) {} int puts(const char *a) { return 0; } void puth(unsigned int i) {} diff --git a/board/main.c b/board/main.c index f4333d48f..52b58ff22 100644 --- a/board/main.c +++ b/board/main.c @@ -431,8 +431,12 @@ int main() { puts(is_entering_bootmode ? " ESP wants bootmode\n" : " no bootmode\n"); gpio_init(); - // enable main uart - uart_init(USART2, 115200); + // enable main uart if it's connected + if (has_external_debug_serial) { + // WEIRDNESS: without this gate around the UART, it would "crash", but only if the ESP is enabled + // assuming it's because the lines were left floating and spurious noise was on them + uart_init(USART2, 115200); + } #ifdef PANDA // enable ESP uart diff --git a/board/spi_flasher.h b/board/spi_flasher.h index 4159c48c5..894dd20be 100644 --- a/board/spi_flasher.h +++ b/board/spi_flasher.h @@ -140,9 +140,6 @@ void soft_flasher_start() { set_gpio_alternate(GPIOA, 12, GPIO_AF10_OTG_FS); GPIOA->OSPEEDR = GPIO_OSPEEDER_OSPEEDR11 | GPIO_OSPEEDER_OSPEEDR12; - // enable main uart - uart_init(USART2, 115200); - // flasher spi_init();