写在前面
32.768kHz晶振一般应用于精准计时,比如RTC万年历、蓝牙的同步时钟等都是用的该低速时钟。
以下说明适用:基于TI-RTOS实时操作系统开发的芯片模组
一、检测原理
将时钟脉冲映射到IO口输出,再通过频率计或者示波器等仪器进行检测
二、源码
需要添加路劲:
cc26x0r2:$SIMPLELINK_CORE_SDK_INSTALL_DIR$\source\ti\devices\cc26x0r2
cc13x0:$SIMPLELINK_CC13X0_SDK_INSTALL_DIR$\source\ti\devices\cc13x0
源码说明
本文源码实现将外部低速晶振的时钟映射到IO0输出
若需要映射到其他IO口,可以修改一下参数:
IOC_O_IOCFG0
GPIO_DIO_0_MASK
比如改成IO2输出
IOC_O_IOCFG2
GPIO_DIO_2_MASK
test32_768kHzClock.c
#include <driverlib/osc.h>
#include <driverlib/aon_ioc.h>
#include <ti/drivers/pin/PINCC26XX.h>
#include "test32_768kHzClock.h"
//MeasureStartup()
//Returns the startup time as 65536 * number of 1/2 LF clock cycles elapsed during startup
//To get result in seconds divide this number by 2^32
//Must have these includes:
//#include <driverlib/osc.h>
//#include <driverlib/aon_ioc.h>
//HF clock source should not already be XOSC_HF when function is called (e.g. function can be placed near beginning of main())
//Must initialize I/Os before running this routine: e.g. PIN_init(BoardGpioInitTable);