cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE not generating correct code for SWCLK on STM32WL33

divmstr
Associate II

In my design I needed to use the SPI on the 32-pin WL33, which normally is SWCLK, so I relocated it from its usual PA3, to PB2. When connecting the debugger, it was unable to find the target, which is usually an indication of incorrect connections to SWCLK and/or SWDIO.

The manual (rm0511) on pp58-59 describes the alternate functions, and I can see that using PB2 is a valid configuration using AF1 on on that pin. However, when doing a deeper dive into the generated code, I discovered that it has generated code for pin PA2 (SWDIO), (albeit using the wrong define for the Alternate member of the GPIO initialization struct, which is GPIO_AF0_LCO, instead of GPIO_AF0_SWDIO, but luckily they have the same value!), but NO CODE has been generated for SWCLK. As the default alternate register value, according to the manual, is AF0, then it comes up on the wrong pin. Hence the debugger error.

I am presuming that I can fix this by adding code to configure PB2 to use AF1? If there are any other suggestions I would like to know. 

Are there any plans to fix this in a later release? I don't see any SWCLK config on any other platform, including the Nucleo CC2.

 

 

2 REPLIES 2
STTwo-32
ST Employee

Hello @divmstr 

Could you please add your .ioc file so I can have a look to the issue. 
Best Regards.

STTwo-32

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.

divmstr
Associate II

Thank you for your attention in this matter. Please find IOC attached.

 

Best Regards