CC2538的sleep timer写入问题
您好,我现在想对CC2538的sleep timer写入从别的地方接收到的时间值,所用代码为:
rtimer_clock_t cur_rt_ticks_low;
while((REG(SMWDTHROSC_STLOAD) & SMWDTHROSC_STLOAD_STLOAD) != 1);
INTERRUPTS_DISABLE();
cur_rt_ticks_low = clock & 0x00000000FFFFFFFF;
printf("clock_set_accurate_64 - %lu\n",cur_rt_ticks_low);
/* ST0 latches ST[1:3] and must be written last */
REG(SMWDTHROSC_ST3) = (cur_rt_ticks_low >> 24) & 0x000000FF;
REG(SMWDTHROSC_ST2) = (cur_rt_ticks_low >> 16) & 0x000000FF;
REG(SMWDTHROSC_ST1) = (cur_rt_ticks_low >> 8) & 0x000000FF;
REG(SMWDTHROSC_ST0) = cur_rt_ticks_low & 0x000000FF;
rtimer_clock_t rv;
/* SMWDTHROSC_ST0 latches ST[1:3] and must be read first */
rv = REG(SMWDTHROSC_ST0);
rv |= (REG(SMWDTHROSC_ST1) << 8);
rv |= (REG(SMWDTHROSC_ST2) << 16);
rv |= (REG(SMWDTHROSC_ST3) << 24);
printf("clock_set_accurate_64 - %lu\n",rv);
INTERRUPTS_ENABLE();
写入之后马上读出,两次printf得到的结果不一样。也就是说上面4句没有能够将cur_rt_ticks_low数据写入吗?写入参考了contiki里面的rtimer_arch_schedule函数的用法,为什么还会这样?
http://e2e.ti.com/support/wireless_connectivity/proprietary_sub_1_ghz_simpliciti/f/156/t/322101
这个链接可以参考下。