Need help in programming CC2431 with Z-Stack with IAR 7.30B

Discussion in 'Embedded Systems and Microcontrollers' started by laguna82alan, Jun 13, 2008.

  1. laguna82alan

    Thread Starter New Member

    Jun 13, 2008
    4
    0
    Hi guys,

    I'm working on a WSN application using CC2431DK. However, there are some issues with it. There are a lot of sample codes with Z-Stack.

    However, I'm not sure of how to start it with the IAR Compiler.

    There seems to be no Get Started/Idiot Learning Guide on these TI Z-Stack documentation.

    any help?
     
  2. laguna82alan

    Thread Starter New Member

    Jun 13, 2008
    4
    0
    can anyone help?
     
  3. roddefig

    Active Member

    Apr 29, 2008
    149
    0
    I would recommend talking with TI's tech support. I think your question is a bit too specific for anyone to be of any real help on this forum.

    The TI page for the software mentioned a user guide, have you read that?
     
  4. laguna82alan

    Thread Starter New Member

    Jun 13, 2008
    4
    0
    basically i downloaded all the documents and sample code from the TI webpage. It is really meaningless without a get started guide for all those samples
     
  5. Hamilton

    Member

    Jun 20, 2008
    10
    0
    I have been living this for months and would be more than glad to pass some knowledge your way. While Ti is very open with reference designs and code they do not support a on-line forum and their in house guys are thin and therefore less than responsive.

    I'm guessing at your starting point:

    Step one is to download or load from disk the IAR embedded work bench for the 8051 series. I believe I clicked a box for Ti or chipcon, it has been awhile. There are more (different?) Libraries via download than on the DK disk. You will have fewer "file not found" errors if you put it in the C:\ directory as opposed to the default C:\programs\

    2.) Put your source and include directories in one place. Mine are in a My Documents\Software folder. Move the ioCC2431.h file from the IAR\8051\config\Ti\ subdirectory into your include directory. The magic here is two fold. If you add your files to the project from “your directory” and the IAR files from IAR\subdirectory IAR shouldn’t care but it seems to. When it looks for an existing file it seems to look in the last place it took a file or update from. “file not found” gets old after a few weeks. Second, every time you make a change and re-build it is convenient to have the changes saved, (e.g. main.c, include.h, flash.hex etc.) compiled, link, run. Problem is if these were the only copies of “probably good’ code they are change and there is no going back. In short put you reference material somewhere, (I made mine read only), copy it to “your folder”\include or “your folder”\source as needed. If you corrupt it refer back to the original.

    3.) Load the Ti Smart RF Flash Programmer and drivers. Success is being able to “see” your module when you turn on the SmartRF04 board in the “System on a Chip” tab. IAR uses this board as its interface to your module whether it’s a custom board like mine via a 10 pin interconnect from P14 or a Ti CC2431EM plugged into the SmartRF04. On the SmartRF Flash Programmer in the System on a Chip tab there is a place to enter “Flash Image”, type in the following: C:\yourdirectory\your filename.hex. Click “Read flash into hex file”. This should read the contents of the CC2431’s flash into the file you created. Find this file, rename it, and save it in a safe place should you want it in the future. Trust me this is on the path to getting IAR up.

    Back to IAR:

    1.) Open IAR
    2.) Click Project – Create new project
    3.) Empty project – OK
    4.) Enter ‘project name” – save (extension .ewp) I suggest “yourdirectory” from above
    5.) Project – Add files (*I added ALL of the HAL files etc. after a few weeks I started over)

    6.) In dialog box to left under workspace – files: click once on your file name.
    7.) Project – Options – General information – Target - device – cc2431.i51

    8.) Project – options – linker – output tab –

    8a.) click override default – enter or search for C:\yourdirectory\your filename.hex from above (hex file are flashed to the CC2431, not .exe) IAR stores your executable here. You flash this file to the CC2431 using the Smart RF Flash programmer same as above.

    8b.) Click other – defaults should be intel extended, none and include all
    CSPY is not clicked yet, we’ll get to it.

    9. Project – Options – General information – Target - device – cc2431.i51

    10.) Project – Options – Debugger - Setup - Override default - Then find 8051\config\devices\Texas Instruments\CC2431.ddf

    11.) Project – Options – C/C++ Complier – Optimization – Pull down tab and select none for now

    The Ti libraries support a large number of device types and therefore are complex. In addition includes and source reference are scattered over the 12-15 files. Example: They have LEDGRN_OFF, LED1_OFF, LEDGRN_CLR, LED1_CLR all for the same LED to cover various versions of past code. I used iocc2430.h, my_main.c file, and a file I called definitions.h. That’s it. I pulled in Ti definitions, macros, and functions only once I understood what they did. Harder at first, true. IAR has a great debugger. As you step through the c code you also see the assembly with your comments imbedded. With 15 files much of this is lost since you only see the link name until it returns. You do see the registers change real time and they use the same mnemonics as the Ti spec.

    This will get you started, I 'll watch for questions…
     
    Last edited: Jun 21, 2008
  6. laguna82alan

    Thread Starter New Member

    Jun 13, 2008
    4
    0
    Thanks for replying.
    you might want to go to this forum for more advice on chipcon product esp. on cc2430/cc2431.

    I got one question for you. Do you use Z-Stack 1.4.2? If you do, do you create your own project then slowly add those Z-Stack folder?
     
  7. Hamilton

    Member

    Jun 20, 2008
    10
    0
    Your welcome. I have used Z-Stack code for guidence and have copied some of the code. It is too generallized for me, chasing bugs was a problem, and my application requires very short but high speed bursts and rapid return to sleep to get 12 months all in a 22mm x 22mm x 12mm package including the battery.

    The book "Hands-On ZigBee - Implementing 802.15.4 with Microcontrollers by Fred Eady" was very useful in understanding the waveform. He also shows examples from 13 different chip manufactures.
     
Loading...