[求助] 请教LM4F120XL LAUNCHPAD使用ROM_前缀和不使用ROM_前缀SysCtlDelay延时不一致的问题

cn_x   2013-1-14 13:36 楼主
请教一个问题:
ROM_SysCtlDelay(SysCtlClockGet()/3);
和SysCtlDelay(SysCtlClockGet()/3);
是不是同样延时1秒?

我在LM4F120XL LAUNCHPAD上实际的实验结果是
ROM_SysCtlDelay(SysCtlClockGet()/3) 延时了1秒
SysCtlDelay(SysCtlClockGet()/3)延时了2秒

时钟设置分别是
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
这个怎么都想不明白

回复评论 (4)

40M以下一样,以上就是差一倍

40M以下一样,以上就是差一倍
点赞  2013-1-14 14:14

回复 沙发 zhugean 的帖子

请问有相关的文档吗?
点赞  2013-1-14 15:36

我想我找到答案了

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

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
点赞  2013-1-14 17:17

回复 4楼 cn_x 的帖子

解决了就好
加油!在电子行业默默贡献自己的力量!:)
点赞  2013-1-15 09:41
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复