项目场景:
`使用DSP28系列开发功能
问题描述
将程序修改为在flash中运行后发现程序运行频率与在仿真器中运行的CPU执行频率不同,程序运行异常!
原因分析:
修改为F28335.cmd文件后没有在主函数中增加如下代码来确保在flash中运行
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
MemCopy(&Ramfuncs1LoadStart, &Ramfuncs1LoadEnd, &Ramfuncs1RunStart);
MemCopy(&Ramfuncs2LoadStart, &Ramfuncs2LoadEnd, &Ramfuncs2RunStart);
InitFlash();
导致delay函数无法运行,之前调试时运行到delay函数就卡死,在无仿真器时,导致了dsp外围电路上电竞争冒险,使外围电路工作不稳定,才出现了执行定时器频率运行异常的问题,而使用仿真器运行时,dsp的外围电路运行一般是稳定的,因此运行也是正常的。
解决方法:
将上述代码加入主函数中。
完成将程序调整至flash中离线运行的步骤如下:
-
屏蔽28335_RAM_lbk.cmd
-
增加F28335.cmd,若程序里没有可以去TI例程中寻找
-
增加DSP2833x_MemCopy.c文件,若程序里没有可以去TI例程中寻找
-
相关头文件
DSP2833x_GlobalPrototypes.h
DSP2833x_Examples.h
…… -
在主函数中增加如下函数
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart); //DSP2833x_MemCopy.c
MemCopy(&Ramfuncs1LoadStart, &Ramfuncs1LoadEnd, &Ramfuncs1RunStart);
MemCopy(&Ramfuncs2LoadStart, &Ramfuncs2LoadEnd, &Ramfuncs2RunStart);
InitFlash(); //DSP2833x_SysCtrl.c
如上操作后build后运行debug后去掉仿真器可测试程序运行是否正常!!!