本帖最后由 Simon21ic 于 2013-3-13 22:49 编辑
show一段stlink调试lpc1766的底层数据以及分析,貌似问题很简单:
// PLL0CON: disable PLL
47.2 OUT f2 08 80 c0 0f 40 04 00 00 00 00 00 00 00 00 00 .....@.......... 32ms 54.1.0
47.2 OUT 00 00 00 00 .... 1.0ms 55.1.0
47.2 OUT f2 3b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .;.............. 974us 56.1.0
47.1 IN 80 00 .. 1.0ms 57.1.0
// PLL0FEED
47.2 OUT f2 08 8c c0 0f 40 04 00 00 00 00 00 00 00 00 00 .....@.......... 1.0ms 58.1.0
47.2 OUT aa 00 00 00 .... 1.0ms 59.1.0
47.2 OUT f2 3b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .;.............. 1.0ms 60.1.0
47.1 IN 80 00 .. 1.0ms 61.1.0
// PLL0FEED
47.2 OUT f2 08 8c c0 0f 40 04 00 00 00 00 00 00 00 00 00 .....@.......... 1.0ms 62.1.0
47.2 OUT 55 00 00 00 U... 1.0ms 63.1.0
47.2 OUT f2 3b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .;.............. 1.0ms 64.1.0
47.1 IN 80 00 .. 1.0ms 65.1.0
// CCLKCFG
47.2 OUT f2 08 04 c1 0f 40 04 00 00 00 00 00 00 00 00 00 .....@.......... 1.0ms 66.1.0
47.2 OUT 00 00 00 00 .... 1.0ms 67.1.0
47.2 OUT f2 3b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .;.............. 998us 68.1.0
47.1 IN 80 00 .. 990us 69.1.0
// SCS: enable main oscillator
47.2 OUT f2 08 a0 c1 0f 40 04 00 00 00 00 00 00 00 00 00 .....@.......... 1.0ms 70.1.0
47.2 OUT 20 00 00 00 ... 1.0ms 71.1.0
47.2 OUT f2 3b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .;.............. 1.0ms 72.1.0
47.1 IN 80 00 .. 1.0ms 73.1.0
// CLKSRCSEL: select main oscillator as PPL0 source
47.2 OUT f2 08 0c c1 0f 40 04 00 00 00 00 00 00 00 00 00 .....@.......... 53ms 74.1.0
47.2 OUT 01 00 00 00 .... 1.0ms 75.1.0
47.2 OUT f2 3b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .;.............. 1.0ms 76.1.0
47.1 IN 80 00 .. 1.0ms 77.1.0
//
47.2 OUT f2 08 00 c0 0f 40 04 00 00 00 00 00 00 00 00 00 .....@.......... 1.0ms 78.1.0
47.2 OUT 3a 00 00 00 :... 1.0ms 79.1.0
47.2 OUT f2 3b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .;.............. 1.0ms 80.1.0
47.1 IN 81 00 .. 1.0ms 81.1.0
IAR使能了主晶振后,系统就挂了,原因:主晶振没有焊接,焊接上去就OK了。
花了几小时测试一下了手头上有的其他cortex,stlink支持其他cortex只能使用SWD接口。目前估计一般的CortexM0/3/4应该都可以支持,CortexM0+的话,木有芯片测试,并且已知kinetis不支持(因为对DAP都了手脚,还没有硬件来研究)。
如果使用JTAG的话,程序就需要增加目标芯片的自动检测,以及根据检测到的目标芯片,自动设置JTAG参数。 |