微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI无线射频设计 > 关于CC2540的TICK_TIME设置,系统时钟初始化的问题?

关于CC2540的TICK_TIME设置,系统时钟初始化的问题?

时间:12-22 整理:3721RD 点击:

大家好!

我在SimpleBLECentral例子的OnBoard.h中看到如下宏定义

#define TICK_TIME 1000 /* Timer per tick - in micro-sec */
#define TICK_COUNT 1
#define OSAL_TIMER  HAL_TIMER_3

我知道这定义系统的节拍为1微妙,定时器为定时器4.但是我在程序其他地方没有看到哪里使用了这些宏定义.

我想知道系统时钟在哪里初始化的,初始化时做了哪些事?

不是Timer3,4,而是Timer2.可以看看osalTimeUpdate()的处理。

/*********************************************************************
* @fn osalTimeUpdate
*
* @brief Uses the free running rollover count of the MAC backoff timer;
* this timer runs freely with a constant 320 usec interval. The
* count of 320-usec ticks is converted to msecs and used to update
* the OSAL clock and Timers by invoking osalClockUpdate() and
* osalTimerUpdate(). This function is intended to be invoked
* from the background, not interrupt level.

*

* @param None.
*
* @return None.
*/
void osalTimeUpdate( void )
{
uint16 tmp;
uint16 ticks625us;
uint16 elapsedMSec = 0;

// Get the free-running count of 625us timer ticks
tmp = ll_McuPrecisionCount();

if ( tmp != previousLLTimerTick )
{
// Calculate the elapsed ticks of the free-running timer.
ticks625us = tmp - previousLLTimerTick;

// Store the LL Timer tick count for the next time through this function.
previousLLTimerTick = tmp;

/* It is necessary to loop to convert the usecs to msecs in increments so as
* not to overflow the 16-bit variables.
*/
while ( ticks625us > MAXCALCTICKS )
{
ticks625us -= MAXCALCTICKS;
elapsedMSec += MAXCALCTICKS * 5 / 8;
remUsTicks += MAXCALCTICKS * 5 % 8;
}

// update converted number with remaining ticks from loop and the
// accumulated remainder from loop
tmp = (ticks625us * 5) + remUsTicks;

// Convert the 625 us ticks into milliseconds and a remainder
elapsedMSec += tmp / 8;
remUsTicks = tmp % 8;

// Update OSAL Clock and Timers
if ( elapsedMSec )
{
osalClockUpdate( elapsedMSec );
osalTimerUpdate( elapsedMSec );
}
}
}

不知道ll_McuPrecisionCount这个函数的做了什么?

节拍是320us吗?还是625us?

625us

TY

625us

谢谢你~

请问系统进入PM1、PM2和PM3时,定时器还在运行吗?

如果我需要使用某个定时器,那么是不是在使用期间无法进入省功耗模式?

上一篇:CC2540 BTOOL使用帮助
下一篇:TIcc2541认证

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top