2015-02-06 06:14 AM
Hi
I am working with a discovery board with an embedded ST-Link. Debugging over the embedded ST-Link works great over USB. However I need to develop software that uses the USB port as a USB HID Device. Doing this without debugging will be harsh so I am wondering what is the best practice to solve this.In the manual for the discovery board it mentions I can debug another STM32 using the built in ST-Link and connect through the SWD port. Can I use the same SWD port to control my current processor, and if so would I connect an external ST-Link to it?Another alternative is using PA13-PA15 and PB3, PB4 and make my own JTAG connector. What confuses me here is that I only have 5 pins but if I look at the ST-Link manual there are 6 signals listed for JTAG (except for VCC and GND).Maybe I am confusing things due to inexperience here, so any advice is appreciated. I'm open to any solution including getting one more discovery board if I can use one board to debug the other. I will have to get another board anyway because I need to experiment with I2C and I want to see both ends of the communication.Best regards,Per Smitt #discovery #stm32l152 #jtag2015-02-06 09:37 AM
You can't debug complex peripherals and protocols, with hard time deadlines, by stopping the processor. ie you can't replace the gearbox while driving down the motorway at 70 mph, and if you stop in your lane someone is going to hit you.
You need to a) understand your code, and b) output telemetry about what's going on real-time via a serial or debug communications channel (ie SWV in the Cortex-M3/4) On the DISCO boards you can use the SWV channel, you need to check if the solder bridge on the SWO (PB3) pin is made to connect to the ST-LINK portion, and you need to configure your viewer software (ST-LINK Utilities) with the clock speed of the processor core. Google about of SWV and Serial Wire Viewer for your specific tool chain, etc. Avoid letting the device going into low power modes, these will generally disconnect the debugger.2015-02-06 09:39 AM
The USB port the ST-LINK chip (F103) uses is NOT connected to the L152.
2015-02-09 12:31 AM
Thanks a lot for the reply and advice :)
And I loved the car analogy.