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.

CC2530 OAD questiions

Other Parts Discussed in Thread: CC2530, Z-STACK

Hi,

I have read almost all the threads about OAD/OTA and CC2530 and I have some doubts about this topic.

I am working with ZStack-CC2530-2.5.0 and SmartRF05 V1.8.1 boards and using the SWRA257(V1.3) document I have run the OAD/OTA functionality to update the firmware of a ZigBee Router. (Time for .bin transmission 7-8minutes; Time for restart or update flash 2-3 minutes)

 

My doubts are:

-          Is there any way or configuration to speed up the transmission? How?

-          To update the firmware is always needed the PC (ZOAD.exe) and the Dongle or is there any other update options? -I mean, can I send the new firmware to a ZigBee Router using the PC and Dongle and after, this router be the one who resends the new firmware to other routers in the network to update the rest of the devices in the network? Any example, documentation or recommendations?

 

Thanks in advance for you help.

  • Hi once again,

     

    Topic 1: SPEED UP OAD TRANSMISION TIME

     

    In relation to speed up the transmission, I have tried to send more blocks in the same packet. By default we have:

    #define  ZL_DATA_BLK_SIZE       8

    #define  ZL_NUM_DATA_BLKS   4

    So 32 Bytes are sent in each zigbee packet. I have recompiled Dongle and my GenericApp with a ZL_NUM_DATA_BLKS value of 6 trying to send 48 Bytes per packet but it doesn’t work because the Commissioner (ZOAD.exe) is still sending 4 blocks per packet.

     

    Is there any possibility to configure the number of blocks per packet? How?

     

    I also have seen that from 245760 Bytes of my .bin file, the 45% of those bytes are 0xFF, useless bytes that are sent over the increasing transmission time considerably.

     

    Is there any possibility to avoid the transmission of those bytes over the air to reduce the transmission time?

     

    Topic 2: PROPIETARY COMMSSIONER (ZOAD.EXE)

     

    Is it possible to develop a proprietary commissioner or to integrate the commissioner capability to a proprietary application? -In the same folder where is placed the ZOAD.exe are some .dll, is there any documentation to use them or to develop an application that integrates commissioner capabilities into a proprietary application? Any help?

  • You can make the image smaller by removing the "code fill" by reducing the size of the available flash space in the linker file. You will also need to change the address range of the CRC calculation in the linker file as well as in the OAD application .c code. I recommend that you still use a multiple of a complete flash page and not try to shave off even more.

    The proprietary OAD is a client server architecture specifically designed with the idea of this faster peer-to-peer OAD transfer in mind. For simplicity, imagine a linear network in which ZC 0x0000 has ZR 0x0001 and ZR 0x0002 is even out of radio range of the ZC. The ZOAD dongle is next to ZC, and makes the OAD of a router image to 0x0001. Once all is finished, the ZR 0x0001 can be given the command to enable that code or not. Whether or not the code is to be used by 0x0001, ZR 0x0001 can now be a server of this code image. You will issue the Client Command to 0x0002, telling it to go fetch the image from ZR 0x0001. Look in the OAD code for how this is used:

    //   CLIENT COMMAND
    //       Command
    PACK_1
    typedef struct  {
      uint16 zlclC_ver;
      uint16 zlclC_manu;
      uint16 zlclC_prod;
      uint8  zlclC_IEEE[Z_EXTADDR_LEN];
      uint16 zlclC_nwk;
      uint8  zlclC_endp;
    } zlclientC_t;

    I will look around and try to find a Z-Tool script that issues the client command via the ZOAD dongle. But the info above can give you a great start for now.

     

  • Thanks for your response and for your help.

     

    In relation to the generation of a smaller image I have tried:

    -       Remove ‘code fill’ [-HFFFF] from oad.xcl file, but the result is the a fatal error:

    Fatal Error[e30]: Option -J also requires the -H option

    Note: It seems I need to remove also the CRC calculation to solve the error.

     

    So I have tried to generate a smaller image, but maintaining the code fill (I don’t know how to remove it properlyand I don’t want to remove CRC calculation), by defining a smaller flash space using a multiple of a complete flash page. I have reduced the flash space from 240Kbyte to 190Kbyte.

     

    Changes in oad.xcl

    // Uncomment when implementing OAD NV by external E2PROM AND external flash is 256 KB or bigger.

    // (e.g. when using SmartRF05 Rev. 1.7 or later.)

    -P(CODE)BANKED_CODE=_CODE_START-_CODE_END,0x18000-0x1FFFF,0x28000-0x2FFFF,0x38000-0x3FFFF,\

    0x48000-0x4FFFF,0x58000-0x5FFFF

     

    I have removed bank 6 and 7 from the flash space. And I have also modified CRC calculation space:

    -J2,crc16,=800-887,88C-5FFFF

     

    With this new changes in oad.xcl the new *.bin file is 190Kbyte. But when I re-flash the ZR with the new .hex (Boot+App, both with new changes recompiled) the programs doesn’t start up. It seems that at boot time something goes wrong.

     

    Surely I am ignoring some important point. Could you help me with the right configuration or changes to get a smaller image that works?

  • And what is one big thing that can happen at boot time to make the program not start up? Exactly, if the boot loader cannot validate the CRC, and it is precisely the range of the CRC calculation that has just been mucked with. So you have to track down everywhere else that you must make a corresponding change to the CRC range.

    Note where IAR calculates the CRC in the linker control file, oad.xcl:

    // Skip boot code, CRC/shadow & NV pages when calculating the CRC.
    //
    -J2,crc16,=800-887,88C-7C7FF

    So that above range would need to be shortened.

    And how about where the boot loader calculates the CRC in crcCalc() in hal_oad.c:


      // Run the CRC calculation over the active body of code.
      for (oset = 0; oset < preamble.len; oset++)

    So, the 'len' in the image preamble would need to be shortened accordingly.

     

  • Thanks for your answer and help.

    This week I have been busy testing other features of the CC2530 kit so next week I will take up OAD issue and whatever I get I will post it here.

  • Hi,

    I followed "Over Air Download for CC2530.pdf",but GenericApp.hex I generated is 677K.It's too big that the flash programmer notice that "CC2530 - ID0050: HEX file content at address 0x7C7FF exceeds chip's 256 kB flash size".I'm puzzled,please help me!thank you in advance!

  • Do you add lots code to your GenericApp? Basically, it won't exceed the flash size if you use default GenericApp to do that.

  • No,I just added oad_app.c and so on as the document says.I also have removed zstack and install a new on,but the result is the same.I used ZStack-CC2530-2.5.0

  • I would suggest you to check every steps that describe in section 11. Producing OAD Application Code with Boot Code to be programmed of Over Air Download for CC2530.pdf. I am also using ZStack 2.5.0 and do not have this problem.

  • In section 10.4.2 "Define Proprietary Preamble Fields"in the document,I don't know what to,so I did nothing here.Maybe the problem is here,do you know how to change here?

  • It absolutely nothing to do with Proprietary Preamble Fields. You can either change it or not.

  • I did these steps:

    1   Allow C-SPY-specific extra output file

    2  Generate extra out file

    3  “Override default” command string:

    $PROJ_DIR$\..\..\..\Tools\CC2530DB\oad.xcl

    4  Use the following line for the “Post-build command line:”

    "$PROJ_DIR$\..\..\..\Tools\CC2530DB\oad.exe" "$PROJ_DIR$\RouterEB\Exe\GenericApp.sim" "$PROJ_DIR$\RouterEB\Exe\GenericApp.bin"

    5  MAKE_CRC_SHDW

    and after that,files and code I added are exactly the same as the document says,then GenericApp.hex is 676KB

    In project->options->general options->target the code model is "Banked", data model is "Large"

    I did removed(not \\) the comments from the –M option in oad.xcl,by the way, what's the size of your hex code?

  • Do you do the following steps in section 11.2:

    11.2  Pre-pend the Boot Code hex image to the Application Code hex image.
    1) Use any text editor to open the Application Code file produced here:
    $PROJ_DIR$\RouterEB\Exe\GenericApp.hex
    2) Delete this first line from the file:
    :020000040000FA
    3) Use any text editor to open the Boot Code file produced here:
    $PROJ_DIR$\OAD-Boot\Exe\Boot.hex
    4) Delete these last two lines from the file:
    :040000050000079E52
    :00000001FF
    5) Copy the edited contents ofthe Boot Code file to the top of the Application Code
    file and save it.
    6) Use the SmartRF Programmer to install the edited Application Code hex image
    into the CC2530 SoC.

  • I did all but 6) Use the SmartRF Programmer to install the edited Application Code hex image into the CC2530 SoC.Because the hex file is too large.

  • After I did 11.2 Pre-pend the Boot Code hex image to the Application Code hex image.The flash programmer says "CC2530 - ID0050: HEX file content at address 0x7C7FF exceeds chip's 256 kB flash size" ,and I have tried to download hex file of bigger size(about 700K)and succeed,I know that my problem is not the size.

  • After checking, it seems that OAD has been obsolete. I would suggest you to follow the steps in Z-Stack OTA Upgrade User's Guide.pdf not Over Air Download for CC2530.pdf.

  • Thanks! I will try.

  • Hi,

         I have realized  oad without an external flash.And I have changed some code in oad_app.c. Now it takes 4min to download the code.I let the client request the dongle for code only one time,and then the dongle transmit the code continuously, with 64 bytes each time ( zoad.exe transmit 32bytes each time).After transimitting a packet,the dongle request the zoad for code immediately,and then enter   zlZArchitectProxyMsg   again.How can I speed up again?

  • Hi zhichao fu!

    I had the same problem when trying to implement OTA (not OAD) and I had to do the following:

    1) Uncomment this two lines (near line 163) in both "ota.xcl" and "ota-boot.xcl":

    // Uncomment when implementing OAD NV by dividing internal flash in half.
    //-P(CODE)BANKED_CODE=0x0800-0x7FFF,0x18000-0x1FFFF,0x28000-0x2FFFF,0x38000-0x3E7FF
    // Uncomment when implementing OAD NV by external E2PROM AND external flash is 256 KB or bigger.
    // (e.g. when using SmartRF05 Rev. 1.7 or later.)
    -P(CODE)BANKED_CODE=0x0800-0x7FFF,0x18000-0x1FFFF,0x28000-0x2FFFF,0x38000-0x3FFFF,0x48000-0x4FFFF,\
    0x58000-0x5FFFF,0x68000-0x6FFFF,0x78000-0x7C7FF

    2)  After the following part (near line 63)  in "ota-boot.xcl":

    //
    // CODE
    //
    -D_CODE_START=0x0000
    -D_CODE_END=0x07FF

    add the following line:

    -D_FIRST_BANK_ADDR=0x10000

    With those changes recompile both .hex files and merge them with the instructions given in previous steps. This way I could eliminate the size error in SmartRF and application seems to be running ok (need more testing). I'm running into other problems with OTA but that's for another thread.

    Let me know if it worked for you.

  • Hi Francisco Manno,

      Thanks for helping me,I will try later and notice you the result.

     

  • hi,

        I have tried your method recently,but it does not work.   Error[e104]: Failed to fit all segments into specified ranges. Problem discovered in segment BANKED_CODE. Unable to place 68 block(s) (0x1ce0f byte(s) total) in 0x1b9b7 byte(s) of memory.  The problem occurred while processing the segment placement command "-P(CODE)BANKED_CODE=0x0800-0x7FFF,0x18000-0x1FFFF,0x28000-0x2FFFF,0x38000-0x3E7FF", where at the  moment of placement the available memory ranges were "CODE:2c20-7fff,CODE:18229-1ffff,CODE:28000-2ffff,CODE:38000-3e7ff" .

    I want to use on_chip flash,and in oad,your method is ok.

  • Hi zhichao fu!,

    Can you please provide me steps to use internal flash instead of external (by default it use external flash).

    I need to use internal flash which is spare from 256KB total.

    Thanks

    JIgnesh