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

2019-03-24 12:59发布

请教一个问题:
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条回答
zhugean
1楼-- · 2019-03-24 17:47
 精彩回答 2  元偷偷看……
cn_x
2楼-- · 2019-03-24 20:20
< :TI_MSP430_内容页_SA7 --> 请问有相关的文档吗?
cn_x
3楼-- · 2019-03-24 21:11
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
linda
4楼-- · 2019-03-25 01:13
 精彩回答 2  元偷偷看……

一周热门 更多>

相关问题

    相关文章