cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use SWDIO and SWCLK as standard GPIO but still allow for re-programming?

grant
Associate III
Posted on December 30, 2014 at 08:51

Hi there

I am planning to use the STM32F030F4 for an application where I have a main interface header that I also want to use to program the micros in production.  I am pin limited on the header so this means I need to ''multiplex'' the use of the SWDIO and SWCLK pins.

What I am looking for is a simple way to figure out when booting as to whether I am hooked up to a programmer/debug unit or not so I can choose whether to map the SWDIO/SWCLK pins to their alternate functions or not.

Thanks and regards

Grant

#serial-wire-debug
2 REPLIES 2
Posted on December 30, 2014 at 14:56

So have it delay, or switch mode based on a GPIO or USART input?

Pulling BOOT0 high is going to have the chip run it's internal System Loader, and not your code, so the pins should function normally.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
b_harshan
Associate
Posted on December 31, 2014 at 06:40

Sir,

I am working on Cortex m4 over Serial Wire Debug protocol, with some googling i found '' http://markdingst.blogspot.in/2014/03/programming-internal-sram-over-swd.html '' based on this i am trying to access debug core register i am using STM32f407 as host and STM32f407 as target

the sequence i wrote as following.

Host :

1->sending >50 clocks

2->sending jtag to swd sequence 0xE79E(LSB first)

3->sending >50 clocks

4->sending idcode code packet 1|0|1|0|0|1|0|1   =  0xA5

5->sending 1 clock pulse (Turn around Time) changing the direction waiting for ack

6->collecting 3 bits by sending 3 clock pulses

Target

: ACK Success

Host :

7->after success ack sending 33 clock pulses 32(data)+1(parity)

target :

0x2ba01477

Host :

 

 

8->sending 1 clock pulse turnaround period

9->setting CTRLSTAT register CSYSPWRUPREQ and CDBGPWRUPREQ bits by sending packet 1|0|0|1|0|1|0|1  =  0x95

and data = 0x50000000

target :

(ACK success)

 

Host :

10->reading CTRLSTAT register by sending packet 1|0|1|1|0|0|0|1   =  0xB1

11->after success ack sending 33 clock pulses 32(data)+1(parity)

target :

0xffffffff with parity error i don't understand where might be the error could you please suggest me where might be the error                                                                                             Thanks & Regards