CC2531 Dongle Firmware compilation guide

1)  Download and install ZStack. Visit http://focus.ti.com/docs/toolsw/folders/print/z-stack.html and dowload swrc126.zip (59.0MB) - contains ZStack-CC2530-2.4.0-1.4.0.exe.

2)  Install IAR Embedded Workbench 8051 IDE (7.60). This software is licensed, so is needed purchase it.

3)  Execute IAR.Open existing workspace

Select the file:

your installation directory>/Texas Instruments/ZStack-CC2530-2.3.1-1.4.0/Projects/zstack/Samples/GenericApp/CC2530DB/GenericApp.eww

4)  To make the project compatible with the CC2531 USB Dongle, it is necessary follow the next steps(extracted from TI documentation, the complete document is available in the local installation of zstack in Texas Instruments\ZStack-CC2530-2.3.1-1.4.0\Documents\CC2530\Serial Boot Loader for CC253x.pdf):

5)  Creating a CC2531 USB Dongle SBL compatible target

Up to this point, the example that has been used is the CC2530. The following steps should be followed to create a Z-Stack project that is compatible with the CC2531 USB Dongle.

In the C/C++ Pre-processor options for the project, replace:

$PROJ_DIR$\..\..\..\..\..\COMPONENTS\HAL\TARGET\CC2530EB

with:

$PROJ_DIR$\..\..\..\..\..\COMPONENTS\HAL\TARGET\CC2530USB

$PROJ_DIR$\..\..\..\..\..\COMPONENTS\HAL\TARGET\CC2530USB\usb\library\cc2531

$PROJ_DIR$\..\..\..\..\..\COMPONENTS\HAL\TARGET\CC2530USB\usb\class_cdc

$PROJ_DIR$\..\..\..\..\..\COMPONENTS\HAL\TARGET\CC2530USB\usb\library

Add a CC2530USB HAL target group/files and exclude the CC2530EB HAL target group/files as shown. To exclude the CC2530EB HAL target from the build, right click on it, go to Options, and check the “Exclude from Build” checkbox.

After all, you should have a workspace as the following:

It is highly recommended to create a tree structure similar to the proposed in the figure above. The required files can be found in <your installation directory>\Texas Instruments\ZStack-CC2530-2.3.1-1.4.0\Components\hal\include, <your installation directory>\Texas Instruments\ZStack-CC2530-2.3.1-1.4.0\Components\hal\common and <your installation directory>\Texas Instruments\ZStack-CC2530-2.3.1-1.4.0\Components\hal\target\CC2530USB.

6)  Installing the CDC USB Class Drivers for the CC2531 USB Dongle

If this is the first time the CC2531 USB Dongle has been programmed with the appropriate SBL and plugged into the PC, it will attempt to enumerate as a CDC USB Class Device. The user should point windows to the “usb_cdc_driver_cc2531.inf” file available from the .zip file at this URL: http://www.ti.com/litv/zip/swrc088c.

The CC2531 USB Dongle will then expose a USB to Serial Virtual Com Port interface as shown:

7)  Select the preset configuration, in ZB4Osgi is used CoordinatorEB

8)  Select the project options by right-clicking on the project root

9)  Go to C/C++ Compiler and select the tag Preprocessor

The following directives must be present in the textbox Defined symbols(remove the existing and add the following list, one per line):

-  NV_INIT

-  NV_RESTORE

-  OSAL_SAPI=FALSE

-  ZTOOL_P1

-  MT_TASK

-  MT_SYS_FUNC

-  MT_NWK_FUNC

-  MT_NWK_CB_FUNC

-  MT_AF_FUNC

-  MT_AF_CB_FUNC

-  MT_USER_TEST_FUNC

-  MT_ZDO_FUNC

-  MT_ZDO_CB_FUNC

-  MT_ZDO_MGMT

-  MT_SAPI_FUNC

-  MT_SAPI_CB_FUNC

-  MT_UTIL_FUNC

-  MT_APP_FUNC

-  REFLECTOR

-  HOLD_AUTO_START

-  xLCD_SUPPORTED=DEBUG

After this, click OK

10)  To change generic configurations like the channel or the PAN_ID, click on f8wConfig.cfg

The channel of the dongle can be select by commenting the channel set by default and uncommenting the desired one:

The PAN ID is random by default, but it is possible fix it by changing the following code:

11)  Now you can upload the firmware to the device by clicking on the Debug icon

12)  Optionally, if the generation of a .HEX file is needed, it is necessary to follow the next instructions (transcribed from TI documentation, Over Air Download for CC2530DB):

Build the Application Code hex image.

11.1.1 Configure the linker to generate Intel-hex output.

Check the checkbox to “Override default” and make the suffix “.hex” Also check the radio

button for “Other” Output file Format and choose the Output format drop-down selection

for ‘intel-extended’ as shown below.

11.1.2 Configure the linker control file to generate output compatible for the

SmartRF Programmer tool.

Remove the comments from the –M option in oad.xcl as shown in hi-light.

11.1.3 Re-build the Application Code to generate the .hex file.

Having already been built, just pressing the ‘F7’ key and linking will be sufficient

The complete documentation can be found in <your directory of installation of zstack\Texas Instruments\ZStack-CC2530-2.3.1-1.4.0\Documents\CC2530.