SWD woes using STM32C011 cant connect using swd - Page 1
Forum section: electronics / general

author: sahko123
author_rank: Frequent Contributor
timestamp: August 22, 2024, 07:00:43 pm
content: Ive been working on a test dev board for the stm32c011 with plans to use the wlcsp-12 package for the final product and have it be user programmable over USB/UART. I bought the following official ST micro dev board for it to be able to test the various connections like UART and SWD.https://www.st.com/en/evaluation-tools/stm32c0116-dk.htmlWith the following schematics,https://www.st.com/resource/en/schematic_pack/mb1684-c011f6-b01-schematic.pdfUsing the board as normal with the microcontroller daughterboard in the st-link board i can get it to connect perfectly fine with STM32CubeProgrammer, after changing one option bit to enable the boot0 pin i can still easily get it to connect to the ST-Link and now also over UART using a cp2102 with the daughter board in a breadboard and otherwise not connected to the st-link carrierBut my issue is im not sure what the st-link carrier is actually using as its protocol to connect, because to replicate i have to connect 5 pins T_JTMS, T_JTCK, T_NRST, T_VCP_TX and T_VCP_RX and then the daughter board connects to the st-link outside of the default socket. What i dont understand is that i have no idea what this protocol even really is, cause in the programmer software it selected to use SWD, but this is like JTAG, when selecting JTAG no connection is made. There are SWD pins SWDIO and SWCLK on the carrier board but connecting them to the daughter board externally yields no connection whatsoever.What i want to be able to do on my dev board is to just connect SWDIO, SWCLK and use that for debug then be able to switch traces with jumpers and use UART instead for programming but i cant get the st-link carrier to connect over just SWD, is this is because of the st-link being built in? or should i expect the dev board st-link to act the same as any normal v2 st-link

author: ataradov
author_rank: Super Contributor
timestamp: August 22, 2024, 08:17:20 pm
content: Cortex-M0+ devices don't have JTAG, only SWD. SWD used the same pins as JTAG when both are supported The actual names of the pins are SWDIO (T_JTMS) and SWCLK (T_JTCK).So, you need to trace where those PA13 and PA14 pins end up where you can connect to them. They are the only debugging interface on that device.T_NRST is optional, but useful for recovery from firmware that puts the device into some inaccessible state (like lowest power sleep modes).Ok, I see how this kit is designed. The plugin module already connects everything, so it should program the target.So, it is not clear what is the issue here. Do you want to use external ST-Link? Or do you want to use that on-board ST-Link for your own boards?

author: sahko123
author_rank: Frequent Contributor
timestamp: August 22, 2024, 09:46:16 pm
content: I want to use the st-link section of this dev kit to connect to the stm32 daughter board, while this daughter board is in a breadboard, to confirm that i can indeed make the connection over SWD but for whatever reason I'm not able to connect it. I'm sure there is something wrong with my implementation. What is the minimum circuitry i should have for this stm32 to communicate over SWD and only two wire SWD. From what I can tell all i needed to have was power SWDIO and SWCLK, but that has had no luck connecting, even adding NRST does nothing

author: ataradov
author_rank: Super Contributor
timestamp: August 22, 2024, 09:58:33 pm
content: The minimal configuration you need SWDIO/SWCLK and the power/ground, of course. If this does not work, then what specific error messages you are getting?

author: sahko123
author_rank: Frequent Contributor
timestamp: August 22, 2024, 11:09:29 pm
content: I was mostly getting,Error: No STM32 target found! If your product embeds Debug Authentication, please perform a discovery using Debug Authenticationand sometimes,Error: ST-LINK error (DEV_TARGET_CMD_ERR)

author: ataradov
author_rank: Super Contributor
timestamp: August 22, 2024, 11:34:44 pm
content: No idea about that.What I would do is take that module out and use a bunch of wires to connect the module pins to the carrier. Then disconnect them one by one to see what matters.But there really should not be a need for anything other than ground and SWD pins.

author: Pseudobyte
author_rank: Frequent Contributor
timestamp: August 23, 2024, 12:43:37 pm
content: Seems like a grounding/power issue. Could you share a photo of your breadboard setup?

author: ataradov
author_rank: Super Contributor
timestamp: August 23, 2024, 10:05:43 pm
content: Ok, I was just doing some work with ST-Link and ran into the same error. In addition to connecting the reset pin, you also need to select "Under Reset" in the "Mode" setting. It does not use reset pin by default.

author: sahko123
author_rank: Frequent Contributor
timestamp: August 25, 2024, 03:42:28 pm
content: Yeah unfortunately that doesn't seem to help, grounding and power seem to be all good since i can work with UART but otherwise just SWD is the issue, adding a reset doesnt change anything, ill try probing around to see wtf is going on

author: ataradov
author_rank: Super Contributor
timestamp: August 25, 2024, 04:04:23 pm
content: If it works while the module is plugged in, then your easiest way to find out what is not working is to plug it in though a bunch of extension wires and then remove them one by one until it breaks.

author: sahko123
author_rank: Frequent Contributor
timestamp: August 25, 2024, 08:56:49 pm
content: well i feel like a moron now, but not only was the contact in the socket only stable with the larger pins of the daughter board, which is why connections worked, but when i tested my point to point connections me pressing on the pins caused there to be a continuity, remove the probes it doesnt work anymore,but even when there are soldered connections it sometimes works sometimes doesnt, so god knows

author: sahko123
author_rank: Frequent Contributor
timestamp: August 25, 2024, 09:18:44 pm
content: Quote from: sahko123 on August 25, 2024, 08:56:49 pmOk it seems that the board to board wires i was using were just ass replaced them and now i dont even need the reset pin

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 25, 2024, 09:36:13 pm
content: Ahh yes, the usual failing contact that works exactly when touching with the probes, making your life miserable!About 25% of world baldness is due failures like this!