Using SWD pins in an application

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Using SWD pins in an application

2,482 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by raimond on Thu Dec 31 08:13:24 MST 2009
Hi all,

I'm planning some new boards with the LPC17xx and LPC13xx. From the LPC Xpresso boards I can see that the SWD debug is working and for me a very small connector for programming/debugging like that:

1. GND
2. /Reset
3. SWDIO
4. SWCLK

will be the best. My main concern now is about the SWDIO pin, which is multiplexed with AD4 A/D input pin, and I really need that pin for an analog input.

The question is: Can I use the A/D input pin for my application? I mean: can I use the pin for programming the micro and right after that the programmer to disable the SWDIO functionality (high Z the driver) and then to use the pin in an application as ad A/D input?

I really don't want to connect/disconnect the SWD connector all the time!

For debugging, I can live without the AD4 pin, it's not a problem :)

Regards

Original Attachment has been moved to: 1100023_LPCXpresso%20Error.zip

0 项奖励
回复
3 回复数

1,898 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by raimond on Wed Jan 06 05:10:27 MST 2010
Well, that's a problem. I need a connector to program the chip in any condition. And this implies any previous firmware written to it, buggy or not. So, I think that the best will be an ISP connector.

Thanks for the answers

Raimond
0 项奖励
回复

1,898 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_USA on Tue Jan 05 15:52:36 MST 2010

Quote: NXP_Europe
[FONT=Arial][SIZE=2]Hi Raimond

...it is advisable to add a delay (see the code in the very beginning of your main function. This will allow you to go into SWD mode after a manual reset...
[/SIZE][/FONT]



Another way to re-enable debug mode when it has been disabled by accident in software (and CRP is not enabled) is to force the MCU to start up in ISP In-System Programming mode by pulling PIO0_1 low. If the MCU is forced to startup in ISP mode instead of in user code, then the SWD debugging probe should be able to take control of it before it executes the user code that disables SWD. Or ISP can be used to erase the user code with the help of the Flash Magic software from www.flashmagictool.com and a serial connection.
0 项奖励
回复

1,898 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Tue Jan 05 07:19:55 MST 2010
[FONT=Arial][SIZE=2]Hi Raimond

Some answers to your questions:


Quote:

Can I use the A/D input pin for my application? I mean: can I use the pin for programming the micro and right after that the programmer to disable the SWDIO functionality (high Z the driver) and then to use the pin in an application as ad A/D input?

Yes you can use the AD pin normal after programming. You can change the function of the pin in you code. Though you need to keep in mind that after programming the device starts executing and it will disable the SWD functionality and you won't be able to get into SWD-mode any more. So it is advisable to add a delay (see the code in the very beginning of your main function. This will allow you to go into SWD mode after a manual reset.

uint32_t i=0;
for(i=0;i<4000000;i++){__nop;}

Please keep in mind that the analog connection and the SWD doesn't intefere with each other w.r.t. levels etc.

Kind regards
[/SIZE][/FONT]
0 项奖励
回复