6 years, 7 months ago.

SWO on nucleo L432KC

I use SWO (with serial wire viewer) on discovery board STM32L476G-DISCO. There it works fine with onboard ST-LINK, (USB cable) when I bridge PB3-SWO and using the following C-code:

  1. include "mbed.h"
  2. include "LCD_DISCO_L476VG.h"
  3. include "SWO.h"

DigitalOut myled(LED1);

Serial pc(SERIAL_TX, SERIAL_RX); SWO_Channel swo("channel");

int main() { pc.printf("Hello World\n\r");

swo.printf("\r\nHello World from SWO\r\n"); swo.printf("CPU SystemCoreClock is %d Hz\r\n", SystemCoreClock);

printf("Message on stdout\r\n");

if (swo.claim() == true) { pc.printf("SWO has claimed stdout\r\n"); printf("Message on stdout redirected to SWO\r\n"); } else { pc.printf("SWO failed to claim stdout\r\n"); } while(1) { myled = 1; LED is ON wait(0.1); 200 ms myled = 0; LED is OFF wait(0.9); 1 sec ITM_SendChar('*');

swo.putc('#'); } }

I'd like SWO on NUCLEO STM32L432KC now unsing STM St-Link untility with Serial Wire Viewer. But what is the right CoreClock frequency? Do I have also to bridge some pins or to check some soldering bridges on this board. Pls. help. Thank's a lot.

Mikesch

1 Answer

6 years, 7 months ago.

Hello Franz,

I think this page might be of help. As Wim says make sure you select the correct systemclock in the Serial Wire Viewer window which should be 80MHz for the NUCLEO-L432KC.

Accepted Answer

I exactly uses this link and used exactly the proposed software for testing. But the example does not explain the needed steps with NUCLEO-L432KC. When I use this board with Serial Wire Viewer, system clock (Hz) 80000000 (Stimulus Port: All) and press the Start button on the SWV window, the multi-colol LED stops blinking, but I can't see any transferred characters. If I press the Stop button (same button), the multi-color LED starts blinkin again. I think the software is working correctly but the output (port) TX, PB3 or what ever is not wired to the corresponding SWO Line. I don't know the eventually needed PIN bridging on this bord to get SWO working. On the STM32L476G-Disco e.g. SWO is only working after bridging PB3 to SWO (on the debug header). On other boards, bridging a soldering bridge does the job. NUCLEO STM32L432KC (32 Pins) has no debug header. I even can't find a complete schema or deep technical description of this board on STM's homepage. Has anybody a working serial wire viewer with NUCLEO STM32L432KC ???? I'd like to start programming this genious board as soon as a can easily send messages for simple debugging my first steps. Thank's a lot for any solution !

posted by Franz Ziegler 20 Apr 2018

Please use the <<code>> and <<code>> tags on separate lines around your posted code to keep it readable. The code prints the current systemcore clock frequency on the regular PC terminal so you can check the setting for the STLINK viewer.

According to the Nucleo32 usermanual and schematic here the SWO pin of the target has not been connected to the receiving pin on the STLINK interface. That is why the Serial Link viewer on the PC will not show any data. You may be able to fix that if you have good soldering skills. The SWO pin of the target 432KC is PB3 (as usual). This pin is connected to D13 on the Nucleo32 board. You may want to remove SB15 and you must not use LED1 in your code as this would disable the SWO function. Connect a thin wire to either D13 or the correct side of SB15. The wire must then be connected to pin31 on the F103 processor that is on the bottom of the nucleo board. This is the tricky soldering part, but it can be done.. The pin31 is just below the 'c' in the word 'nucleo' printed above the F103.

/media/uploads/wim/nucleo32_swo.jpg

Note that I have not tested this because I dont have the board available.

posted by Wim Huiskamp 21 Apr 2018

Assigned to Franz Ziegler 6 years, 7 months ago.

This means that the question has been accepted and is being worked on.