8 years, 1 month ago.

nucleo swd debugging

Hi,

i wanted to test swd debugging with swo output on the board i am using (nucleof401RE) but i cant get any output. What i tried is this lib

https://developer.mbed.org/components/SWO-viewer/ i found also this topic https://developer.mbed.org/forum/bugs-suggestions/topic/4747/.

I did not change anything on the board. Frequencies are all left to default but i cant see anything in SWO viewer of segger st link utility. 1) Has anyone experienced the same thing and has any solution?

Since i have not so much experience with these things maybe this is a silly question but i am still asking :) 2) Is there any possibility to get the swo messages in coolterm?

Thanks

1 Answer

8 years, 1 month ago.

Have you tested the SWO viewer component with the (free) ST Link utility as shown on the component page?

In case you use Segger, make sure the SWO pin is connected and make sure that GND and VREF all work. I assume you have been able to flash the F401 on your (non-mbed ?) board with Segger? Make sure the SystemCoreClock of the F401 is correctly set for the ST Link and Segger tools. Use a debugmessage on the regular serial port to verify this.

Nope, you can not view SWO on coolterm. You can use the serialports for debugging using a serial-to-usb converter (eg FT232)

Accepted Answer

Hi Wim, thnx for your prompt reply. Sorry for the confusion and i do not know why i wrote segger there but i am indeed using the st link utility and its swo viewer. I edited my question accordingly.

posted by anteo c 25 Sep 2016

Ok, so is the example code running and the LED flashing? Do you get any output on the regular serialport and is the SystemCoreClock correct and a match with the setting in the ST Link viewer. Try this code:

#include "mbed.h"
#include "SWO.h"
 
DigitalOut myled(LED1); 
 
Serial pc(SERIAL_TX, SERIAL_RX);
SWO_Channel SWO;
 
int main() {
  pc.printf("Hello World\n\r"); 
  pc.printf("CPU SystemCoreClock is %d Hz\r\n", SystemCoreClock);
 
  SWO.printf("\r\nHello World from SWO\r\n");
  SWO.printf("CPU SystemCoreClock is %d Hz\r\n", SystemCoreClock);
 
  while(1) {
    myled = 1; // LED is ON
    wait(0.2); // 200 ms
    myled = 0; // LED is OFF
    wait(1.0); // 1 sec
  
    SWO.putc('#');    
    pc.putc('#');    
   }
}
posted by Wim Huiskamp 26 Sep 2016

i did try the same things now and now it works, thnx for the help Wim

posted by anteo c 02 Oct 2016