This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

z-stack home key pressed

Other Parts Discussed in Thread: CC2530, Z-STACK, CC2591

Hello,

I want to modify buttons in the sample application z-stack home SampleSwitch of CC2530. Button at P1.4 will invoke Ez-Mode  and button at P0.1 will send a message to the other board.

How can I change the address of those HAL_KEY_SW  in hal_key.h to get the result above? and where to put my codes in for each button, does it in hal_key.c or in Onboard.c?

  • My system works good now. Thank you for your help.
    I would like to add SPI and I2C into the code. Does GenericApp has functions to call them like UART?
  • 1. You can refer to LCD driver in hal_lcd.c for SPI driver.

    2. I attach hal_i2c.c and hal_i2c.h from RF4CE stack for you.

    /**************************************************************************************************
      Filename:       hal_i2c.c
      Revised:        $Date: 2010-06-28 17:37:07 -0700 (Mon, 28 Jun 2010) $
      Revision:       $Revision: 22837 $
    
      Description:    I2C driver implementation.
    
    
      Copyright 2006 - 2010 Texas Instruments Incorporated. All rights reserved.
    
      IMPORTANT: Your use of this Software is limited to those specific rights
      granted under the terms of a software license agreement between the user
      who downloaded the software, his/her employer (which must be your employer)
      and Texas Instruments Incorporated (the "License").  You may not use this
      Software unless you agree to abide by the terms of the License. The License
      limits your use, and you acknowledge, that the Software may not be modified,
      copied or distributed unless embedded on a Texas Instruments microcontroller
      or used solely and exclusively in conjunction with a Texas Instruments radio
      frequency transceiver, which is integrated into your product.  Other than for
      the foregoing purpose, you may not use, reproduce, copy, prepare derivative
      works of, modify, distribute, perform, display or sell this Software and/or
      its documentation for any purpose.
    
      YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
      PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, 
      INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, 
      NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
      TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
      NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
      LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
      INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
      OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
      OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
      (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
    
      Should you have any questions regarding your right to use this Software,
      contact Texas Instruments Incorporated at www.TI.com. 
    **************************************************************************************************/
    
    /**************************************************************************************************
        This file contains the I2C interface to off-chip serial EEPROM. While
        much of the driver is generic, certain portions are specific to the
        Atmel part AT24C1024. For example, the 17th address bit occurs in the
        device address byte where one of the address pins should be. Different
        1 Mb parts use a different bit location. This could be abstracted at
        a later time if this is the only differentce among these parts.
    **************************************************************************************************/
    
    #include "ioCC2530.h"
    #include "zcomdef.h"
    #include "hal_i2c.h"
    
    #define STATIC static
    
    #if !defined HAL_I2C_RETRY_CNT
    #define HAL_I2C_RETRY_CNT  3
    #endif
    
    // the default cofiguration below uses P1.6 for SDA and P0.0 for SCL.
    // change these as needed.
    #ifndef OCM_CLK_PORT
      #define OCM_CLK_PORT  0
    #endif
    
    #ifndef OCM_DATA_PORT
      #define OCM_DATA_PORT   1
    #endif
    
    #ifndef OCM_CLK_PIN
      #define OCM_CLK_PIN   0
    #endif
    
    #ifndef OCM_DATA_PIN
      #define OCM_DATA_PIN    6
    #endif
    
    // General I/O definitions
    #define IO_GIO  0  // General purpose I/O
    #define IO_PER  1  // Peripheral function
    #define IO_IN   0  // Input pin
    #define IO_OUT  1  // Output pin
    #define IO_PUD  0  // Pullup/pulldn input
    #define IO_TRI  1  // Tri-state input
    #define IO_PUP  0  // Pull-up input pin
    #define IO_PDN  1  // Pull-down input pin
    
    #define OCM_ADDRESS  (0xA0)
    #define OCM_READ     (0x01)
    #define OCM_WRITE    (0x00)
    #define SMB_ACK      (0)
    #define SMB_NAK      (1)
    #define SEND_STOP    (0)
    #define NOSEND_STOP  (1)
    #define SEND_START   (0)
    #define NOSEND_START (1)
    
    // device specific as to where the 17th address bit goes...
    
    // *************************   MACROS   ************************************
    #undef P
    
      /* I/O PORT CONFIGURATION */
    #define CAT1(x,y) x##y  // Concatenates 2 strings
    #define CAT2(x,y) CAT1(x,y)  // Forces evaluation of CAT1
    
    // OCM port I/O defintions
    // Builds I/O port name: PNAME(1,INP) ==> P1INP
    #define PNAME(y,z) CAT2(P,CAT2(y,z))
    // Builds I/O bit name: BNAME(1,2) ==> P1_2
    #define BNAME(port,pin) CAT2(CAT2(P,port),CAT2(_,pin))
    
    // OCM port I/O defintions
    #define OCM_SCL BNAME(OCM_CLK_PORT, OCM_CLK_PIN)
    #define OCM_SDA BNAME(OCM_DATA_PORT, OCM_DATA_PIN)
    
    #define IO_DIR_PORT_PIN(port, pin, dir) \
    {\
      if ( dir == IO_OUT ) \
        PNAME(port,DIR) |= (1<<(pin)); \
      else \
        PNAME(port,DIR) &= ~(1<<(pin)); \
    }
    
    #define OCM_DATA_HIGH()\
    { \
      IO_DIR_PORT_PIN(OCM_DATA_PORT, OCM_DATA_PIN, IO_IN); \
    }
    
    #define OCM_DATA_LOW() \
    { \
      IO_DIR_PORT_PIN(OCM_DATA_PORT, OCM_DATA_PIN, IO_OUT); \
      OCM_SDA = 0;\
    }
    
    #define IO_FUNC_PORT_PIN(port, pin, func) \
    { \
      if( port < 2 ) \
      { \
        if ( func == IO_PER ) \
          PNAME(port,SEL) |= (1<<(pin)); \
        else \
          PNAME(port,SEL) &= ~(1<<(pin)); \
      } \
      else \
      { \
        if ( func == IO_PER ) \
          P2SEL |= (1<<(pin>>1)); \
        else \
          P2SEL &= ~(1<<(pin>>1)); \
      } \
    }
    
    #define IO_IMODE_PORT_PIN(port, pin, mode) \
    { \
      if ( mode == IO_TRI ) \
        PNAME(port,INP) |= (1<<(pin)); \
      else \
        PNAME(port,INP) &= ~(1<<(pin)); \
    }
    
    #define IO_PUD_PORT(port, dir) \
    { \
      if ( dir == IO_PDN ) \
        P2INP |= (1<<(port+5)); \
      else \
        P2INP &= ~(1<<(port+5)); \
    }
    
    STATIC void   hali2cSend( uint8 *buffer, uint16 len, uint8 sendStart, uint8 sendStop );
    STATIC _Bool  hali2cSendByte( uint8 dByte );
    STATIC void   hali2cWrite( bool dBit );
    STATIC void   hali2cClock( bool dir );
    STATIC void   hali2cStart( void );
    STATIC void   hali2cStop( void );
    STATIC void   hali2cReceive( uint8 address, uint8 *buffer, uint16 len );
    STATIC uint8  hali2cReceiveByte( void );
    STATIC _Bool  hali2cRead( void );
    STATIC void   hali2cSendDeviceAddress(uint8 address);
    
    
    STATIC __near_func void   hali2cWait( uint8 );
    
    STATIC uint8 s_xmemIsInit;
    
    /*********************************************************************
     * @fn      HalI2CInit
     * @brief   Initializes two-wire serial I/O bus
     * @param   void
     * @return  void
     */
    void HalI2CInit( void )
    {
      if (!s_xmemIsInit)  {
        s_xmemIsInit = 1;
    
    //    // Set port pins as inputs
    //    IO_DIR_PORT_PIN( OCM_CLK_PORT, OCM_CLK_PIN, IO_IN );
    //    IO_DIR_PORT_PIN( OCM_DATA_PORT, OCM_DATA_PIN, IO_IN );
    //
    //    // Set for general I/O operation
    //    IO_FUNC_PORT_PIN( OCM_CLK_PORT, OCM_CLK_PIN, IO_GIO );
    //    IO_FUNC_PORT_PIN( OCM_DATA_PORT, OCM_DATA_PIN, IO_GIO );
    //
    //    // Set I/O mode for pull-up/pull-down
    //    IO_IMODE_PORT_PIN( OCM_CLK_PORT, OCM_CLK_PIN, IO_PUD );
    //    IO_IMODE_PORT_PIN( OCM_DATA_PORT, OCM_DATA_PIN, IO_PUD );
    //
    //    // Set pins to pull-up
    //    IO_PUD_PORT( OCM_CLK_PORT, IO_PUP );
    //    IO_PUD_PORT( OCM_DATA_PORT, IO_PUP );
      }
    }
    
    int8 HalI2CReceive(uint8 address, uint8 *buf, uint16 len)
    {
      hali2cReceive(address, buf, len);
    
      return 0;
    }
    
    int8 HalI2CSend(uint8 address, uint8 *buf, uint16 len)
    {
      // begin the write sequence with the address byte
      hali2cSendDeviceAddress(address);
      hali2cSend(buf, len, NOSEND_START, SEND_STOP);
    
      return 0;
    }
    /*********************************************************************
     * @fn      hali2cSend
     * @brief   Sends buffer contents to SM-Bus device
     * @param   buffer - ptr to buffered data to send
     * @param   len - number of bytes in buffer
     * @param   sendStart - whether or not to send start condition.
     * @param   sendStop - whether or not to send stop condition.
     * @return  void
     */
    STATIC void hali2cSend( uint8 *buffer, uint16 len, uint8 sendStart, uint8 sendStop )
    {
      uint16 i;
      uint8 retry = HAL_I2C_RETRY_CNT;
    
      if (!len)  {
        return;
      }
    
      if (sendStart == SEND_START)  {
        hali2cStart();
      }
    
      for ( i = 0; i < len; i++ )
      {
        do {
          if ( hali2cSendByte( buffer[i] ) )  // takes care of ack polling
          {
            break;
          }
        } while ( --retry );
      }
    
      if (sendStop == SEND_STOP) {
        hali2cStop();
      }
    }
    
    /*********************************************************************
     * @fn      hali2cSendByte
     * @brief   Serialize and send one byte to SM-Bus device
     * @param   dByte - data byte to send
     * @return  ACK status - 0=none, 1=received
     */
    STATIC _Bool hali2cSendByte( uint8 dByte )
    {
      uint8 i;
    
      for ( i = 0; i < 8; i++ )
      {
        // Send the MSB
        hali2cWrite( dByte & 0x80 );
        // Next bit into MSB
        dByte <<= 1;
      }
      // need clock low so if the SDA transitions on the next statement the
      // slave doesn't stop. Also give opportunity for slave to set SDA
      hali2cClock( 0 );
      OCM_DATA_HIGH(); // set to input to receive ack...
      hali2cClock( 1 );
      hali2cWait(1);
    
      return ( !OCM_SDA );  // Return ACK status
    }
    
    /*********************************************************************
     * @fn      hali2cWrite
     * @brief   Send one bit to SM-Bus device
     * @param   dBit - data bit to clock onto SM-Bus
     * @return  void
     */
    STATIC void hali2cWrite( bool dBit )
    {
      hali2cClock( 0 );
      hali2cWait(1);
      if ( dBit )
      {
        OCM_DATA_HIGH();
      }
      else
      {
        OCM_DATA_LOW();
      }
    
      hali2cClock(1);    
      hali2cWait(1);
    }
    
    /*********************************************************************
     * @fn      hali2cClock
     * @brief   Clocks the SM-Bus. If a negative edge is going out, the
     *          I/O pin is set as an output and driven low. If a positive
     *          edge is going out, the pin is set as an input and the pin
     *          pull-up drives the line high. This way, the slave device
     *          can hold the node low if longer setup time is desired.
     * @param   dir - clock line direction
     * @return  void
     */
    STATIC void hali2cClock( bool dir )
    {
      if ( dir )
      {
        IO_DIR_PORT_PIN( OCM_CLK_PORT, OCM_CLK_PIN, IO_IN );
        while(!OCM_SCL) /* Wait until clock is high */
            hali2cWait(1);
      }
      else
      {
        IO_DIR_PORT_PIN( OCM_CLK_PORT, OCM_CLK_PIN, IO_OUT );
        OCM_SCL = 0;
      }
      hali2cWait(1);
    }
    
    /*********************************************************************
     * @fn      hali2cStart
     * @brief   Initiates SM-Bus communication. Makes sure that both the
     *          clock and data lines of the SM-Bus are high. Then the data
     *          line is set high and clock line is set low to start I/O.
     * @param   void
     * @return  void
     */
    STATIC void hali2cStart( void )
    {
      uint8 retry = HAL_I2C_RETRY_CNT;
    
      // set SCL to input but with pull-up. if slave is pulling down it will stay down.
      hali2cClock(1);
    
      do {
        // wait for slave to release clock line...
        if (OCM_SCL)  // wait until the line is high...
        {
          break;
        }
        hali2cWait(1);
      } while ( --retry );
    
      // SCL low to set SDA high so the transition will be correct.
      hali2cClock(0);
      OCM_DATA_HIGH();  // SDA high
      hali2cClock(1);      // set up for transition
      hali2cWait(1);
      OCM_DATA_LOW();   // start
    
      hali2cWait(1);
      hali2cClock( 0 );
    }
    
    /*********************************************************************
     * @fn      hali2cStop
     * @brief   Terminates SM-Bus communication. Waits unitl the data line
     *          is low and the clock line is high. Then sets the data line
     *          high, keeping the clock line high to stop I/O.
     * @param   void
     * @return  void
     */
    STATIC void hali2cStop( void )
    {
      // Wait for clock high and data low
      hali2cClock(0);
      OCM_DATA_LOW();  // force low with SCL low
      hali2cWait(1);
    
      hali2cClock( 1 );
      OCM_DATA_HIGH(); // stop condition
      hali2cWait(1);
    
    }
    
    /*********************************************************************
     * @fn      hali2cWait
     * @brief   Wastes a an amount of time.
     * @param   count: down count in busy-wait
     * @return  void
     */
    STATIC __near_func void hali2cWait( uint8 count )
    {
      while ( count-- );
    }
    
    /*********************************************************************
     * @fn      hali2cReceiveByte
     * @brief   Read the 8 data bits.
     * @param   void
     * @return  character read
     */
    STATIC uint8 hali2cReceiveByte()
    {
      int8 i, rval = 0;
    
      for (i=7; i>=0; --i)  {
        if (hali2cRead())  {
          rval |= 1<<i;
        }
      }
    
      return rval;
    }
    /**************************************************************************************************
    **************************************************************************************************/
    /*********************************************************************
     * @fn      hali2cReceive
     * @brief   reads data into a buffer
     * @param   address: linear address on part from which to read
     * @param   buffer: target array for read characters
     * @param   len: max number of characters to read
     * @return  void
     */
    STATIC void hali2cReceive( uint8 address, uint8 *buffer, uint16 len )
    {
      //uint8  ch;
      uint16 i;
    
      if (!len)  {
        return;
      }
    
      hali2cSendDeviceAddress(address);
    
      //ch = OCM_ADDRESS_BYTE(0, OCM_READ);
      //hali2cSend(&ch, 1, SEND_START, NOSEND_STOP);
    
      for ( i = 0; i < len-1; i++ )
      {
        // SCL may be high. set SCL low. If SDA goes high when input
        // mode is set the slave won't see a STOP
        hali2cClock(0);
        OCM_DATA_HIGH();
    
        buffer[i] = hali2cReceiveByte();
        hali2cWrite(SMB_ACK);           // write leaves SCL high
      }
    
      // condition SDA one more time...
      hali2cClock(0);
      OCM_DATA_HIGH();
      buffer[i] = hali2cReceiveByte();
      hali2cWrite(SMB_NAK);
    
      hali2cStop();
    }
    
    /*********************************************************************
     * @fn      hali2cRead
     * @brief   Toggle the clock line to let the slave set the data line.
     *          Then read the data line.
     * @param   void
     * @return  TRUE if bit read is 1 else FALSE
     */
    STATIC _Bool hali2cRead( void )
    {
      // SCL low to let slave set SDA. SCL high for SDA
      // valid and then get bit
      hali2cClock( 0 );
      hali2cWait(1);
      hali2cClock( 1 );
      hali2cWait(1);
    
      return OCM_SDA;
    }
    
    /*********************************************************************
     * @fn      hali2cSendDeviceAddress
     * @brief   Send onlythe device address. Do ack polling
     *
     * @param   void
     * @return  none
     */
    STATIC void hali2cSendDeviceAddress(uint8 address)
    {
      uint8 retry = HAL_I2C_RETRY_CNT;
    
      do {
        hali2cStart();
        if (hali2cSendByte(address))  // do ack polling...
        {
          break;
        }
      } while ( --retry );
    }
    
    hal_i2c.h

  • Thank you Chen
  • You are welcome.
  • Dear Chen,
    Does CC2530 has internal memory (like EEPROM) so that I can write and read value from it? And how to use that function?
  • I see that the Flash memory can be used to stored data beside program codes. So which functions can I use to access flash memory?
  • You can use osal_nv_write to write internal flash.
  • Dear Chen,

    I am trying to use UART port 1 which are P1.6(TX) and P1.7(RX). The code for initiating UART :

    halUARTCfg_t uartConfig;
    uartConfig.configured = TRUE;
    uartConfig.baudRate = HAL_UART_BR_9600;
    uartConfig.flowControl = HAL_UART_FLOW_OFF;
    uartConfig.flowControlThreshold = 48;
    uartConfig.rx.maxBufSize = 128;
    uartConfig.tx.maxBufSize = 128;
    uartConfig.idleTimeout = 6;
    uartConfig.intEnable = TRUE;
    uartConfig.callBackFunc = UartProcessData;

    HalUARTOpen (HAL_UART_PORT_1, &uartConfig);

    And in hal_board_cfg.h I change the code:

    #if HAL_UART
    #ifndef HAL_UART_DMA
    #if HAL_DMA
    #if (defined ZAPP_P2) || (defined ZTOOL_P2)
    #define HAL_UART_DMA 2
    #else
    #define HAL_UART_DMA 2
    #endif
    #else
    #define HAL_UART_DMA 2
    #endif
    #endif

    But I can not get the UART working. It used to work when I use UART port 0 (P0.2,P0.3). Could you help me with this?
  • Don't change anything in hal_board_cfg.h. Just define the followings in compile options.
    HAL_UART=TRUE
    HAL_UART_ISR=1
    HAL_UART_DMA=2
  • I just add those in compile, but there is error in linker when build. It said:

    Error[e104]: Failed to fit all segments into specified ranges. Problem discovered in segment XDATA_N. Unable to place 2 block(s) (0xc02 byte(s) total) in 0xba8 byte(s) of memory. The problem occurred while processing the segment placement command "-P(XDATA)XDATA_N=_XDATA_START-_XDATA_END", where at the moment of placement the available memory ranges were "XDATA:1358-1eff"

    Error while running Linker
  • I think your application uses two many XDATA space. Do you allocate large buffers for UART? If yes, try to decrease buffer size.
  • Do you mean decrease tx buffer and rx buffer ?

    halUARTCfg_t uartConfig;
    uartConfig.configured = TRUE;
    uartConfig.baudRate = HAL_UART_BR_9600;
    uartConfig.flowControl = HAL_UART_FLOW_OFF;
    uartConfig.flowControlThreshold = 48;
    uartConfig.rx.maxBufSize = 10;
    uartConfig.tx.maxBufSize = 10;
    uartConfig.idleTimeout = 6;
    uartConfig.intEnable = TRUE;
    uartConfig.callBackFunc = UartProcessData;

    I try to decrease it but the error still the same
  • Not only those two. Do you claim large arrays in your application?
  • The biggest array is only 11 bytes, and I only use 5 arrays.
  • Try to remove all defines with MT_ as prefix.
  • xZTOOL_P1
    xMT_TASK
    xMT_SYS_FUNC
    xMT_ZDO_FUNC
    xLCD_SUPPORTED=DEBUG
    HAL_UART
    xHAL_DMA
    HAL_UART=TRUE
    HAL_UART_ISR=1
    HAL_UART_DMA=2
    xZAPP_P2
    xHAL_I2C
    HAL_PA_LNA
    xISR_KEYINTERRUPT
    NV_RESTORE
    NV_INIT

    I have remove all MT_ in the compiler option. Is this what you mean?
  • All code work fine when I use UART port 0. But now I want to change to port 1, it seem not working.
  • The same problem still occur, although I have remove those MT_
  • If you use original SampleSwitch and only define the following to see if you still have compile errors.

    HAL_UART=TRUE
    HAL_UART_ISR=1
    HAL_UART_DMA=2
  • The original code is working, I use GenericApp from Z-Mesh. I will check all of my backup files to see which cause this problem
  • I have found the problem. If not remove
    MT_TASK
    MT_SYS_FUNC
    MT_ZDO_FUNC
    the program can work. I have removed these 3 lines before. That why the error occurs
  • It's good to know you find where the problem is.
  • I build a system with 1 Coordinator and 2 Routers. Router 1 is in range of Coordinator, Router 2 is in range of Router 1 but not in range of Coordinator. I try to send message from Router 2 to Coordinator but not success. How can I configure the system so that Router 1 route the message from Router 2 to the Coordinator?
  • You don't have to enable anything in Z-Stack. ZR1 should route message for ZR2 if ZR2 is in radio coverage of ZR1. Are you sure that ZR2 already joins the same Zigbee network of ZC and ZR1? I suggest you using Ubiqua Packet Analyzer to check over the air messages.
  • The three of them have same PAN ID. So in ZStack Mesh, I dont need to bind device or something like that to route message ?
  • Binding is use for assigning destination address of message not assigning routing message.
  • When Router turn on, does it automatically search for it neighbor to from something like a routing table so that it know which router to send when I ask it to send to a specific short address. And are there any functions to know the Router has finish searching?
  • No, router won't search for its neighbor when it turns on.
  • When I use code like:

    GenericApp_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
    GenericApp_DstAddr.endPoint = 10;
    GenericApp_DstAddr.addr.shortAddr = 0x0000;

    if ( AF_DataRequest( &GenericApp_DstAddr, &GenericApp_epDesc,
    GENERICAPP_CLUSTERID,
    3,
    (byte *)&StartMessage,
    &GenericApp_TransID,
    AF_DISCV_ROUTE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
    {
    HalLedSet ( HAL_LED_4, HAL_LED_MODE_BLINK );
    }

    Does the router know which way it will send message? And Does it automatically retry to send to other route when it can not send to coordinator by direct route?
  • Yes, router should know where to send the message.
  • Dear Chen,
    I try to use Ubiqua Protocol Analyzer to test, but it is not working. Does my program need to enable SPI interface for it to work?
  • Do you plug in CC2531 USB dongle to desktop run Ubiqua?
  • No I don't have CC2531 USB dongle. I just connect the board to desktop by using CC Debugger
  • To run Ubiqua, you need to have a CC2531 USB dongle.
  • Dear Chen,

    How can we know when Router finishes finding new route? Does it return some functions, some status when it find new route? And does it also return some status to indicate it can not send message to that route?
    When I use AF_DataRequest it just send message without inform me that the sending is fail.
  • You cannot know when Router finishes finding new route. When you use AF_DataRequest, you can enable APS ack to know if the message is delivered to destination.
  • My system which includes 1 Coordinator and 2 Routers. The code I use in Routers will send a message every 2s to Coordinator.
    When 2 Routers in the RF range of Coordinator (about 600m) it works fine, Coordinator can receive the message. But when I move Router 2 out of Coordinator's RF range ( Router 1 still in RF range of Coordinator and Router 2), Coordinator can not receive Router 2's message.
    Is the problem occur because I send the message every 2s without know it reach the destination so that the Router does not have time to find new route to Coordinator?
  • I cannot judge from your description. You should use Ubiqua Packet Analyzer to check what happens in your test.
  • Dear Chen,

    Sorry to bother you, but I don't know where to look up for the acknowledge message.
    I use AF_DataRequest() with option AF_ACK_REQUEST. But it seems that the acknowledge message from other device is not show in GenericApp_MessageMSGCB().
    Could you tell me where I can look for it?
  • You have to add a case "case AF_DATA_CONFIRM_CMD:" to process AF ACK of AF_DataRequest.
  • Thanks Chen,

    I have seen "case AF_DATA_CONFIRM_CMD:" in "if ( events & SYS_EVENT_MSG )" of GenericApp. But there are something bother me. When I use default option "AF_DISCV_ROUTE" in stead of "AF_ACK_REQUEST". It also trigger "case AF_DATA_CONFIRM_CMD:" and set value of "sentStatus". Does AF_DISCV_ROUTE and AF_ACK_REQUEST has any different?
  • AF_DISCV_ROUTE is a don't care since Z-Stack sets it all the time in the nwk layer.