XDQ的笔记本

TI

A 2 post collection


CC1310 Sensor Controller 变更RTC事件时序

 •  Filed under MCU, TI, CC1310

在delay时间后以interval的周期运行Sensor Controller的RTC事件

#include DeviceFamily_constructPath(inc/hw_aon_rtc.h)

uint32_t scifOsalEnterCriticalSection(void);
void scifOsalLeaveCriticalSection(uint32_t key);

//delay应大于8
void SceRTCDelay(uint32_t delay,uint32_t interval){
    uint32_t key, sec, subsec,startTime;
    /* disable hwi to make sure startTime won't become past */
    key = scifOsalEnterCriticalSection();
    /* read current rtc value */
    sec = HWREG(AON_RTC_BASE + AON_RTC_O_SEC);
    subsec = HWREG(AON_RTC_BASE + AON_RTC_O_SUBSEC);
    /* calc next start time */
    startTime = ((sec << 16) | (subsec >> 16)) + delay;
    /* update the RTC cannel config */
    scifStartRtcTicks(startTime, interval);
    scifOsalLeaveCriticalSection(key);
}

TI CC1310 TRNG使用

 •  Filed under MCU, TI, CC1310

头文件

#include DeviceFamily_constructPath(driverlib/trng.h)

初始化

Power_setDependency(PowerCC26XX_PERIPH_TRNG);
TRNGEnable();
while (!(TRNGStatusGet() & TRNG_NUMBER_READY))
{
    //wait for random number generator
}

读取低32位

TRNGNumberGet(TRNG_LOW_WORD)

判断是否已经启动

if (0 == (HWREG(TRNG_BASE + TRNG_O_CTL) & TRNG_CTL_TRNG_EN))
{
    //trng is disable
}

关闭

TRNGDisable();
Power_releaseDependency(PowerCC26XX_PERIPH_TRNG);