Search code examples
armstm32libusb-1.0stm32f4discoverycortex-m

How to read swd output via USB?


I am trying to write an application similar to stmicro STM-STUDIO, which reads variables from an embedded application running on a device (STM32Fx Discovery) via USB. How do I go about reading the output (variables) coming from the board, preferably an app using a C# application?


Solution

  • You should search around and see if there is an API or library of some sort you can use to talk to the SWD Debugger. Or maybe they have a command-line interface you can run from your program. You might try contacting the manufacturer (ST).

    If they are not going to support you, then it's time to put on the reverse engineering hat. I would get a USB protocol analyzer. Total Phase sells good ones and I have used their $400 one to debug my USB devices for a long time. Your operating system might also have some built-in USB debugging capabilities. Then just run STM STUDIO and see what happens when you click various buttons. Hopefully you can figure it out.

    You might need to get a solid understanding of the SWD protocol in order to figure out the USB traffic you are seeing on the analyzer.