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.

How to check for CC2430DB

Other Parts Discussed in Thread: CC2430, CC2420

Hi,

I'd like to check which board is connected before running a piece of code.  What is the proper #ifdef for the CC2430DB?

I tried the following:

#ifdef CC2430DB

#ifdef CC2430

#ifdef ASSY_EXP4618_CC2430DB

#ifdef ASSY_EXP4618_CC2430

 

None of these seem to work, as when I run it on  the CC2430DB it skips over this section.   Any help here?  Thanks!

  • Hi Benjamin,

    If you are working with a version of ZStack-CC2430 (for example, 1.4.3), the first #ifdef that you tried should work. One place you can see this symbol (and CC2430EB) in use is in the OnBoard.c file. These symbols are located in the C/C++ Compiler->Preprocessor defined symbols of the IAR project files. Another symbol that you can use to identify the board (HAL_BOARD_CC2430DB) can be found in the hal_board_cfg.h file.

    If you are working with a version of ZStack-EXP461x (for example, 1.4.3), you won't be able to use the CC2430 -- that platform is used with CC2420 transcievers. I am confused by your last 2 symbols, since they are combining EXP4618 and CC2430. Can you identify where those symbols came from?

  • Hi, there is no 100 % automatic way to check what board you are going to run your code on when you compile the source code. I guess that for code examples where you have seen these «ifdefs» in the source code they (or at least one of them) have already been pre-defined in the IAR project settings. Have a look in Project->Options... -> Compiler options -> Preprocessor. There you can e.g. type in "CC2430DB" so that will be a defined label, and then you can use e.g. «#ifdef CC2430DB [... code for CC2430DB that will be included ... ] #elif [ ... code for another target which will be excluded ... ] #endif» and have conditions for various targets. So the symbol names used in your source code and the one defined in the preprocessor definitions must match, otherwise the #ifdefs will always fail (be false).
  • Thanks for the reply xyzzy.

    The last two symbols came from the provided app called light_switch.c (they were defined as #ifdef ASSY_EXP4618_CC2420 and I just changed it to CC2430, since I was just grasping at straws at that point, and frustrated that it wouldn't work).

    I will try those symbols you suggested since you think they should work.  This seems to just be a simple fix.

    Thanks again.

  • Hi Aevin,

    Thanks for the reply.  I see the section where the precoprocessor has it's defined symbols, but where exactly do I type in "CC2430DB" so that it will be a defined label?  It seems that the only place to type in is the "Preinclude file" field, but that's not correct.  Thanks for your help on this.