cn_x 发表于 2013-1-14 13:31:43

请教LM4F120XL LAUNCHPAD使用ROM_前缀和不使用ROM_前缀SysCtlDelay延...

请教一个问题:
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);
这个怎么都想不明白

cn_x 发表于 2013-1-14 17:14:58

我找到答案了
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/microcontrollers/stellaris_arm_cortex-m3_microcontroller/f/471/t/143842.aspx

zhugean 发表于 2013-2-27 08:41:40

well!!!!!!!!!!!!
页: [1]
查看完整版本: 请教LM4F120XL LAUNCHPAD使用ROM_前缀和不使用ROM_前缀SysCtlDelay延...