From 66f486c43bb26bebadcdefb3e55ad8e16d849a7b Mon Sep 17 00:00:00 2001 From: rusefi Date: Fri, 10 May 2019 19:06:28 -0400 Subject: [PATCH] USB pins are not registered in pin_repository fix #797 --- firmware/config/boards/nucleo_f767/board.h | 6 +++--- firmware/config/boards/st_stm32f4/board.h | 6 +++--- firmware/hw_layer/serial_over_usb/usbconsole.c | 12 +++--------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/firmware/config/boards/nucleo_f767/board.h b/firmware/config/boards/nucleo_f767/board.h index 64d756ecea..059511d713 100644 --- a/firmware/config/boards/nucleo_f767/board.h +++ b/firmware/config/boards/nucleo_f767/board.h @@ -680,9 +680,9 @@ PIN_AFIO_AF(GPIOA_ARD_D11, 11U)) #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_USB_SOF, 10U) | \ PIN_AFIO_AF(GPIOA_USB_VBUS, 0U) | \ - PIN_AFIO_AF(GPIOA_PIN10, EFI_USB_AF) | \ - PIN_AFIO_AF(GPIOA_PIN11, EFI_USB_AF) | \ - PIN_AFIO_AF(GPIOA_PIN12, EFI_USB_AF) | \ + PIN_AFIO_AF(GPIOA_PIN10, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN11, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN12, 0U) | \ PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \ PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \ PIN_AFIO_AF(GPIOA_ZIO_D20, 0U)) diff --git a/firmware/config/boards/st_stm32f4/board.h b/firmware/config/boards/st_stm32f4/board.h index b4da8fd326..2581f8a4f7 100644 --- a/firmware/config/boards/st_stm32f4/board.h +++ b/firmware/config/boards/st_stm32f4/board.h @@ -401,9 +401,9 @@ PIN_AFIO_AF(GPIOA_PIN7, 5U)) #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0U) | \ PIN_AFIO_AF(GPIOA_VBUS_FS, 0U) | \ - PIN_AFIO_AF(GPIOA_PIN10, EFI_USB_AF) | \ - PIN_AFIO_AF(GPIOA_PIN11, EFI_USB_AF) | \ - PIN_AFIO_AF(GPIOA_PIN12, EFI_USB_AF) | \ + PIN_AFIO_AF(GPIOA_PIN10, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN11, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN12, 0U) | \ PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \ PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \ PIN_AFIO_AF(GPIOA_PIN15, 0U)) diff --git a/firmware/hw_layer/serial_over_usb/usbconsole.c b/firmware/hw_layer/serial_over_usb/usbconsole.c index abcbe82422..5deeaa7843 100644 --- a/firmware/hw_layer/serial_over_usb/usbconsole.c +++ b/firmware/hw_layer/serial_over_usb/usbconsole.c @@ -41,15 +41,9 @@ void usb_serial_start(void) { usbConnectBus(serusbcfg.usbp); #if HAL_USE_SERIAL - /** - * todo: start taking USB pins from configuration? - * at the moment USB pinout is hard-coded in board.h file - * - * PA10/PA11/PA12 - * #define GPIOA_OTG_FS_ID 10 - * #define GPIOA_OTG_FS_DM 11 - * #define GPIOA_OTG_FS_DP 12 - */ + efiSetPadMode("USB ID", EFI_USB_SERIAL_ID, PAL_MODE_ALTERNATE(EFI_USB_AF)); + efiSetPadMode("USB ID", EFI_USB_SERIAL_DM, PAL_MODE_ALTERNATE(EFI_USB_AF)); + efiSetPadMode("USB ID", EFI_USB_SERIAL_DP, PAL_MODE_ALTERNATE(EFI_USB_AF)); /* * Activates the serial driver 2 using the driver default configuration. */