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.

How to implement 100us resolution timer in CC3200/CC3220?

Other Parts Discussed in Thread: CC3220SF

Hello, I want to set 100us resolution inveral timer, but API in SDK only supports 1ms level.  Must I set timer in register level? Whick TIMER register should I choice? 

May Anyone help me some reference source code? Thank you very much.

  • Hi Human,

    You can use the Timer driver which can be set to a resolution of 12.5ns with the 80MHz clock. You can check the Drivers Runtime APIs to get more info. You get there by going to the SDK’s installation directory and opening the Documentation Overview from the docs folder, there you go to the Drivers Documentation and click on the Driver Runtime APIs (doxygen) and there you can find the Timer driver APIs(Note, Timer was added on the latest release v1.30).

    To get the 100us resolution you want to set TIMER_PERIOD_COUNTS to 8000 (calculated from the 80MHz clock).

    Hope that helps,
    Gerardo
  • Hello Gerardo,

       Thank you for your replying.  Please allow me attach a few questions.

     1. Now I have to use CC3220 SDK v1.02 because the lastest HomeKit SDK plugin is only still available for this version.  How should I use 100us resolution timer? or will TI release a Timer driver patch for V1.02?

    2. Which Timer index should I select?  Will such resolution influence WiFi communication process?

     

     

  • Hi Human,

    The older CC32XX SDK will not be getting a patch for this, but the HomeKit SDK will be updating to CC32XX v 1.30 SDK at some point in the future.

    But you can manually do the equivalent of patching your HomeKit project with the Timer driver. To do this you want to first download CC32XX v 1.30 SDK to get the files needed. The files you need are Timer.c&.h from skd_install_dir/source/ti/drivers and TimerCC32XX.c&.h from skd_install_dir/source/ti/drivers/timer. You can add these to your project by right clicking it and selecting Add Files, select the files and when prompted choose to copy files. Then in your project you want to create a new folder by right clicking the project and selecting New->Folder, name the folder ti. Then right click the new folder and do the same to create a folder inside it named drivers. Inside this drivers folder you want to place your Timer.c&.h files that you added to the project. Then inside the drivers folder you want to create a new folder called timer. Inside this timer folder you want to place your TimerCC32XX.c&.h files. Your file structure should look as such:

    You also want to compare Board.h and CC3220SF_LAUNCHXL.c&h from skd_install_dir/source/ti/boards to the ones on your HomeKit project and pull in the changes made to support the timer. After doing this you should be able to use the timer driver.

    I don't think this timer resolution should affect the WiFi communication as it is firing every 8000 clock ticks.

    Let me know if that helps,
    Gerardo

  • Thank you very much. It works!

    BTW: Could you advice which forum should we discuss about CC3220's HomeKit development? We met some technical problems.
  • Due to the restrictions on HomeKit you need to talk to your TI business rep and he can help you direct your questions to the right people.

    Thanks,
    Gerardo