CW环境写的程序KL46复位不运行,反复复位

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

CW环境写的程序KL46复位不运行,反复复位

5,994件の閲覧回数
lilongjie
Contributor II

CW环境PE写的程序使,用JLINK下载下去运行的好好的,但是拔掉JLINK再复位或者是重新上电之后就不能运行了。
链接这JLINK的时候,按下复位键,程序停在了复位中断的入口处不执行,必须点击运行之后才运行。拔掉JLINK重新上电直接就不停的复位。

总结一下:应该是程序在复位之后不能直接运行,就停在了复位中断的入口处。看门狗上电之后默认的配置状态是:开启看门狗,看门狗调试时禁用。所以连接着JLINK的时候,因为有调试的原因,所以程序只是停在那里,不会反复复位。没有连接着JLINK的时候,看门狗就启动了,然后就不停的复位。这跟所谓的FLASH和RAM模式没关系。在调试配置里面也勾选了Run out of reset 也没用。

タグ(3)
0 件の賞賛
15 返答(返信)

5,512件の閲覧回数
朱葛峻
Contributor I

话说你也用KL46,是做智能车比赛么?

0 件の賞賛

5,512件の閲覧回数
不谷不谷
Contributor I

(⊙o⊙)

0 件の賞賛

5,512件の閲覧回数
朱葛峻
Contributor I

你可能在后面某个时钟没定义吧?

0 件の賞賛

5,512件の閲覧回数
lilongjie
Contributor II

时钟就是使用的默认的,问题应该不是这里,我是做产品,CW用来生成代码,

0 件の賞賛

5,512件の閲覧回数
朱葛峻
Contributor I

还有你有没有测试跳入没跳入vector003?

0 件の賞賛

5,512件の閲覧回数
朱葛峻
Contributor I

我是说时钟的寄存器SIM和PORT这两个寄存器你定义没?

0 件の賞賛

5,512件の閲覧回数
lilongjie
Contributor II

不好意思,问题依然没有解决,我对比了能正常运行的程序和我的程序,但是没发现代码上有什么特殊之处,应该是工程设置的问题吧,各位能帮忙找下原因吗?

0 件の賞賛

5,512件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

我比较了一下生成的代码,有些差别。应该是CodeWarrior所用Processor Expert软件不是最新版本。

你可以通过菜单【Help】-->【Check for updates】更新相应的插件。

我现在所用Proceesor Expert的版本是 V10.5.1,详见下图(查看PE版本信息可以通过菜单【Help】-->【About CodeWarrior Development Studio】获取):

CodeWarrior Installed softare detailed info.jpg


Wish it helps.

Best regards,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛

5,512件の閲覧回数
lilongjie
Contributor II

那里有区别呢?会不会是这些区别造成的影响呢?我这里也是最新的版本,仍然不行,我没有修改任何设置,只是添加了一个GPIO,其他地方都没有动过。我使用独立的PE生成代码,然后使用IAR编译,同样的程序没有任何问题,所以我认为还是CW得调试设置出了问题。

0 件の賞賛

5,512件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Longjie,

KL46 watchdog is enabled after chip reset, which need be disabled to avoid watchdog timeout reset.

Please check below code to disable the watchdog:

/* Disable the watchdog timer */

SIM_COPC = 0x00;

You also could download KL46 example code from below link:

http://cache.freescale.com/files/32bit/software/KL46_SC.exe

Wish it helps.


Best regards,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛

5,512件の閲覧回数
lilongjie
Contributor II

官方的例程没问题,重新上电之后可以正常运行。

看门狗的问题我尝试过,我开启看门狗,每隔几秒钟复位一次,故意不去喂狗,然后在调试模式下程序会反复复位,但是重新上电之后却没有任何反应,我把自己的工程发给你,麻烦给看一下,谢谢了,使用的是FRDM-KL46Z,实现PTD5闪烁。

0 件の賞賛

5,512件の閲覧回数
kehanqin-b46569
NXP Employee
NXP Employee

Hi Longjie


I test on my TWRKL46 and 25 many times, didn't happen what you said, it's just a easy port toggle, I upload my project for you reference.

Besides, I sent another project "Light", it used no PE to build a project of GPIO and control light, I think the code it's good and suit for learning or reference.

Hope it's helpful to you.


Best Regards,

Kehan



0 件の賞賛

5,511件の閲覧回数
lilongjie
Contributor II

你好 Kehan Qin !

      我下载了你的程序,但是应该是引脚设置的和FRDM-KL46Z的不匹配,FRDN-KL46Z 使用的是PTD5,我修改了PE中关于这部分的设置,然后程序能正常运行了,重新上电也没有问题,正如上面 Hui_Ma 的工程一样,我看了你的工程和我的工程,没有发现特别的不同之处,到底是哪里出了问题呢,好奇怪!

0 件の賞賛

5,511件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Longjie,

I think your code during Processor Expert creation processing with some issues causes code can't run from Flash.

You can check my attached project, which with same function and call same Processor Expert components and it can run from Flash after reset.


Wish it helps.

Best regards,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛

5,511件の閲覧回数
lilongjie
Contributor II

你好 Hui_Ma !

       我下载了你的程序,运行起来是没有问题的,我对比了一下两个程序,可能是我不知道应该注意哪里,我并没有找到什么不同之处,你下载了我的程序是不是也是重新上电不能运行呢?能不能帮我看一下我的程序,是不是哪里设置的不对,代码都是PE自动生成的,应该不会有什么错误吧。。。谢谢!

0 件の賞賛