@@ -300,11 +300,13 @@ __STATIC_FORCEINLINE uint32_t PIN_SWDIO_IN(void)
300300*/
301301__STATIC_FORCEINLINE void PIN_SWDIO_OUT (uint32_t bit )
302302{
303+ #ifndef SWDP_SGPIO
303304 if (bit & 0x1 ) {
304305 X_SET (SWDIO );
305306 } else {
306307 X_CLR (SWDIO );
307308 }
309+ #endif
308310}
309311
310312/** SWDIO I/O pin: Switch to Output mode (used in SWD mode only).
@@ -313,8 +315,10 @@ called prior \ref PIN_SWDIO_OUT function calls.
313315*/
314316__STATIC_FORCEINLINE void PIN_SWDIO_OUT_ENABLE (void )
315317{
318+ #ifndef SWDP_SGPIO
316319 X_SET (SWDIO_TXE );
317320 X_DIR_OUT (SWDIO );
321+ #endif
318322}
319323
320324/** SWDIO I/O pin: Switch to Input mode (used in SWD mode only).
@@ -323,8 +327,10 @@ called prior \ref PIN_SWDIO_IN function calls.
323327*/
324328__STATIC_FORCEINLINE void PIN_SWDIO_OUT_DISABLE (void )
325329{
330+ #ifndef SWDP_SGPIO
326331 X_DIR_IN (SWDIO );
327332 X_CLR (SWDIO_TXE );
333+ #endif
328334}
329335
330336
@@ -506,11 +512,36 @@ __STATIC_INLINE void DAP_SETUP(void)
506512
507513 while (!(LPC_CCU1 -> CLK_M4_GPIO_STAT & CCU_CLK_STAT_RUN ));
508514
515+ #ifdef SWDP_SGPIO
516+ // Normal-drive and high-speed pins support a programmable slew rate (bit EHS).
517+ // The typical frequencies supported are 50 MHz/80 MHz for normal-drive pins
518+ // and 75 MHz/204 MHz for high-speed pins.
519+ // See "Programmable slew rate" and "Pin configuration registers for normal-drive pins" UM10503.
520+ //
521+ // The clock pins CLK0 to CLK3 and P3_3 support a programmable high-speed
522+ // output with typical frequencies of 75 MHz or 204 MHz depending on the slew rate setting
523+ // See "High-speed pins" and "Pin configuration registers for high-speed pins" UM10503.
524+ //
525+ // High-drive pins support the programmable glitch filter
526+ // but not the programmable slew rate.
527+ // See "High-drive pins" and "Pin configuration registers for high-drive pins" UM10503.
528+
529+ // SWCLK/TCK: SGPIO11. P1_17 is a High-drive pin.
530+ // FILTER_DISABLE: The filter has to be disabled for frequencies greater than 30 MHz.
531+ scu_pinmux (1 , 17 , PUP_DISABLE | PDN_DISABLE | INBUF_ENABLE | FILTER_DISABLE | DRIVE_4MA , FUNC6 );
532+
533+ // SWDIO/TMS: SGPIO14. P1_6 is a Normal-drive pin.
534+ scu_pinmux (1 , 6 , PUP_DISABLE | PDN_DISABLE | INBUF_ENABLE | FILTER_DISABLE | SLEWRATE_FAST , FUNC6 );
535+
536+ // SWDIO/TXEN: SGPIO15. P1_5 is a Normal-drive pin.
537+ scu_pinmux (1 , 5 , PUP_DISABLE | PDN_DISABLE | INBUF_ENABLE | FILTER_DISABLE | SLEWRATE_FAST , FUNC6 );
538+ #else
509539 /* Configure I/O pins: function number, input buffer enabled, */
510540 /* no pull-up/down */
511541 scu_pinmux (1 , 17 , GPIO_NOPULL , FUNC0 ); /* SWCLK/TCK: GPIO0[12] */
512542 scu_pinmux (1 , 6 , GPIO_NOPULL , FUNC0 ); /* SWDIO/TMS: GPIO1[9] */
513543 scu_pinmux (1 , 5 , GPIO_NOPULL , FUNC0 ); /* SWDIO_OE: GPIO1[8] */
544+ #endif
514545}
515546
516547/** Reset Target Device with custom specific I/O pin or command sequence.
0 commit comments