CW环境PE写的程序使,用JLINK下载下去运行的好好的,但是拔掉JLINK再复位或者是重新上电之后就不能运行了。
链接这JLINK的时候,按下复位键,程序停在了复位中断的入口处不执行,必须点击运行之后才运行。拔掉JLINK重新上电直接就不停的复位。
总结一下:应该是程序在复位之后不能直接运行,就停在了复位中断的入口处。看门狗上电之后默认的配置状态是:开启看门狗,看门狗调试时禁用。所以连接着JLINK的时候,因为有调试的原因,所以程序只是停在那里,不会反复复位。没有连接着JLINK的时候,看门狗就启动了,然后就不停的复位。这跟所谓的FLASH和RAM模式没关系。在调试配置里面也勾选了Run out of reset 也没用。
我比较了一下生成的代码,有些差别。应该是CodeWarrior所用Processor Expert软件不是最新版本。
你可以通过菜单【Help】-->【Check for updates】更新相应的插件。
我现在所用Proceesor Expert的版本是 V10.5.1,详见下图(查看PE版本信息可以通过菜单【Help】-->【About CodeWarrior Development Studio】获取):
Wish it helps.
Best regards,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
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!
-----------------------------------------------------------------------------------------------------------------------
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
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!
-----------------------------------------------------------------------------------------------------------------------