2017-01-30 10:07 AM
I'm using a 64-pin STM32F303 in a design and looking into using some of the SW Debug Pins for LEDs. I've read through the Reference and Programming Manuals and Datasheets for details but am a little confused on some of the specifics and would like some clarification.
How I believe re-assignment of DBG pins as GPIOs works:
Thanks,
Ben
2017-01-30 10:20 AM
Reg question 2: AFIO->MAPR is for F1, all newer devices have GPIOx_AFRL and GPIOx_AFRH. Look e.g. at rm0316 Chapter 33.4.1 for changing assignment. As Alternate function for debug is 0 and this is the reset value, you only have to change mode
2017-01-30 11:33 AM
Thanks, but I have already seen these. As per the note in 33.4.4:
For user software designs, note that:
To release the debug pins, remember that they will be first configured either in input-pull-up (nTRST, TMS, TDI) or pull-down (TCK) or output tristate (TDO) for a certain duration after reset until the instant when the user software releases the pins.
When debug pins (JTAG or SW or TRACE) are mapped, changing the corresponding IO pin configuration in the IOPORT controller has no effect.
So, unless I'm misunderstanding something, if JTAG or SW Debug Port is enabled changing the mode has no effect.
It appears, from documentation, that the JTAG DP is auto-enabled on RESET, and can be changed to SW-DP by the debugger, therefore;
1) How to I detect which Debug Port is currently selected?
2) How to I disable the Debug Ports?
2017-01-30 01:59 PM
> So, unless I'm misunderstanding something, if JTAG or SW Debug Port is enabled changing the mode has no effect.
In this context, *enabled* means that the externally connected debugging gadget (e.g. STLink, JLink or similar) has performed an initial sequence on the pins, 'waking up' the on-chip debug facilities.
If you reset the chip without a debugger, you don't need to be bothered by the Debug facilities, simply change the pins mode in GPIO, as Uwe said above.
JW