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.

MAP_UtilsDelay函数的参数定义?

Other Parts Discussed in Thread: CC3200

    MAP_UtilsDelay函数的参数定义?

    最近测试了一下 CC3200 的延时函数MAP_UtilsDelay,(CC3200 80Mhz IAR环境调试)
    MAP_UtilsDelay(80000000/3)  网上许多帖子说应该是1s,可我测下来大约是2秒,请使用过的朋友确认一下。
    
    我也看了一下汇编,的确就是2条指令:
UtilsDelay:
    SUBS    R0,#1
    BNE.N   UtilsDelay      
    
    另外,我的程序是在 FreeRTOS 环境下运行,但测试代码放置在任务建立之前。

  • 您可以看一下

    //*****************************************************************************
    //
    //! Provides a small delay.
    //!
    //! \param ulCount is the number of delay loop iterations to perform.
    //!
    //! This function provides a means of generating a constant length delay.  It
    //! is written in assembly to keep the delay consistent across tool chains,
    //! avoiding the need to tune the delay based on the tool chain in use.
    //!
    //! The loop takes 3 cycles/loop.
    //!
    //! \return None.
    //
    //*****************************************************************************
    

  • 请问下面的指令需要几个机器周期?

    UtilsDelay:
        SUBS    R0,#1
        BNE.N   UtilsDelay      

    是不是CC3200 还有加速或者指令预取开关,我没有打开?

    根据我的测试应该需要6个机器周期,而不是3个机器周期。

  • 我看了一下 e2echina.ti.com/.../81810
    中的讨论,其中最后一条表述和我的测试一致:

    Ray2: “为什么我用 MAP_UtilsDelay() 参数是(40/3)的时候是1us,不知道是不是准确”

    80/6 对应 1us , 80000000/6 对应 1秒。

    TI 文档中提到的 “The loop takes 3 cycles/loop” , cycles 是 1/80 us 吗?
  • 最近使用了下列2种方法测试了MAP_UtilsDelay

    1. 使用 IAR simulator 观察延时1ms 需要的机器周期数,结果是一个 MAP_UtilsDelay的循环需要5个机器周期;
    2. 使用cc3200内部的定时器测试1ms 需要的机器周期数,结果是一个 MAP_UtilsDelay的循环需要6个机器周期;
    3. TI 的表述 The loop takes 3 cycles/loop.


    这是矛盾的结果,请 TI 工程师帮忙解释一下。
    本人认可第2个结果。