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.

CC2531: Z-Stack 3.0 with Android (Students project)

Part Number: CC2531
Other Parts Discussed in Thread: Z-STACK, CC2511

Hi,

for my studies I need to work with the cc2531 with Z-Stack and Android. The goal sounds simple: Two Android-devices shell "talk" to each other via the dongles using Z-Stack.

SOLUTION: WE MADE IT! CONNECTING ANDROID-DEVICES VIA ZIGBEE USING CC2531 IS POSSIBLE !!!!

All findings are compressed in this github-repo .

Read the Readme.md for more informations and all dependencies.

A special thank to YK Chen   who makes a great job here! Thank you, please don't stop!

Please feel free to use this thread for additional findings and questions! I will stay in touch and share my new knowlege with you!

__________________________________________________

... This is how it started...

I have no support and I am really really new to this. I didnt find any community, so I try my luck here. Assuming, someone will perhaps try the same and having the same issues and questions, I will collect all infos here.

SO, till now I have this:

- installed smart-RF

- installed flashprogrammer

- installed IAR Embedded Workbench

And there is my first problem:

I downloaded the Z-Stack from TI, but my PC (win 10) is not able to recordnize the file-type, its just "File", no ending. I cant open it or do anything with it.

How can I make the downloaded thing work?

I hope so much some one is out there, smiling while remembering his/her first trials and can lead me a little.

  • It’s an exe file after you download and unzip Z-Stack. If not, can you show me what you downloaded?
  • Yes, i thought so, but the download is an octed-stream. Im not sure how to show you, I followed the instructions exactly from the link you provided. I tried to append the .zip ending by my self but it is still unzipable (and openable). Do I miss something?

    (For making sure: clicked the download-button under "buy from TI", confirmed that i dont do mad with it, and just downloaded)

    I dont want to harm the licence by just appending the file, or shell i?

    I mad a picture from the download-menu:

    EDIT: It is an unziped .exe. After appending the .exe it worked. So ty till now, please stay in touch this was not the end. I will mark this question as answered at the end, promissed!

  • Do you install Z-Stack successfully now?
  • Hi,

    yeah I installed the z-Stack and read and read the documentation (still doing).
    Now Iam facing another problem (and goolge dont helps me out).
    On the soc is a custom programm from another student. I need to read it and save it into a .hex but if i try with flashprogrammer (the last point read flash into hex-file) an error occurs: CC2531 - ID0255: Could not write to HEX file
    Do i need to do something before?

    EDIT:

    And Iam facing the next problem:

    Like i read i opend the ZNP-Project in the IAR and simpley pressed "Make". I expected to get a hexfile but instead i got 81 errors like this:

    [Og007]: Assembler list file generation not allowed in this version of the compiler
    Error while running C/C++ Compiler
    AF.c  

    How can i fix this? => Fixed: rightclick on cc2531 => options => List => uncheck "output assember file"

    But now it seems i have a licence problem, cause there where to much lines of code ("Fatal Error[e89]: Too much object code produced (more than 0x4000 bytes) for this package ")

    So while im fixing this please tell me how to store the current program from soc to a hex? Ty

  • Hi Miles,

    If you do not have a current IAR license then you will not be able to build the project. Meanwhile the default CC2531 ZNP hex files are provided in Z-Stack 3.0.1\Projects\zstack\ZNP\CC253x\dev and should be programmed using SmartRF Flash Programmer.

    Regards,
    Ryan
  • Since you are new to Z-Stack ZNP, I suggest you to follow steps in sunmaysky.blogspot.tw/.../use-ztool-z-stack-30-znp-to-set-up.html to do some tests on PC using ZTool first.
  • Hi,

    ty for your patience.

    I spended allmost the hole night with reading and thinking. At the end i think Z-Stack or better the ZNP is not what fits my needs. I don't need a network with coordinator and routers. Described with my nooby words I just need two end-decives broadcasting on the same channel and receiving all broadcasted packets. The packet (a beacon, correct?) needs to hold the 64-bit-mac-adress (afAddr64Bit) and the data (String-Input from the android-app).

    First i thougt, fine, i can do a workaround. But its not that easy, cause the Z-Stack needs a coordinator and it is not self-configuring, is it?

    So maybe their is a better firmware for my needs:

    - providing an interface that is somehow(?) able to communicate over the usb-port with an top-level-application

    - broadcasting and receiving beacons without an established network

    My mayor quest is not to write this but writing an android-driver that interacts with the dongle. Thats why i need some suggestion witch existing firmware can provide this. Any suggestions? How would you start with this?

  • Do you consider to use BLE instead of Zigbee?
  • Using BLE is not allowed by the prof...

    Question: where can I set the vendor and the product id of the usb/com/? in the znp-project (using Z-Tool would be best).
    For beeing compliant to android it needs to be a specific.
  • You can revise vendor and the product id in deviceDesc: of usb_cdc_descriptor.s51

    deviceDesc: ; Device descriptor
    DB deviceDescEnd - deviceDesc
    DB DESC_TYPE_DEVICE ; bDescriptorType
    DB 00H, 02H ; bcdUSB
    DB CDC_DEVICE ; bDeviceClass
    DB 00H ; bDeviceSubClass
    DB 00H ; bDeviceProtocol
    DB EP0_PACKET_SIZE
    DB 51H, 04H ; idVendor Texas Instruments
    #if (chip==2531)
    DB 0A8H, 16H ; idProduct CC2531
    #elif (chip==2511)
    DB 0A4H, 16H ; idProduct CC2511
    #else
    DB 0A6H, 16H ; idProduct CC1111
    #endif
    DB 09H, 00H ; bcdDevice
    DB 01H ; iManufacturer
    DB 02H ; iProduct
    DB 03H ; iSerialNumber
    DB 01H ; bNumConfigurations
  • Hey,

    last days i spended with understandig the znp-code and android - ubsManager.

    So to take you with me let me resume:
    On Android-Side i will try to use developer.android.com/.../host , and there is a method

    int bulkTransfer (UsbEndpoint endpoint,
    byte[] buffer,
    int length,
    int timeout)
    => "Performs a bulk transaction on the given endpoint. The direction of the transfer is determined by the direction of the endpoint. "

    On ZNP-Side followed your hint sunmaysky.blogspot.de/.../use-ztool-z-stack-30-znp-to-set-up.html and followed the way of the commands through z-stack. It took a while to understand, that bei osal_nv_write needs to be recalculated from hex (so type 135 to get 87).).

    Now my new questions:
    1.
    How can i match this? Which endpoint(s) do i need to acces, what can be in the byte[] buffer? Where is the part of code inside znp /z-stack-components, that matches this?

    2.
    Z-Tool: Its nice to have a network with the two dongles, but how can i make use of it? I dont get how for example transfering more content than a ping from one device to the other, how to put data in and read them out (what is the only sence for usage?). How is the thought of use? Please give me a hint.

    Ty!
  • 1. This is out of scope of this E2E forum. For Android question, I suggest you to post it on other forum like StackOverFlow.
    2. If you mean to transmit message, you should use MT/ZNP API AF_DATA_REQUEST which you can refer to Z-Stack Monitor and Test API.pdf in Z-Stack document folder.
  • Hey,
    i made a big step:
    after following the way of data i wrote a java-application that can communicate with znp!
    I can turn led on and of, loopback and get the device-info. (=> length, cmd0, cmd1, sop, message-body, fcs)

    Now i want to build all steps nessecary to sent a tm_dataRequest.
    But I have duifficulties with setting up the right message-body. If the value in znp is casted to a uint16 and other way around it seems there is a converting nessecary.

    First lets look at the this way (App TX) => (RX ZNP) (example: nv-osal-write, set the build-type to coordinator)

    name: ....sop ..len. cmd0 cmd1 id(.... 2 ....) offset dataLen value .fcs
    (App TX: 0xfe 0x05 .0x01. 0x09..0x08 0x07. 0x00 ...0x01 ...0x00 0x03) =>
    (RX ZNP: Header: Länge: 1 | cmd0: 97 | cmd1: 9 | status: INVALIDPARAMETER)

    0x0087 = 0d135 = 0b1000 0111 => 0b1000 = 0d8; 0b0111 = 0d7

    should be (from your given example):
    COM1 SYS_OSAL_NV_WRITE (0x2109) --> Write ZCD_NV_LOGICAL_TYPE to 0 which means coordinator
    Id: 0x0087
    Offset: 0x00
    Len: 0x01
    Value: . (0x00)

    => COM1 SYS_OSAL_NV_WRITE_SRSP (0x6109)
    Status: SUCCESS (0x0)

    In Z-Tool i get the correct response (0x00 Success), but in my app i get (0x02 invalid parameter). This exception is thrown by
    if ((dataOfs + dataLen) <= nvItemLen) else rtrn = ZInvalidParameter;
    caused by invalid offset or dataLen, or (i guess, i dont understand the part of reading flash-pages) the item is wrong (cause if i type a wrong id in Z-Tool i also get this response).


    Now lets look at the way (ZNP TX:) => (RX App) (example: the long address (ip64) in getDeviceInfo)

    Following the code the anwer (byte[] should look like this:
    header message
    ([sop] [len|type|cmd1] [status| ip64|ip64|ip64|ip64| ip64|ip64|ip64|ip64 |ip16|ip16|....] [FCS]]

    In Z-Tool the answer is:
    COM11 UTIL_GET_DEVICE_INFO_RESPONSE (0x6700)
    Status: SUCCESS (0x0)
    IEEEAddr: 0x00 12 4B 00 01 5A 61 8E

    In my app i get:
    Header: Länge: 32 | cmd0: 103 | cmd1: 1
    status: NO_TIMER_AVAIL
    message: 8 8e 61 5a 01 00 4b 12 00 00 00 00 00 ff ff ff 66 74 6b a7 ad 3a 3d f3 d1 65 1c b 4a 27 b6 9a 39
    Ip-64 : 8e 61 5a 01 00 4b 12 00

    = > for better compare:
    IEEEAddr: 00 12 4B 00 01 5A 61 8E
    ...._Ip-64  : 8E 61 5A 01 00 4B 12 00

    As you can see they are completly mirrored! Why is this and is this also happening in the first situation?

    I allready tried the following:
    name: sop len cmd0 cmd1 !!!id(SWAPPED!)!!! offset dataLen value fcs
    (App TX: 0xfe 0x05 0x01 0x09 0x07 0x08 0x00 0x01 0x00 0x03) =>
    (RX ZNP: Header: Länge: 1 | cmd0: 97 | cmd1: 9 | status: INVALIDPARAMETER)

    so this simple it isnt (damn^^).

    I really dived deep in to it. Please unscramble the way of interpreting the byte-sequence.
    TY

  • This sounds like your application doesn't send correct ZNP command to CC2531. I suggest you to setup scope to check the signal and debug it.
  • Hey,
    allright, i made progress again. I implemented a own tmProcessCommand-Method, witch switches depending on command 2 (cmd1). Iam able to send and read my custom header. Now i want to automate the example you gave me.
    The thing is i only have one cc2531, another student has another. When we tested it once we didnt really know what happens and thought all is fine... ...but it wasn't. This is the problem:

    Taking your example: sunmaysky.blogspot.com/.../use-ztool-z-stack-30-znp-to-set-up.html

    and using Z-Tool, on the hex from the original project, to doing exactly every step like in the example

    till step 10:38:45.58 COM1 APP_CNF_BDB_START_COMMISSIONING
    ..............CommissioningMode: (0x04) Network Formation (0x4)

    everything is fine, but this command ends in another Commissioning Mode

    Answer in example:
    10:38:49.49 COM1 ZDO_STATE_CHANGE_IND (0x45C0)
    ......State: 9 (0x9)
    10:38:49.49 COM1 APP_CNF_BDB_COMMISSIONING_NOTIFICATION (0x4F80)
    ......Status: 0x00 (Success) (0x0)
    ......Commissioning Mode: 69 (0x45)

    Answer from Z-Tool:
    04:07:25.4 COM15 ZDO_STATE_CHANGE_IND (0x45C0)
    ......State: 9 (0x9)
    04:07:25.4 COM15 APP_CNF_BDB_COMMISSIONING_NOTIFICATION (0x4F80)
    ......Status: 0x00 (Success) (0x0)
    ......Commissioning Mode: 0 (0x0)

    Everything else is exactly in the example except one thing:
    There is no connection, the purple responses are not shown.

    How can i fix this (to get mode 69)? I cant find a definition for mode 0x45 in the code. I need this connection to work^^

  • If you send UTIL_GET_DEVICE_INFO (0x2700), what do you see?
  • Start Time: 31.05.2018 17:27:04

    <TX>05:27:27.09 COM15 SYS_OSAL_NV_WRITE (0x2109)
        Id: 0x0003
        Offset: 0x00
        Len: 0x01
        Value: . (0x03)

    <RX>05:27:27.09 COM15 SYS_OSAL_NV_WRITE_SRSP (0x6109)
        Status: SUCCESS (0x0)

    <TX>05:28:10.89 COM15 SYS_RESET (0x4100)
        Type: 0x00 (HARD RESET) (0x0)
    Since hard-reset is not covered by the usb-connection (i read it), i need to plug the dongle out and in and restart Z-Tool. Thatswhy i don't get a reset-response. But using soft-reset leads to the same issue.
    Start Time: 31.05.2018 17:29:40

    <TX>05:29:57.46 COM15 UTIL_GET_DEVICE_INFO (0x2700)

    <RX>05:29:57.47 COM15 UTIL_GET_DEVICE_INFO_RESPONSE (0x6700)
        Status: SUCCESS (0x0)
        IEEEAddr: 0x00124B001201386A
        ShortAddress: 0xFFFE
        DeviceType: COORDINATOR, ROUTER, END_DEVICE (0x7)
        DeviceState: DEV_HOLD (0x0)
        NumAssocDevices: 0x00
        AssocDevicesList

    <TX>05:30:27.98 COM15 SYS_OSAL_NV_WRITE (0x2109)
        Id: 0x0087
        Offset: 0x00
        Len: 0x01
        Value: . (0x00)

    <RX>05:30:27.99 COM15 SYS_OSAL_NV_WRITE_SRSP (0x6109)
        Status: SUCCESS (0x0)

    <TX>05:31:05.81 COM15 APP_CNF_BDB_SET_CHANNEL (0x2F08)
        isPrimary: TRUE (0x1)
        Channel: CHNL_0x00002000 (0x2000)

    <RX>05:31:05.82 COM15 APP_CNF_BDB_SET_CHANNEL_SRSP (0x6F08)
        Status: SUCCESS (0x0)

    <TX>05:31:19.81 COM15 APP_CNF_BDB_SET_CHANNEL (0x2F08)
        isPrimary: FALSE (0x0)
        Channel: NONE (0x0)

    <RX>05:31:19.81 COM15 APP_CNF_BDB_SET_CHANNEL_SRSP (0x6F08)
        Status: SUCCESS (0x0)

    <TX>05:32:01.83 COM15 APP_CNF_BDB_START_COMMISSIONING (0x2F05)
        CommissioningMode: (0x04) Network Formation (0x4)

    <RX>05:32:04.37 COM15 APP_CNF_BDB_START_COMMISSIONING_SRSP (0x6F05)
        Status: SUCCESS (0x0)

    <RX>05:32:04.38 COM15 ZDO_STATE_CHANGE_IND (0x45C0)
        State: 8 (0x8)

    <RX>05:32:04.38 COM15 APP_CNF_BDB_COMMISSIONING_NOTIFICATION (0x4F80)
        Status: 1 (0x1)
        Commissioning Mode: 0x02 (Formation) (0x2)
        Commissioning Mode: 0x04 (Network Formation) (0x4)

    <RX>05:32:04.64 COM15 ZDO_STATE_CHANGE_IND (0x45C0)
        State: 8 (0x8)

    <RX>05:32:04.91 COM15 ZDO_STATE_CHANGE_IND (0x45C0)
        State: 8 (0x8)

    <RX>05:32:05.17 COM15 ZDO_STATE_CHANGE_IND (0x45C0)
        State: 8 (0x8)

    <RX>05:32:05.44 COM15 ZDO_STATE_CHANGE_IND (0x45C0)
        State: 8 (0x8)

    <RX>05:32:05.7 COM15 ZDO_STATE_CHANGE_IND (0x45C0)
        State: 8 (0x8)

    <RX>05:32:06.28 COM15 ZDO_STATE_CHANGE_IND (0x45C0)
        State: 9 (0x9)

    <RX>05:32:06.28 COM15 APP_CNF_BDB_COMMISSIONING_NOTIFICATION (0x4F80)
        Status: 0x00 (Success) (0x0)
        Commissioning Mode: 0x02 (Formation) (0x2)
        Commissioning Mode: 0 (0x0)

    <TX>05:32:15.35 COM15 UTIL_GET_DEVICE_INFO (0x2700)

    <RX>05:32:15.36 COM15 UTIL_GET_DEVICE_INFO_RESPONSE (0x6700)
        Status: SUCCESS (0x0)
        IEEEAddr: 0x00124B001201386A
        ShortAddress: 0x0000
        DeviceType: COORDINATOR, ROUTER, END_DEVICE (0x7)
        DeviceState: DEV_ZB_COORD (0x9)
        NumAssocDevices: 0x00
        AssocDevicesList

    <TX>05:33:32.15 COM15 SYS_OSAL_NV_WRITE (0x2109)
        Id: 0x008F
        Offset: 0x00
        Len: 0x01
        Value: . (0x01)

    <RX>05:33:32.18 COM15 SYS_OSAL_NV_WRITE_SRSP (0x6109)
        Status: SUCCESS (0x0)

    <TX>05:34:33.59 COM15 APP_CNF_BDB_START_COMMISSIONING (0x2F05)
        CommissioningMode: (0x02) Network Steering (0x2)

    <RX>05:34:33.6 COM15 APP_CNF_BDB_START_COMMISSIONING_SRSP (0x6F05)
        Status: SUCCESS (0x0)

    <RX>05:34:33.61 COM15 ZDO_MGMT_PERMIT_JOIN_RSP (0x45B6)
        SrcAddr: 0x0000
        Status: ZDP_SUCCESS (0x0)

    <RX>05:34:33.61 COM15 APP_CNF_BDB_COMMISSIONING_NOTIFICATION (0x4F80)
        Status: 0x00 (Success) (0x0)
        Commissioning Mode: 0x01 (Network Steering) (0x1)
        Commissioning Mode: 0 (0x0)

    <TX>05:34:45.15 COM15 UTIL_GET_DEVICE_INFO (0x2700)

    <RX>05:34:45.16 COM15 UTIL_GET_DEVICE_INFO_RESPONSE (0x6700)
        Status: SUCCESS (0x0)
        IEEEAddr: 0x00124B001201386A
        ShortAddress: 0x0000
        DeviceType: COORDINATOR, ROUTER, END_DEVICE (0x7)
        DeviceState: DEV_ZB_COORD (0x9)
        NumAssocDevices: 0x00
        AssocDevicesList

    <TX>05:34:48 COM15 UTIL_GET_NV_INFO (0x2701)

    <RX>05:34:48.07 COM15 UTIL_GET_NV_INFO_RESPONSE (0x6701)
        Status: 8 (0x8)
        IEEEAddress: 0x00124B001201386A
        ScanChannels: NONE (0x0)
        PanID: 0x0000
        SecurityLevel: 0x20
        PreConfigKey: ......U..I...._. (0x00, 0xFF, 0xFF, 0xFF, 0xCD, 0xAE, 0x55, 0x9C, 0xFF, 0x49, 0xC2, 0x16, 0xD0, 0xEE, 0x5F, 0x0C)

    ===== EDIT 1

    I found this in util_get_nv_info:

      /* Security level */
        if ( osal_nv_read( ZCD_NV_SECURITY_LEVEL, 0, sizeof( uint8 ), pBuf++ ) )
        {
          stat |= 0x08;
        }

    This makes me believing the security might be a problem?

    ==== EDIT 2

    I debugged it using halLed (so if a block of code is used it turns on).

    This time it stayed off:

     /* Pre-configured security key */
        if ( osal_nv_read( ZCD_NV_PRECFGKEY, 0, SEC_KEY_LEN, pBuf ) )
        {
          stat |= 0x10;
          HalLedSet (0x01, 0x01);
        }

    Can this be a problem? How can i fix this?

  • According to your UTIL_GET_DEVICE_INFO_RESPONSE , your coordinator starts and forms Zigbee network correctly. What’s your problem about this?

  • The problem is that we tried to connect two dongles yesterday for 2 hours, but it didn't work. We didn't receive the (purple) ZDO-messages after commanding the router to network-steering (0x02). The acceror-lists stayed empty. So something must be wrong.

    And in the log this two answers are different (the last line) than in the example you provided:
    <RX>05:32:06.28 COM15 APP_CNF_BDB_COMMISSIONING_NOTIFICATION (0x4F80)
    ... Status: 0x00 (Success) (0x0)
    ... Commissioning Mode: 0x02 (Formation) (0x2)
    ... Commissioning Mode: 0 (0x0)

    <RX>05:34:33.61 COM15 APP_CNF_BDB_COMMISSIONING_NOTIFICATION (0x4F80)
    ... Status: 0x00 (Success) (0x0)
    ... Commissioning Mode: 0x01 (Network Steering) (0x1)
    ... Commissioning Mode: 0 (0x0)

    What is this second Commissioning Mode: 0 (0x0) line meening?
  • Commissioning Mode: 0 (0x0) means BDB_COMMISSIONING_MODE_IDDLE
  • Oh, iddle, ty.

    Idle will not start a network correct? So i will need to change this... please help me, it is really confusing

    Are these modes documented somewhere?

    =>

    #define BDB_COMMISSIONING_MODE_IDDLE                0      // No pending commissioning procedures
    #define BDB_COMMISSIONING_MODE_INITIATOR_TL         (1<<0)  
    #define BDB_COMMISSIONING_MODE_NWK_STEERING         (1<<1)
    #define BDB_COMMISSIONING_MODE_NWK_FORMATION        (1<<2)
    #define BDB_COMMISSIONING_MODE_FINDING_BINDING      (1<<3)
    #define BDB_COMMISSIONING_MODE_INITIALIZATION       (1<<4)
    #define BDB_COMMISSIONING_MODE_PARENT_LOST          (1<<5)

    And whats Commissioning Mode: 69 (0x45) ? =>  01000011 => BDB_COMMISSIONING_MODE_INITIATOR_TL + BDB_COMMISSIONING_MODE_NWK_STEERING + ???

    Why is my mode idle?

    Since this code-block:

    #ifdef BDB_TL_INITIATOR  // not defined in the project, is it? Can't find it.
      if ( touchlinkFNReset == TRUE )
      {
        return;
      }
    #else
      //Commissioning mode used only for initiator
      mode &= ~BDB_COMMISSIONING_MODE_INITIATOR_TL;
    #endif

     is BDB_COMMISSIONING_MODE_INITIATOR_TL = 0.   => DO YOU have a touchlink-device?

    And since i didnt mark network-steering but only network-formation

    is BDB_COMMISSIONING_MODE_NWK_STEERING  = 0 => DO YOU mark both, steering and formation?

    1 I don't understand this one at all!

    How can i change the mode from idle to Commissioning Mode: 69 (0x45)?

    And what is Commissioning Mode: 67 (0x43)?

    How can i change the mode from idle to Commissioning Mode: 67 (0x43)?

    Is the same except that BDB_COMMISSIONING_MODE_NWK_STEERING is 0 two (what completly makes sence!)

    Is it possible to check the commissioning_mode with z-tool?

    Can you check yours before network-formating (after reset)? Please.

  • Idle means bdb start commissioning  process goes to idle and your CC2531 forms coordinator according to your log. For those bdb operations, you can read Z-Stack 3.0 Developer’s Guide.pdf.

  • Hey,

    we did the connection i think, but our MT_AF_DATAREQUEST is not going through:

    this is my coordinator log after starting the router-steering:

    *** WARNING ***
    Unsupported or unformatted message received. Raw data:
    0C 45 CA DE 39 36 3B 01 12 00 4B 12 00 00 00

    <RX>04:35:43.09 COM15 ZDO_END_DEVICE_ANNCE_IND (0x45C1)
    SrcAddr: 0x39DE
    NwkAddr: 0x39DE
    IEEEAddr: 0x00124B0012013B36
    Capabilities: 0x8E

    <TX>04:36:30.9 COM15 UTIL_GET_DEVICE_INFO (0x2700)

    <RX>04:36:30.9 COM15 UTIL_GET_DEVICE_INFO_RESPONSE (0x6700)
    Status: SUCCESS (0x0)
    IEEEAddr: 0x00124B001201386A
    ShortAddress: 0x0000
    DeviceType: COORDINATOR, ROUTER, END_DEVICE (0x7)
    DeviceState: DEV_ZB_COORD (0x9)
    NumAssocDevices: 0x00
    AssocDevicesList

    So now i want to send a AF_Data_Request via Z-Tool, but it dont works.
    this is my router-log after running the command:

    <TX>04:37:32.04 COM13 AF_DATA_REQUEST (0x2401)
    DstAddr: 0x0000
    DestEndpoint: 0x00
    SrcEndpoint: 0x00
    ClusterID: 0x0000
    TransID: 0x00
    Options: 0x00
    Radius: 0x0A
    Len: 0x0A
    Data: .......... (0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00)

    <RX>04:37:32.04 COM13 AF_DATA_REQUEST_SRSP (0x6401)
    Status: afStatus_SUCCESS (0x0)

    <RX>04:37:32.09 COM13 ZB_FIND_DEVICE_CONFIRM (0x4685)
    SearchType: 0x01
    SearchKey: 0x3300
    Result: 0x800000001E1AFF00

    But the log of the Coordinator doesn't change (as i followed the code at least a ToolResponse is what i expect?).

    How do i need to modify the values to reach the znp-event-loop (or which way is the best back to uart?)?
  • DestEndpoint and SrcEndpoint cannot be 0. They should map to your application endpoint.
  • Ah ok, but is  there a way to force an interaction between the two dongles with the z-tool? So that i can see, they really are connected. (Sending some command and receiving a message on the other side? For example a ping).

    So in my app i will need to create e epDesc and register it to zdo, correct? Whats the smartest way to create the epDesc, it seems really complicated?

  • Hi,

    i made some progress:

    - i added a hole application "lifecycle": init(), afregister(), eventloop() and callbacks
    - i "automated" the processes of becoming a coordinator or router from 0 to steering in one command
    - i added a custom sendMessage witch wrapps the uart-input in a broadcastmessage and sends it via afDataRequest()
    - on the other side the afIncomingData() is directed to my eventloop via the taskId stored in the endpointDescriptor
    - at the moment i redirect it to MT_AfIncomingMsg() but i will write a custom way to uart cause i dont need a lot of the parameters

    => and it works! At the moment with my java-app, android is only two steps ahead!

    My problem: my IAR-Licence is expirening in 2 days, till than the .hex must be finished!

    My question for now:

    1. I get confused with the NV-Restore. Is there a way to disable it for every start (so saving the osal_nv_write(03, 00, 01, 03) and reset)?
    For my purposes it would be better.

    Ty.
  • You can remove NV_RESTORE from Z-Stack examples predefined symbols and rebuild it to disable NV_RESTORE.
  • Hey,
    i have a huge problem:

    As you remember at first we wasn't able to create a connection between two dongles with Z-Tool. And than we made it. But there both dongles where connected to the same pc. So based on this all was fine and i was able to create a connection between two java-applications (on same pc!) and exchange messages.
    Since this we are trying to create a connections with our android-app (so on two devices!) but never worked.

    SO TODAY we tested (why not earlier i know) to connect two different pcs. With Z-Tool and original firmware as well with our own code we can't connect the router to the coordinator. They don't reach each other! This is so bad, next week we have the presentation.

    The strange is that with Led-test there definitly the AF_DataRequest and AF_IncomingData are called and all networkinformations really say "hey this is a zigbee coordinator-router-connection" and if we choose different channels, it don't work. The shor IP is correct. All if both dongles where connected to the same pc. On different pcs the Router-Steering allways ends with "No Network".

    Do you have an idea what to do how to test or anything? Please help me
  • Try to erase your CC2531 and download ZNP to test again.
  • What the hack! After flashing the dongle (with erase flash verify) with an new downloaded .hex and than flashing our own .hex again it worked.... sorry for the heat...

    So than i share my newest finding:
    github.com/.../usb-serial-for-android is a project providing communication between cc2531 and an Android-Device. In a few days i will attach a document with a summary.
  • So, thats it! Thank you again.
    I edited the original question to make it easier to find the solution.
    RESOLVED ;-)