cancel
Showing results for 
Search instead for 
Did you mean: 

Bug Report: STM32CubeMX Incorrectly Maps SWO Function to PB3 not PB5 for STM32N6

wantgoodjob
Visitor
Hello ST Community,
I would like to report a potential discrepancy I have discovered between the pin definitions in STM32CubeMX and the official datasheet for the STM32N6 series, specifically concerning the Serial Wire Output (SWO) signal used for debugging (SWV/ITM). This issue led to a hardware design error on my part, and I believe it warrants clarification to prevent others from encountering the same problem.
According to the STM32N647xx datasheet (and related family documents), the SWO function is assigned to Pin PB5, The TRACECLK function is assigned to Pin PB3
However, within STM32CubeMX (I am using version 6.16.1)(N6 MCU package version 1.3.0), the graphical pinout view shows that Pin PB3 is also listed with the "DEBUG-JTDO-SWO" functionality. More importantly, when configuring the debug port in the "SYS" settings (e.g., selecting "Trace Asynchronous Sw"), the software automatically assigns the SWO signal to PB3.
Trusting the configuration tool, I proceeded to design my PCB with the SWO signal routed from PB3 to my ST-LINK header. After assembling the board and attempting to use the SWV ITM Data Console in STM32CubeIDE, I found that no data was being received, regardless of the configuration.
To investigate, I probed the pins with an oscilloscope. The measurements confirmed the datasheet's accuracy:
  • Pin PB5​ showed the expected SWO output signal without any additional GPIO configuration in my code.
  • Pin PB3​ remained completely silent, showing no activity even when configured as AF0_TRACE.
This conclusively proves that STM32CubeMX is incorrectly assigning the SWO function to PB3. The actual SWO signal is only present on PB5, as per the datasheet. My initial PCB design based on CubeMX's information was therefore incorrect. I had to resort to more complex workarounds (e.g., manually re-routing a bodge wire) to successfully use the SWV feature.
Summary of the Issue:
  • Datasheet:​ SWO is on PB5.
  • STM32CubeMX:​ Incorrectly allows and defaults to assigning SWO to PB3.
  • Actual Hardware Behavior:​ Only PB5 outputs the SWO signal.
This mislabeling in a critical development tool is highly misleading and can lead to significant development delays and hardware redesigns, as I have experienced. I kindly request the ST team to review and correct this pin assignment in a future release of STM32CubeMX to ensure it aligns with the official documentation.
 
1 REPLY 1
Souhaib MAZHOUD
ST Employee

Hello @wantgoodjob 

Could you please provide your IOC file in order to investigate further the issue?

KR, Souhaib

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.