请教一个问题:
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);
这个怎么都想不明白
此帖出自
小平头技术问答
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
一周热门 更多>