cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F042F6Tx SWD problem [solved: this is how swapping SWCLK and SWDIO looks like]

valentin
Senior
Posted on November 07, 2016 at 02:38

I too seem to be unable to talk to my F I just finished some new boards with a new design.

I'm using NRST, SWDIO and SWCLK to connect from the SWD header of a discovery board to the F I triple checked and confirmed that SWCLK is on pin 20 (PA14) and SWDIO on pin 19 (PA13). NRST is pulled high, even though the NRST state doesn't really matter for SWD connection. I tested that using another board. Works fine with NRST low or high. This is what ST-Link says about the problem:


cErrLog::SetLogTraceOn

STLinkUSBDriver.dll loaded

ST-Link/V2 device detected

Target voltage detected: 2.893326

Error (0x16) after target cmd F2 30 A3 00 00 00 00 00 00 00

Error (19) while initializing ST-Link in SWD mode

ST-Link/V2 device detected

Target voltage detected: 2.896161

Error getting target IDCODE: if SWD, check SWD connection

Error (4) while initializing ST-Link in SWD mode

ST-Link/V2 device detected

Target voltage detected: 2.893326

Error getting target IDCODE: if SWD, check SWD connection

Error (4) while initializing ST-Link in SWD mode

ST-Link/V2 device detected

Target voltage detected: 2.894743

Error getting target IDCODE: if SWD, check SWD connection

Error (4) while initializing ST-Link in SWD mode

Error (0x16) after target cmd F2 3E 00 00 00 00 00 00 00 00

Error (19) in ReadMemory_32Bit (4 bytes from 0x40015800)

Error (0x12) after target cmd F2 36 04 58 01 40 00 00 00 00

W at 0x40015804: 0x00000000

Error (0x12) after target cmd F2 35 04 58 01 40 00 00 00 00

W at 0xe000edf0: 0xa05f0000

Error (0x12) after target cmd F2 35 F0 ED 00 E0 00 00 5F A0

And this is what it looks like when debugging the lines directly: [url=https://postimg.org/image/acq3k3qw9/][img]https://spostimg.org/acq3k3qw9/screenshot.png[/img][/url] [url=https://postimg.org/image/t6bwh3p49/][img]https://spostimg.org/t6bwh3p49/screenshot2.png[/img][/url] Looking at the analog version of SWDIO, it seems as if the F042 pin is somewhat struggling to drive the line properly during the IDCODE request? It's also weird that there are transitions happening in between bits. This is a snapshot of the PCB layout with the SWD tracks highlighted: [url=https://postimg.org/image/m6ud5k00z/][img]https://spostimg.org/m6ud5k00z/pcb.png[/img][/url] Those pins go directly to the SWD header on the discovery board using a 10 pin ribbon. Any idea anyone? Thanks! (btw: the forum is painstakingly slow and why doesn't it read html or bbcode?) Edit: never mind. SWDIo and SWCLK were swapped ...... I'll leave this here for everyone else to learn from :) #stm32f042-swd-idcode
1 REPLY 1
Nesrine M_O
Lead II
Posted on November 07, 2016 at 10:28

Hi Valentin,

Thank you for posting your findings and how you fixed the problem, it may be helpful for someone else facing same issue.

-Syrine-