微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI Zigbee设计交流 > Z-Stack协议栈问题

Z-Stack协议栈问题

时间:10-02 整理:3721RD 点击:

SampleAPP默认总线时钟是16MHZ 吗?

默认你是说上电后还是初始化后,初始化后是32Mhz.

上电时,都是关闭的,进入active 16MRC和32M晶振都会打开,然后就根据你的选择。

#define HAL_BOARD_INIT()                                         \
{                                                                \
  uint16 i;                                                      \
                                                                 \
  SLEEPCMD &= ~OSC_PD;                       /* turn on 16MHz RC and 32MHz XOSC */                \
  while (!(SLEEPSTA & XOSC_STB));            /* wait for 32MHz XOSC stable */                     \
  asm("NOP");                                /* chip bug workaround */                            \
  for (i=0; i<504; i++) asm("NOP");          /* Require 63us delay for all revs */                \
  CLKCONCMD = (CLKCONCMD_32MHZ | OSC_32KHZ); /* Select 32MHz XOSC and the source for 32K clock */ \
  while (CLKCONSTA != (CLKCONCMD_32MHZ | OSC_32KHZ)); /* Wait for the change to be effective */   \
  SLEEPCMD |= OSC_PD;                        /* turn off 16MHz RC */                              \
                                                                 \
  /* Turn on cache prefetch mode */                              \
  PREFETCH_ENABLE();                                             \
                                                                 \
  HAL_TURN_OFF_LED1();                                           \
  LED1_DDR |= LED1_BV;                                           \
  HAL_TURN_OFF_LED2();                                           \
  LED2_DDR |= LED2_BV;                                           \
  HAL_TURN_OFF_LED3();                                           \
  LED3_DDR |= LED3_BV;                                           \
                                                                 \
  /* configure tristates */                                      \
  P0INP |= PUSH2_BV;                                             \
}

在我没有做任何更改的情况下,总线频率是32MHZ ?延时程序老是做不好,所以想咨询一下初始化后的总线频率

是啊,初始化程序都贴给你看了。延迟是硬delay还是软delay, us 还是ms?

us,输出输入延迟

借鉴下面的思路,32 NOP就是1usecs

void WaitMs(uint16 ms)
{
    uint16 us;
/* 32 NOPs == 1 usecs */
    while (ms--)
    {
        us=1000;
        while (us--)
        {
            /* 32 NOPs == 1 usecs */
            asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
            asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
            asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
            asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
            asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
            asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop");
            asm("nop"); asm("nop");
        }
    }   
}

好的,谢谢,太详细了

请确认已结束这个topic。thanks

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

网站地图

Top