-
Notifications
You must be signed in to change notification settings - Fork 1
Target trace usage (UART, SWO, RTT)
- Connect the UART pins to MioLink (target's TX to probe's RX and vice versa, target's RX to probe's TX);
- Open a terminal program (e.g., Putty) and connect to MioLink's second VCOM with the same parameters configured on the target (example on the screenshot, 115200 8N1):
- That's it!
When the target is debugged via the SWD interface, the JTAG TDI and TDO pins can be used as UART TX and RX, respectively (TDI - MioLink TX, TDO - MioLink RX).
This allows, for example, using a single 10-pin connector for both target debugging and debug output from the target.
To enable this feature, add the command monitor uart_on_tdi_tdo enable
to the GDB commands.
To disable, use monitor uart_on_tdi_tdo disable
.
Note that after changing this setting, you need to reopen the port in the terminal program.
Also, this setting is NOT saved in non-volatile memory, so you'll need to re-enter the command after restarting the probe.
- Connect the debugger's SWO pin to the target's SWO pin;
- Configure TRACESWO on the target side. MioLink currently supports only UART mode (Manchester support is planned later);
Example of TRACESWO setup for STM32F1:
DBGMCU->CR |= DBGMCU_CR_TRACE_IOEN;
DBGMCU->CR &= ~(DBGMCU_CR_TRACE_MODE);
TPI->ACPR = 71; // Output bits at 72000000/(71+1)=1MHz.
TPI->SPPR = 2; // Use Async mode (1 for RZ/Manchester)
TPI->FFCR = 0; // Disable formatter
ITM->LAR = 0xC5ACCE55;
ITM->TCR = (1 << ITM_TCR_TraceBusID_Pos) | ITM_TCR_SYNCENA_Msk |
ITM_TCR_ITMENA_Msk;
ITM->TER = 0xFFFFFFFF;
- Enable the SWO on the probe side: add the command
monitor swo enable <baudrate> decode <channel>
to your GDB command list.
Here,baudrate
is the interface speed, andchannel
is the channel where the data is sent (e.g.,ITM_SendChar
sends data to channel 0).
Example (1Mbaud, channel 0):monitor swo enable 1000000 decode 0
- As with UART mode, open a terminal program and connect to MioLink's second VCOM.
This time, parameters don't matter since we already set the speed and channel through the GDB command. - That's it!
Keep in mind that themonitor swo
command does not persist its state, so SWO parameters need to be set again after restarting the probe.
- Set up RTT in your target’s firmware by including the appropriate RTT initialization functions from the SEGGER RTT library.
It is usually enough to simply add the SEGGER RTT files to the project and callSEGGER_RTT_Init
before using RTT; - Enable the RTT on the probe side: add the command
monitor rtt enable
to your GDB command list. - Open a terminal program and connect to MioLink's second VCOM.
This time, serial parameters don't matter. - That's it!
Keep in mind that themonitor rtt enable
command also does not persist its state, so RTT should be enabled again after restarting the probe if you need it; - If you encounter issues, you can check the current RTT status with the command
monitor rtt status
.
This page describes only the basic setup for UART, SWO, and RTT.
If you encounter any issues, please refer to the Black Magic Probe documentation for further information: SWO, RTT.