AnsweredAssumed Answered

STM32 trace problem with ST-LINK/v2 fw V2.J19.S0

Question asked by MattJ on Mar 24, 2014
Latest reply on Mar 24, 2014 by MattJ
Hi all,

I am using the STM32's ITM to output log messages to my PC via SWO.  However, I have run into issues with losing characters (as has been noted elsewhere; e.g., https://my.st.com/5056d518).  Apparently ST-LINK fw V2.J19.S0 improves the situation somewhat, so I updated the firmware on my STM32F3DISCOVERY board to this version.  However, with the v19 firmware, I only ever receive 24 characters from the ST-LINK, after which point I have to unplug/replug the device in order to be able to restart tracing.

I wrote a simple application to test this further:

int main(void) {
    while (1)
        ITM_SendChar('x');
}



With ST-LINK fw V2.J17.S0 this outputs a continuous stream of x characters as expected (viewed using the Serial Wire Viewer component of the STM32 ST-LINK Utility).  However, when I update the ST-LINK to V2.J19.S0, and perform exactly the same steps I only ever receive 24 x characters.  If I inspect the SWO pin on the board, I see that there is still data being sent from the STM32 to the ST-LINK.

I have looked at a sniff of the USB traffic and what I see happen is as follows. The host asks the device how much trace data it has ready, to which the device replies with a large amount (large in this case being > 42 octets).  However, when the host fetches the data from the trace endpoint it only gets 42 octets (i.e., 24 characters of trace data, plus ITM headers).  From then on, when the host asks the device how much trace data it has ready the device constants replies with 0 octets.

I am running the latest version of the ST-LINK utility (v3.3.0) with STLinkUSBDriver.dll v4.3.1.0.

For now I have to work around this by downgrading back to V2.J17.S0 (which is the firmware packaged with the ST-LINK utility that I am using).  Has anyone else encountered this problem?  Is there a known solution?

Regards,
Matt

Outcomes