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 PWM Settings Part2

Other Parts Discussed in Thread: Z-STACK

Hi Guys.

I working to finish my dimmer device I´m using the (Zigbee Z-Stack Home 1.2.2a.44539 Home Automation / SampleLight) as example.

Mr Y.K. told me, in another post here, to use a Z-Stack Lighting /SampleApp for example to change my code, mainly in PWM setup definitions over hal_board_cfg.h , I made some changes as him advised me. But during those changes I observed, during debugger in my c. file, that part of my code is not reached which is preventing to go a way to finish my hal_board_cfg definitios.

In my C. file has #if (defined HAL_BOARD_ZLIGHT) || (defined HAL_PWM) before important functions necessary to call another files to working PWM as I need.

>>>>> static void zclTTa0003_AdjustLightLevel( void )

#if (defined HAL_BOARD_ZLIGHT) || (defined HAL_PWM) >>>>>>>>>>>> this prevents it from reaching the next level

zclTTa0003_UpdateLampLevel(zclTTa0003_LevelCurrentLevel);

>>>>> void zclTTa0003_UpdateLampLevel( uint8 level )

uint16 gammaCorrectedLevel;

// gamma correct the level

gammaCorrectedLevel = (uint16) ( pow( ( (float)level / LEVEL_MAX ), (float)GAMMA_VALUE ) * (float)LEVEL_MAX);

halTimer1SetChannelDuty(RED_LED, (uint16)(((uint32)gammaCorrectedLevel*PWM_FULL_DUTY_CYCLE)/LEVEL_MAX) );

OBS. All those parameters used above I kept as default value.

I tried to setup  HAL_PWM in a different option on compiler options (HAL_PWM, HAL_PWM=TRUE, HAL_PWM=1) and is not woring.

I tried also to find an specific setup definition that have correlation ship with HAL_PWM in Zstack user guide didnt have a success. 

When I used HAL_PMW in different combination above the IAR compiler appear errors:

Error[e46]: Undefined external "HalTimer1Init::?relay" referred in zcl_TTa0003 ( C:\Texas Instruments\Z-Stack Home 1.2.2a.44539\Projects\zstack\HomeAutomation\
TEHA0003\CC2530DB\RouterEB\Obj\zcl_TTa0003.r51 )
Error[e46]: Undefined external "halTimer1SetChannelDuty::?relay" referred in zcl_TTa0003 ( C:\Texas Instruments\Z-Stack Home 1.2.2a.44539\Projects\zstack\
HomeAutomation\TEHA0003\CC2530DB\RouterEB\Obj\zcl_TTa0003.r51 )

Somebody can help me how to fix this initial issue. Please?

BR

Alex

 

  • Do you include hal_timer.h in your zcl_TTa0003.c?
  • Hi Mr YK,

    Thanks lot for your assistance.

    Yes, I already included hal_timer.h in my code. You can see all those Hal declarations I used below:

    /* HAL */
    #include "hal_lcd.h"
    #include "hal_led.h"
    #include "hal_key.h"
    #include "hal_uart.h"
    #include "hal_board_cfg.h"
    #include "hal_timer.h"
    #include "hal_timer.c"

    BR

    Alex

  • You don’t have to include hal_timer.c but need to add it into your project hal folder.
  • Hi Mr YK,

    I took out the hal_timer. c from my c. file, as you see bellow, and the IAR error remain.

    I dind´t understood you when you said me "...but need to add it into your project hal folder." Please, would you can explain more?

    I have one important doubt, I have to even include HAL_PWM in IAR compiler options?

    bellow, you can see my entries (Includes) in my c file:

    * INCLUDES
    */
    #include "stdio.h"
    #include "string.h"
    #include "ZComDef.h"
    #include "OSAL.h"
    #include "AF.h"
    #include "ZDApp.h"
    #include "ZDObject.h"
    #include "MT_SYS.h"
    #include "nwk_util.h"

    #include "zcl.h"
    #include "zcl_general.h"
    #include "zcl_ha.h"
    #include "zcl_ezmode.h"
    #include "zcl_diagnostic.h"


    #include "zcl_TTa0003.h"
    #include "onboard.h"

    /* HAL */
    #include "hal_lcd.h"
    #include "hal_led.h"
    #include "hal_key.h"
    #include "hal_uart.h"
    #include "hal_board_cfg.h"
    #include "hal_timer.h"

    #if ( defined (ZGP_DEVICE_TARGET) || defined (ZGP_DEVICE_TARGETPLUS) \
    || defined (ZGP_DEVICE_COMBO) || defined (ZGP_DEVICE_COMBO_MIN) )
    #include "zgp_translationtable.h"
    #if (SUPPORTED_S_FEATURE(SUPP_ZGP_FEATURE_TRANSLATION_TABLE))
    #define ZGP_AUTO_TT
    #endif
    #endif

    #if (defined HAL_BOARD_ZLIGHT) || (defined HAL_PWM)
    #include "math.h"
    //#include "hal_timer.h" - I took out of this part and included it in the begging of include code part above.  
    #endif

    #include "NLMEDE.h"

  • Drag and drop hal_timer.c into hal folder in your project workspace.
  • Mr YK,

    I did check in the target driver folder in my work space and hal_time.c is already included. As you see bellow:

    Do you have any other idea why it is happening?

  • Oops! Everything looks correct. Strange to still see this issue.
  • Mr YK I found the main problem! 

    In my target device CC2530EB have a hal_timer.c file without the PWM API necessaries to implement PWM functions, as a HalTimer1Init. 

    I was compared with hal_time.c under CC2530PMP4712 that have a lot things inside.

    I copied hal_timer.c from Target/CC2530PMP4712 to target/CC2530EB/ and I seeing another new erros, as you can see bellow. Would you see any other idea to make an working around to fix it?

    Error[e16]: Segment XDATA_I (size: 0xfa align: 0) is too long for segment definition. At least 0x3c more bytes needed. The problem occurred while processing the 

    segment placement command "-Z(XDATA)XDATA_Z,XDATA_I=_XDATA_START-_XDATA_END", where at the moment of placement the available memory ranges
    were "XDATA:1e42-1eff"
    Reserved ranges relevant to this placement:
    XDATA:1-300 XSTACK
    XDATA:301-1eff XDATA_Z
    BIT:0-7 BREG
    BIT:80-87 SFR_AN
    BIT:90-97 SFR_AN
    BIT:a0-af SFR_AN
    BIT:b8-c7 SFR_AN
    BIT:d8-df SFR_AN
    BIT:e8-ef SFR_AN
    BIT:f8-ff SFR_AN
    Error while running Linker

  • Mr YK,
    I´m following this way,

    I changed, in my workspace, from RouterEB to RouterZlight, and after this setting compiler options HAL_PWM.

    I believe that after it I´ll reach all those files including hal_board_cfg and timer.c under hal\target\CC2530PMP4712 that has PWM settings native.

    I starting now debugging tests to check it is working!!!

    I´ll let you know soon...

    BR
    Alex
  • It’s good to know you find the root cause of link issue.
  • Thanks a lot Mr. YK. Your are the best for me.

    Right now I have moved on to a new PWM configuration phase... :)

    I keep to working to finish my PWM definitions.

    Thanks again,

    BR
    Alex