Skip to content

Commit

Permalink
🩹Free debug pins in HC32 HAL (#26985)
Browse files Browse the repository at this point in the history
implements DISABLE_DEBUG and DISABLE_JTAG in HAL
  • Loading branch information
shadow578 authored Apr 28, 2024
1 parent a2f024f commit a805872
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
19 changes: 19 additions & 0 deletions Marlin/src/HAL/HC32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,25 @@
#define GET_PIN_MAP_INDEX(pin) pin
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)

//
// Debug port disable
// JTMS / SWDIO = PA13
// JTCK / SWCLK = PA14
// JTDI = PA15
// JTDO = PB3
// NJTRST = PB4
//
#define DBG_SWCLK _BV(0)
#define DBG_SWDIO _BV(1)
#define DBG_TDO _BV(2)
#define DBG_TDI _BV(3)
#define DBG_TRST _BV(4)
#define DBG_ALL (DBG_SWCLK | DBG_SWDIO | DBG_TDO | DBG_TDI | DBG_TRST)

#define JTAGSWD_RESET() PORT_DebugPortSetting(DBG_ALL, Enable);
#define JTAG_DISABLE() PORT_DebugPortSetting(DBG_TDO | DBG_TDI | DBG_TRST, Disable);
#define JTAGSWD_DISABLE() PORT_DebugPortSetting(DBG_ALL, Disable);

//
// MarlinHAL implementation
//
Expand Down
7 changes: 5 additions & 2 deletions Marlin/src/pins/hc32f4/pins_AQUILA_101.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@
#endif

//
// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
// Release JTAG pins but keep SWD enabled
// - PA15 (JTDI / USART2 RX)
// - PB3 (JTDO / E0_DIR)
// - PB4 (NJTRST / E0_STEP)
//
//#define DISABLE_DEBUG
//#define DISABLE_JTAG
#define DISABLE_JTAG

//
// EEPROM
Expand Down
7 changes: 5 additions & 2 deletions Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@
#endif

//
// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
// Release JTAG pins but keep SWD enabled
// - PA15 (JTDI / E0_DIR_PIN)
// - PB3 (JTDO / E0_STEP_PIN)
// - PB4 (NJTRST / E0_ENABLE_PIN)
//
//#define DISABLE_DEBUG
//#define DISABLE_JTAG
#define DISABLE_JTAG

//
// EEPROM
Expand Down

0 comments on commit a805872

Please sign in to comment.