Skip to content

Commit a805872

Browse files
authored
🩹Free debug pins in HC32 HAL (#26985)
implements DISABLE_DEBUG and DISABLE_JTAG in HAL
1 parent a2f024f commit a805872

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

Marlin/src/HAL/HC32/HAL.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,25 @@
148148
#define GET_PIN_MAP_INDEX(pin) pin
149149
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
150150

151+
//
152+
// Debug port disable
153+
// JTMS / SWDIO = PA13
154+
// JTCK / SWCLK = PA14
155+
// JTDI = PA15
156+
// JTDO = PB3
157+
// NJTRST = PB4
158+
//
159+
#define DBG_SWCLK _BV(0)
160+
#define DBG_SWDIO _BV(1)
161+
#define DBG_TDO _BV(2)
162+
#define DBG_TDI _BV(3)
163+
#define DBG_TRST _BV(4)
164+
#define DBG_ALL (DBG_SWCLK | DBG_SWDIO | DBG_TDO | DBG_TDI | DBG_TRST)
165+
166+
#define JTAGSWD_RESET() PORT_DebugPortSetting(DBG_ALL, Enable);
167+
#define JTAG_DISABLE() PORT_DebugPortSetting(DBG_TDO | DBG_TDI | DBG_TRST, Disable);
168+
#define JTAGSWD_DISABLE() PORT_DebugPortSetting(DBG_ALL, Disable);
169+
151170
//
152171
// MarlinHAL implementation
153172
//

Marlin/src/pins/hc32f4/pins_AQUILA_101.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,13 @@
4545
#endif
4646

4747
//
48-
// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
48+
// Release JTAG pins but keep SWD enabled
49+
// - PA15 (JTDI / USART2 RX)
50+
// - PB3 (JTDO / E0_DIR)
51+
// - PB4 (NJTRST / E0_STEP)
4952
//
5053
//#define DISABLE_DEBUG
51-
//#define DISABLE_JTAG
54+
#define DISABLE_JTAG
5255

5356
//
5457
// EEPROM

Marlin/src/pins/hc32f4/pins_CREALITY_ENDER2P_V24S4.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@
4646
#endif
4747

4848
//
49-
// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
49+
// Release JTAG pins but keep SWD enabled
50+
// - PA15 (JTDI / E0_DIR_PIN)
51+
// - PB3 (JTDO / E0_STEP_PIN)
52+
// - PB4 (NJTRST / E0_ENABLE_PIN)
5053
//
5154
//#define DISABLE_DEBUG
52-
//#define DISABLE_JTAG
55+
#define DISABLE_JTAG
5356

5457
//
5558
// EEPROM

0 commit comments

Comments
 (0)