This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CC3200MOD:utilsdelay 未在 CC3200 &CC3220SF 中提供精确的延迟

Guru**** 2540720 points
Other Parts Discussed in Thread: CC3200, CC3220SF

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/1003724/cc3200mod-utilsdelay-is-not-giving-precise-delay-in-cc3200-cc3220sf

器件型号:CC3200MOD
主题中讨论的其他器件:CC3200CC3220SF

您好!

我在  SDK driverlib 中使用 utils.c 中的 UtilsDelay 来实现微秒延迟。

用于 UtilsDelay 的汇编代码(无符号整型 ulCount)

//对于 CCS、在纯汇编语言中实现此函数。  这会阻止 TI

//编译器不会对优化器执行有趣的操作。

//

#if defined (CCS)(如果已定义)

   _asm ("   .sect \".text:UtilsDelay)"\n"

         "   .clink\n"

         "   .thumbfunc UtilsDelay (.thumbfunc UtilsDelay)\n"

         "   .thumb \n"

         "   .global UtilsDelay (.global 实用程序删除)\n"

         "实用程序延迟:\n"

         "   subs r0、#1\n"         

         "   伯恩·乌蒂斯·德莱恩"       

          "   BX lr\n");

#endif

根据文档 、UtilsDelay (unsigned long ulCount)函数需要3个时钟周期才能执行。

在 CC3200中、以下计算得出10us 延迟的20us 延迟比预期的要大2倍

ulCount = 10 * 80/3  

预计:10us 延迟

输出:20us 延迟

在 CC3220SF 中、以下是10us 延迟的计算结果、延迟为40us、比预期的延迟高出4倍

ulCount = 10 * 80/3  

预计:10us 延迟

输出:40us 延迟

我的问题:

为什么在 CC3200中看到的延迟是原来的2倍、在 CC3220SF 中看到的延迟是原来的4倍

谢谢、

      科尔内利斯 S

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Cornelius、

    您如何测试延迟?

    此致、

    Sarah

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Sarah、

            我使用 GPIO 开启和关闭来测量延迟

            GPIO_ON

            UtilsDelay

            GPIO_OFF

    谢谢、

          科尔内利斯 S

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Cornelius S、

    我假设您正在使用 CC3200的演示 GPIO_IF API (GPIO_IF_LedOn)和 CC3220的 TI 驱动程序 API (GPIO_write 或 GPIO_toggle)? 请记住、这些 API 需要额外的时钟周期才能执行。 尤其是在 CC3220上、TI 驱动程序 API 是特定于器件的 driverlib 之上的抽象层。

    driverlib API 是 GPIOPinWrite。 如果您直接使用此 API、您是否能获得更好的结果?

    // For CC3200
    #include "hw_types.h"
    #include "hw_memmap.h"
    #include "pin.h"
    #include "gpio.h"
    
    // For CC3220 
    #include "ti/devices/cc32xx/inc/hw_types.h"
    #include "ti/devices/cc32xx/inc/hw_memmap.h"
    #include "ti/devices/cc32xx/driverlib/pin.h"
    #include "ti/devices/cc32xx/driverlib/gpio.h"
    
    GPIOPinWrite(GPIOA1_BASE, PIN_64, 0);

    从寄存器级写入 GPIO 外设应该 提供 一个更准确的延迟。  请参阅 CC3200 TRMCC3220 TRM

    此致、

    Sarah