🔧 Some STM32 UART Sanity Checks (#24795)
This commit is contained in:
parent
682a9b6fbe
commit
4d9bf91edc
@ -1152,7 +1152,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatic backlash, position and hotend offset calibration
|
* Automatic backlash, position, and hotend offset calibration
|
||||||
*
|
*
|
||||||
* Enable G425 to run automatic calibration using an electrically-
|
* Enable G425 to run automatic calibration using an electrically-
|
||||||
* conductive cube, bolt, or washer mounted on the bed.
|
* conductive cube, bolt, or washer mounted on the bed.
|
||||||
|
@ -40,13 +40,15 @@
|
|||||||
#if SERIAL_IN_USE(0)
|
#if SERIAL_IN_USE(0)
|
||||||
// D0-D1. No known conflicts.
|
// D0-D1. No known conflicts.
|
||||||
#endif
|
#endif
|
||||||
#if NOT_TARGET(__AVR_ATmega644P__, __AVR_ATmega1284P__)
|
#if SERIAL_IN_USE(1)
|
||||||
#if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19))
|
#if NOT_TARGET(__AVR_ATmega644P__, __AVR_ATmega1284P__)
|
||||||
#error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
|
#if CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19)
|
||||||
#endif
|
#error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
|
||||||
#else
|
#endif
|
||||||
#if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11))
|
#else
|
||||||
#error "Serial Port 1 pin D10 and/or D11 conflicts with another pin on the board."
|
#if CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11)
|
||||||
|
#error "Serial Port 1 pin D10 and/or D11 conflicts with another pin on the board."
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if SERIAL_IN_USE(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17))
|
#if SERIAL_IN_USE(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17))
|
||||||
|
@ -50,3 +50,62 @@
|
|||||||
#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32H7xx, STM32F4xx, STM32F1xx)
|
#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32H7xx, STM32F4xx, STM32F1xx)
|
||||||
#error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32H7, STM32F4 and STM32F1 hardware."
|
#error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32H7, STM32F4 and STM32F1 hardware."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for common serial pin conflicts
|
||||||
|
*/
|
||||||
|
#define _CHECK_SERIAL_PIN(N) (( \
|
||||||
|
BTN_EN1 == N || DOGLCD_CS == N || HEATER_BED_PIN == N || FAN_PIN == N || \
|
||||||
|
SDIO_D2_PIN == N || SDIO_D3_PIN == N || SDIO_CK_PIN == N || SDIO_CMD_PIN == N \
|
||||||
|
))
|
||||||
|
#define CHECK_SERIAL_PIN(T,N) defined(UART##N##_##T##_PIN) && _CHECK_SERIAL_PIN(UART##N##_##T##_PIN)
|
||||||
|
#if SERIAL_IN_USE(1)
|
||||||
|
#if CHECK_SERIAL_PIN(TX,1)
|
||||||
|
#error "Serial Port 1 TX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#if CHECK_SERIAL_PIN(RX,1)
|
||||||
|
#error "Serial Port 1 RX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if SERIAL_IN_USE(2)
|
||||||
|
#if CHECK_SERIAL_PIN(TX,2)
|
||||||
|
#error "Serial Port 2 TX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#if CHECK_SERIAL_PIN(RX,2)
|
||||||
|
#error "Serial Port 2 RX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if SERIAL_IN_USE(3)
|
||||||
|
#if CHECK_SERIAL_PIN(TX,3)
|
||||||
|
#error "Serial Port 3 TX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#if CHECK_SERIAL_PIN(RX,3)
|
||||||
|
#error "Serial Port 3 RX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if SERIAL_IN_USE(4)
|
||||||
|
#if CHECK_SERIAL_PIN(TX,4)
|
||||||
|
#error "Serial Port 4 TX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#if CHECK_SERIAL_PIN(RX,4)
|
||||||
|
#error "Serial Port 4 RX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if SERIAL_IN_USE(5)
|
||||||
|
#if CHECK_SERIAL_PIN(TX,5)
|
||||||
|
#error "Serial Port 5 TX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#if CHECK_SERIAL_PIN(RX,5)
|
||||||
|
#error "Serial Port 5 RX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if SERIAL_IN_USE(6)
|
||||||
|
#if CHECK_SERIAL_PIN(TX,6)
|
||||||
|
#error "Serial Port 6 TX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#if CHECK_SERIAL_PIN(RX,6)
|
||||||
|
#error "Serial Port 6 RX IO pins conflict with another pin on the board."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#undef CHECK_SERIAL_PIN
|
||||||
|
#undef _CHECK_SERIAL_PIN
|
||||||
|
@ -2446,11 +2446,11 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
// Flag the indexed hardware serial ports in use
|
// Flag the indexed hardware serial ports in use
|
||||||
#define SERIAL_IN_USE(N) ( (defined(SERIAL_PORT) && SERIAL_PORT == N) \
|
#define SERIAL_IN_USE(N) ( (defined(SERIAL_PORT) && N == SERIAL_PORT) \
|
||||||
|| (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == N) \
|
|| (defined(SERIAL_PORT_2) && N == SERIAL_PORT_2) \
|
||||||
|| (defined(SERIAL_PORT_3) && SERIAL_PORT_3 == N) \
|
|| (defined(SERIAL_PORT_3) && N == SERIAL_PORT_3) \
|
||||||
|| (defined(MMU2_SERIAL_PORT) && MMU2_SERIAL_PORT == N) \
|
|| (defined(MMU2_SERIAL_PORT) && N == MMU2_SERIAL_PORT) \
|
||||||
|| (defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT == N) )
|
|| (defined(LCD_SERIAL_PORT) && N == LCD_SERIAL_PORT) )
|
||||||
|
|
||||||
// Flag the named hardware serial ports in use
|
// Flag the named hardware serial ports in use
|
||||||
#define TMC_UART_IS(A,N) (defined(A##_HARDWARE_SERIAL) && (CAT(HW_,A##_HARDWARE_SERIAL) == HW_Serial##N || CAT(HW_,A##_HARDWARE_SERIAL) == HW_MSerial##N))
|
#define TMC_UART_IS(A,N) (defined(A##_HARDWARE_SERIAL) && (CAT(HW_,A##_HARDWARE_SERIAL) == HW_Serial##N || CAT(HW_,A##_HARDWARE_SERIAL) == HW_MSerial##N))
|
||||||
|
@ -2231,6 +2231,80 @@
|
|||||||
REPORT_NAME_DIGITAL(__LINE__, TFT_RESET_PIN)
|
REPORT_NAME_DIGITAL(__LINE__, TFT_RESET_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hardware UART
|
||||||
|
//
|
||||||
|
#if SERIAL_IN_USE(1)
|
||||||
|
#if PIN_EXISTS(UART1_TX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART1_TX_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(UART1_RX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART1_RX_PIN)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if SERIAL_IN_USE(2)
|
||||||
|
#if PIN_EXISTS(UART2_TX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART2_TX_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(UART2_RX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART2_RX_PIN)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if SERIAL_IN_USE(3)
|
||||||
|
#if PIN_EXISTS(UART3_TX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART3_TX_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(UART3_RX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART3_RX_PIN)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if SERIAL_IN_USE(4)
|
||||||
|
#if PIN_EXISTS(UART4_TX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART4_TX_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(UART4_RX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART4_RX_PIN)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if SERIAL_IN_USE(5)
|
||||||
|
#if PIN_EXISTS(UART5_TX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART5_TX_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(UART5_RX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART5_RX_PIN)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if SERIAL_IN_USE(6)
|
||||||
|
#if PIN_EXISTS(UART6_TX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART6_TX_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(UART6_RX)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, UART6_RX_PIN)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// SDIO
|
||||||
|
//
|
||||||
|
#if PIN_EXISTS(SDIO_D0)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, SDIO_D0_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(SDIO_D1)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, SDIO_D1_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(SDIO_D2)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, SDIO_D2_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(SDIO_D3)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, SDIO_D3_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(SDIO_CK)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, SDIO_CK_PIN)
|
||||||
|
#endif
|
||||||
|
#if PIN_EXISTS(SDIO_CMD)
|
||||||
|
REPORT_NAME_DIGITAL(__LINE__, SDIO_CMD_PIN)
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
//
|
//
|
||||||
|
@ -173,14 +173,14 @@
|
|||||||
* GND | 9 10 | 5V
|
* GND | 9 10 | 5V
|
||||||
* ------
|
* ------
|
||||||
*/
|
*/
|
||||||
#define EXP3_01_PIN PC6
|
#define EXP3_01_PIN PC6
|
||||||
#define EXP3_02_PIN PB2
|
#define EXP3_02_PIN PB2
|
||||||
#define EXP3_03_PIN PB10
|
#define EXP3_03_PIN PB10
|
||||||
#define EXP3_04_PIN PB11
|
#define EXP3_04_PIN PB11
|
||||||
#define EXP3_05_PIN PB14
|
#define EXP3_05_PIN PB14
|
||||||
#define EXP3_06_PIN PB13
|
#define EXP3_06_PIN PB13
|
||||||
#define EXP3_07_PIN PB12
|
#define EXP3_07_PIN PB12
|
||||||
#define EXP3_08_PIN PB15
|
#define EXP3_08_PIN PB15
|
||||||
|
|
||||||
#elif EITHER(VET6_12864_LCD, DWIN_VET6_CREALITY_LCD)
|
#elif EITHER(VET6_12864_LCD, DWIN_VET6_CREALITY_LCD)
|
||||||
|
|
||||||
@ -194,14 +194,14 @@
|
|||||||
* GND | 9 10 | 5V
|
* GND | 9 10 | 5V
|
||||||
* ------
|
* ------
|
||||||
*/
|
*/
|
||||||
#define EXP3_01_PIN -1
|
#define EXP3_01_PIN -1
|
||||||
#define EXP3_02_PIN PC5
|
#define EXP3_02_PIN PC5
|
||||||
#define EXP3_03_PIN PB10
|
#define EXP3_03_PIN PB10
|
||||||
#define EXP3_04_PIN -1
|
#define EXP3_04_PIN -1
|
||||||
#define EXP3_05_PIN PA6
|
#define EXP3_05_PIN PA6
|
||||||
#define EXP3_06_PIN PA5
|
#define EXP3_06_PIN PA5
|
||||||
#define EXP3_07_PIN PA4
|
#define EXP3_07_PIN PA4
|
||||||
#define EXP3_08_PIN PA7
|
#define EXP3_08_PIN PA7
|
||||||
|
|
||||||
#elif EITHER(CR10_STOCKDISPLAY, FYSETC_MINI_12864_2_1)
|
#elif EITHER(CR10_STOCKDISPLAY, FYSETC_MINI_12864_2_1)
|
||||||
#error "Define RET6_12864_LCD or VET6_12864_LCD to select pins for the LCD with the Creality V4 controller."
|
#error "Define RET6_12864_LCD or VET6_12864_LCD to select pins for the LCD with the Creality V4 controller."
|
||||||
@ -283,3 +283,26 @@
|
|||||||
#define NEOPIXEL_PIN PA13
|
#define NEOPIXEL_PIN PA13
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Pins for documentation and sanity checks only.
|
||||||
|
// Changing these will not change the pin they are on.
|
||||||
|
|
||||||
|
// Hardware UART pins
|
||||||
|
#define UART1_TX_PIN PA9 // default uses CH340 RX
|
||||||
|
#define UART1_RX_PIN PA10 // default uses CH340 TX
|
||||||
|
#define UART2_TX_PIN PA2 // default uses HEATER_BED_PIN
|
||||||
|
#define UART2_RX_PIN PA3 // not connected
|
||||||
|
#define UART3_TX_PIN PB10 // default uses LCD connector
|
||||||
|
#define UART3_RX_PIN PB11 // default uses LCD connector
|
||||||
|
#define UART4_TX_PIN PC10 // default uses sdcard SDIO_D2
|
||||||
|
#define UART4_RX_PIN PC11 // default uses sdcard SDIO_D3
|
||||||
|
#define UART5_TX_PIN PC12 // default uses sdcard SDIO_CK
|
||||||
|
#define UART5_RX_PIN PD2 // default uses sdcard SDIO_CMD
|
||||||
|
|
||||||
|
// SDIO pins
|
||||||
|
#define SDIO_D0_PIN PC8
|
||||||
|
#define SDIO_D1_PIN PC9
|
||||||
|
#define SDIO_D2_PIN PC10
|
||||||
|
#define SDIO_D3_PIN PC11
|
||||||
|
#define SDIO_CK_PIN PC12
|
||||||
|
#define SDIO_CMD_PIN PD2
|
||||||
|
Loading…
Reference in New Issue
Block a user