From 8d4d7631469f2f5b9db0557314fa30a6b940e140 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Tue, 27 Feb 2018 20:14:27 -0800 Subject: [PATCH] debug console works --- board/config.h | 4 ---- board/gpio.h | 3 ++- board/pedal/main.c | 15 +++++++++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/board/config.h b/board/config.h index b671adab6bcf73..e83429980d4163 100644 --- a/board/config.h +++ b/board/config.h @@ -14,15 +14,11 @@ #define USB_VID 0xbbaa -#ifdef PEDAL -#define USB_PID 0xdd00 -#else #ifdef BOOTSTUB #define USB_PID 0xddee #else #define USB_PID 0xddcc #endif -#endif #include #define NULL ((void*)0) diff --git a/board/gpio.h b/board/gpio.h index ac3b93612a7d30..dd96f16d88afa9 100644 --- a/board/gpio.h +++ b/board/gpio.h @@ -450,9 +450,10 @@ void early() { if (enter_bootloader_mode == ENTER_BOOTLOADER_MAGIC) { + #ifdef PANDA set_esp_mode(ESP_DISABLED); + #endif set_led(LED_GREEN, 1); - jump_to_bootloader(); } diff --git a/board/pedal/main.c b/board/pedal/main.c index 8fb45be3dca086..e4415164cd460a 100644 --- a/board/pedal/main.c +++ b/board/pedal/main.c @@ -7,7 +7,6 @@ #include "../config.h" #include "drivers/drivers.h" - #include "drivers/llgpio.h" #include "gpio.h" @@ -207,10 +206,18 @@ void pedal() { } int main() { + __disable_irq(); + // init devices clock_init(); + periph_init(); gpio_init(); +#ifdef PEDAL_USB + // enable USB + usb_init(); +#endif + // pedal stuff dac_init(); can_init(1); @@ -219,14 +226,14 @@ int main() { // 48mhz / 65536 ~= 732 timer_init(TIM3, 15); - puts("**** INTERRUPTS ON ****\n"); - __disable_irq(); - + // needed? NVIC_EnableIRQ(CAN1_TX_IRQn); NVIC_EnableIRQ(CAN1_RX0_IRQn); NVIC_EnableIRQ(CAN1_SCE_IRQn); NVIC_EnableIRQ(TIM3_IRQn); + + puts("**** INTERRUPTS ON ****\n"); __enable_irq(); // main pedal loop