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.

CC3200 定时器捕获时钟 预分频

Other Parts Discussed in Thread: CC3200, CC2530

CC3200 工作在定时器捕获模式下,如何进行定时器时钟分频。

当我运行SDK中 timer_cc例程时加入

MAP_TimerPrescaleSet(TIMERA2_BASE,TIMER_A,80);//需要1M Hz时钟

捕获的数据始终是80 MHz时钟的数据。

  • CC3200定时器的预分频功能,只在16bit的timer上面有用,可以仔细看下MAP_TimerPrescaleSet的定义。




    谢谢

  • Ken 

      这是我修改过的定时器代码。MAP_TimerPrescaleSet直接用TimerPrescaleSet代替了  

     加入这个TIMER_CFG_SPLIT_PAIR  TIM2应该就在TIMER_A就在16bit方式吧

    MAP_TimerConfigure(TIMERA2_BASE, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_TIME));
    TimerPrescaleSet(TIMERA2_BASE,TIMER_A,80);
    //
    // Register timer interrupt hander
    //
    MAP_TimerIntRegister(TIMERA2_BASE,TIMER_A,TimerIntHandler);

    //
    // Set the detection edge
    //
    MAP_TimerControlEvent(TIMERA2_BASE,TIMER_A,TIMER_EVENT_BOTH_EDGES);

    //
    // Set the reload value
    //
    MAP_TimerLoadSet(TIMERA2_BASE,TIMER_A,0xFFFF);


    //
    // Enable capture event interrupt
    //
    MAP_TimerIntEnable(TIMERA2_BASE,TIMER_CAPA_EVENT);

    //
    // Enable Timer
    //
    MAP_TimerEnable(TIMERA2_BASE,TIMER_A);

  • 问题解决:

        CC3200的定时器分频不是作用在定时器输入时钟上的,不管怎么分频捕获的时钟始终是80M。

    它和CC2530等51内核的定时器时钟分频不一样。和STM32F1的也不一样。

    分频的作用只是限定最大捕获时间。而且捕获的数据值是32Bit的,数据最高8字节始终是0,只有后面24Bit有效。