Skip to content

Commit

Permalink
Remove external debug UART support (commaai#1159)
Browse files Browse the repository at this point in the history
cleanup external debug serial
  • Loading branch information
robbederks committed Nov 14, 2022
1 parent c75c276 commit 9db0ae7
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 33 deletions.
1 change: 0 additions & 1 deletion board/bootstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ int main(void) {

disable_interrupts();
clock_init();
detect_external_debug_serial();
detect_board_type();

if (enter_bootloader_mode == ENTER_SOFTLOADER_MAGIC) {
Expand Down
10 changes: 2 additions & 8 deletions board/drivers/uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,8 @@ void clear_uart_buff(uart_ring *q) {

// ************************ High-level debug functions **********************
void putch(const char a) {
if (has_external_debug_serial) {
// assuming debugging is important if there's external serial connected
while (!putc(&uart_ring_debug, a));

} else {
// misra-c2012-17.7: serial debug function, ok to ignore output
(void)injectc(&uart_ring_debug, a);
}
// misra-c2012-17.7: serial debug function, ok to ignore output
(void)injectc(&uart_ring_debug, a);
}

void puts(const char *a) {
Expand Down
1 change: 0 additions & 1 deletion board/early_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ void early_initialization(void) {
// early GPIOs float everything
early_gpio_float();

detect_external_debug_serial();
detect_board_type();

if (enter_bootloader_mode == ENTER_BOOTLOADER_MAGIC) {
Expand Down
9 changes: 0 additions & 9 deletions board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ int main(void) {
// init early devices
clock_init();
peripherals_init();
detect_external_debug_serial();
detect_board_type();
adc_init();

Expand All @@ -327,21 +326,13 @@ int main(void) {

puts("Config:\n");
puts(" Board type: "); puts(current_board->board_type); puts("\n");
puts(has_external_debug_serial ? " Real serial\n" : " USB serial\n");

// init board
current_board->init();

// panda has an FPU, let's use it!
enable_fpu();

// 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(&uart_ring_debug, 115200);
}

if (current_board->has_gps) {
uart_init(&uart_ring_gps, 9600);
} else {
Expand Down
1 change: 0 additions & 1 deletion board/pedal/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ int main(void) {
// init devices
clock_init();
peripherals_init();
detect_external_debug_serial();
detect_board_type();

// init board
Expand Down
7 changes: 0 additions & 7 deletions board/stm32fx/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,3 @@ void detect_board_type(void) {
#endif
#endif
}

bool has_external_debug_serial = 0;

void detect_external_debug_serial(void) {
// detect if external serial debugging is present
has_external_debug_serial = detect_with_pull(GPIOA, 3, PULL_DOWN);
}
6 changes: 0 additions & 6 deletions board/stm32h7/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,3 @@ void detect_board_type(void) {
puts("Hardware type is UNKNOWN!\n");
}
}

bool has_external_debug_serial = 0;
void detect_external_debug_serial(void) {
// detect if external serial debugging is present
has_external_debug_serial = detect_with_pull(GPIOA, 3, PULL_DOWN) || detect_with_pull(GPIOE, 7, PULL_DOWN);
}

0 comments on commit 9db0ae7

Please sign in to comment.