13回答

0收藏

[12月26日更新]关于Keil 创建LM4F120 新工程的问题

回答|共 13 个

倒序浏览

11#

lxc115

发表于 2013-1-15 13:45:52 | 只看该作者

分享到:
cn_x 发表于 2013-1-14 12:45
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
                    SYSCTL_OSC_ ...

找到什么原因了么,我看着也不知道哪里出错
12#

cn_x

发表于 2013-1-15 14:24:11 | 只看该作者

我找到答案了
I think you may be running into the max flash read speed.  The flash can only read at 40 Mhz.  We have a pre-fetch buffer mechanism to fetch 2 words instead of one when running faster than 40 mhz.  In a tight loop like the SysCtlDelay you may find that the the pre-fetch cannot do it's job well due to the jumping in the loop.

Some things to try that might verify this is true.

Change SYSCTL_SYSDIV_2_5 to SYSCTL_SYSDIV_5.  See if the delay is exactly twice as long or if you are hitting the read time limit then the delay will be the same.

A second test would be to try using ROM_SysCtlDelay() with the rest of your software the same as shown.  The ROM can run at the full 80Mhz and will not be slowed down.

Dexter

链接

http://e2e.ti.com/support/microc ... f/471/t/143842.aspx
13#

lxc115

发表于 2013-1-16 19:44:05 | 只看该作者

cn_x 发表于 2013-1-15 14:24
我找到答案了
I think you may be running into the max flash read speed.  The flash can only read at 4 ...

原来是flash和rom的读取速度的限制啊?
14#

lxc115

发表于 2013-1-17 10:06:28 | 只看该作者

cn_x 发表于 2013-1-15 14:24
我找到答案了
I think you may be running into the max flash read speed.  The flash can only read at 4 ...

已验证。
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN;
ROM_SysCtlDelay(SysCtlClockGet()/3);
延时1s,说明没有达到ROM的读取速度限制。

SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ| SYSCTL_OSC_MAIN);
SysCtlDelay(SysCtlClockGet()/3);
延时2s,超过Flash读取速度上限,如果改为:
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ| SYSCTL_OSC_MAIN);
SysCtlDelay(SysCtlClockGet()/3);
是系统运行在40MHz,延时仍然是1s。
您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条