2025-04-19 3:44 PM
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.