From ec37239e53262a97c514f8948b3edc73dcfe1188 Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Sun, 14 Feb 2016 11:07:57 -0800 Subject: [PATCH] stmhal: Improvements to the STM32F4DISC UART config settings. --- stmhal/boards/STM32F4DISC/mpconfigboard.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/stmhal/boards/STM32F4DISC/mpconfigboard.h b/stmhal/boards/STM32F4DISC/mpconfigboard.h index 4b0745259b..01202e0c95 100644 --- a/stmhal/boards/STM32F4DISC/mpconfigboard.h +++ b/stmhal/boards/STM32F4DISC/mpconfigboard.h @@ -23,18 +23,35 @@ #define MICROPY_HW_CLK_PLLQ (7) // UART config +#if 0 +// A9 is used for USB VBUS detect, and A10 is used for USB_FS_ID. +// UART1 is also on PB6/7 but PB6 is tied to the Audio SCL line. +// Without board modifications, this makes UART1 unusable on this board. #define MICROPY_HW_UART1_PORT (GPIOA) #define MICROPY_HW_UART1_PINS (GPIO_PIN_9 | GPIO_PIN_10) +#endif + #define MICROPY_HW_UART2_PORT (GPIOA) #define MICROPY_HW_UART2_PINS (GPIO_PIN_2 | GPIO_PIN_3) #define MICROPY_HW_UART2_RTS (GPIO_PIN_1) #define MICROPY_HW_UART2_CTS (GPIO_PIN_0) + #define MICROPY_HW_UART3_PORT (GPIOD) #define MICROPY_HW_UART3_PINS (GPIO_PIN_8 | GPIO_PIN_9) #define MICROPY_HW_UART3_RTS (GPIO_PIN_12) #define MICROPY_HW_UART3_CTS (GPIO_PIN_11) + +#if MICROPY_HW_HAS_SWITCH == 0 +// NOTE: A0 also connects to the user switch. To use UART4 you should +// set MICROPY_HW_HAS_SWITCH to 0, and also remove SB20 (on the back +// of the board near the USER switch). #define MICROPY_HW_UART4_PORT (GPIOA) #define MICROPY_HW_UART4_PINS (GPIO_PIN_0 | GPIO_PIN_1) +#endif + +// NOTE: PC7 is connected to MCLK on the Audio chip. This is an input signal +// so I think as long as you're not using the audio chip then it should +// be fine to use as a UART pin. #define MICROPY_HW_UART6_PORT (GPIOC) #define MICROPY_HW_UART6_PINS (GPIO_PIN_6 | GPIO_PIN_7)