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.

CCS/CC2530: lightening cc2530

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

Tool/software: Code Composer Studio

hello there, i want to  test a point to point communicate between 2 cc2530 madual, without any board,

so instead of the keys on the board, i want to put a for loop in the samplelight code, and at the other hand, in receiver, instead of lighting LEDs on the board, I want to high or low a level,

could u please help me that which parts of the code should be changed?

thanks for ur helping  :) 

  • Hiya!

    If you're using Z-Stack 3.0.1, there actually exists some already created test code which does exactly what you're wanting. Inside SampleSwitch, in the Application/zcl_samplesw.c file there is the 'zclSampleSw_Init()' function. After the 'afRegister()' part, you can add the following code:
    ...
    // Start Toggle Test Timer
    osal_start_timerEx(zclSampleSw_TaskID,SAMPLESW_TOGGLE_TEST_EVT,500);
    ...

    This starts an already created toggle test timer, set for 500ms. If you wish to change the timing, you can modify the 500 to whatever you wish in milliseconds. The second call is inside the zclSampleSw_event_loop(), inside the code:

    //Send toggle every 500ms
    if( events & SAMPLESW_TOGGLE_TEST_EVT )
    {
    osal_start_timerEx(zclSampleSw_TaskID,SAMPLESW_TOGGLE_TEST_EVT,500);
    zclGeneral_SendOnOff_CmdToggle( SAMPLESW_ENDPOINT, &zclSampleSw_DstAddr, FALSE, 0 );

    // return unprocessed events
    return (events ^ SAMPLESW_TOGGLE_TEST_EVT);
    }

    You can modify that 500 value to whatever you wish to ensure that the interval is changed to whatever interval you wish.

    Best,
    Sean
  • ok, thanks for ur help :)
    I want some questions :
    ( 1)now is this code ok for a point to point communication? and no necessary to chang other parts of code?
    (2)can't do this communication with some changes in samplelight code of zstack-3?
    (3) could u please exactly define for me the lines of code for the first connection between moduals ? I see a AF_DataRequest function and thougt that it may be realated .
    (4) could u please send me a simple picture of the z-stack layers? I can't realize it and didn't with search.
    so thanks.
  • f you're asking about having both the Switch and the Light send data packets to each other, then that is not how the Zigbee Client/Server model works. You can refer to here to learn more about having either the Light send data to the Switch or vice versa:

    Simply, the device who binds to the other device doesn't send information to the switch as it doesn't make much sense (e.g. Light binding to the Switch).

    The first connection between the devices is during the commissioning stage, you can look more into the Base Device Behavior (BDB) files to see more in-depth details on how the commissioning process works.

    Here's a simple picture of the Z-Stack Application Architecture found in the latest Simplelink Zigbee SDK Plugin 2.20.00 Z-Stack API Guide:

    EDIT: Uploaded a better picture for Z-Stack

  • Hi there,so thanks for ur helping, I have problem in receiver module , in receiver , I want to high and low a level instead of the lighting led on the board , which part of the samplelight code shoule be changed?
    and in the other hand, when the second module receive the msg, how can I send the approval to the fist one?
  • For the receiver module, inside of zcl_samplelight.c, I recommend checking out the function 'zclSampleLight_OnOffCB()', as this is the function which is called when receiving a Zigbee On/Off command packet.

    Here's an APS ACK example for your second module

    // in zcl_samplefiredetector.c
    static zclOptionRec_t zclFD_ZCL_Options[] =
    {
    {
    ZCL_CLUSTER_ID_SS_IAS_ZONE,
    ( AF_ACK_REQUEST ),
    },
    };

    void zclSampleFireDetector_Init( byte task_id )
    {
    ...
    // Register the application's cluster option list
    zcl_registerClusterOptionList ( SAMPLEFIREDETECTOR_ENDPOINT, 1, zclFD_ZCL_Options );
    ...
  •  I have some ambiguity, thanks for ur helping :)

    1) I thought for the first step,  only need  to have a unicast communication and in receiver I want to high and low a level instead of displaying on lcd without any ack, and I thought that it should be one of the lcd's level , and I want to measre this with a voltmeter, how can it be done? which parts of samplelight code should be changed? it should be in hal_lcd.h?

    2) if I send an ack to first modual , how can I understand (get) this without lcd ? it should be chang a voltage level?

  • Hey there user5319961,

    I'm confused on what the issue is with the LCD you're mentioning, but if you are wanting to have the LCD turned OFF so you aren't having to worry about it anymore, you can follow the guide here: processors.wiki.ti.com/.../Optimizing_Flash_and_RAM_Usage_of_Z-Stack_for_CC2530

    As I mentioned in the previous post, look at the 'zclSampleLight_OnOffCB()' function. This is exactly where the 'receiver module' is receiving the communication from the Switch's command. This example toggles LED1 when you're using the SmartRF05EB, which sounds exactly what you're wanting, as this is a HI/LO level toggle.

    If you're wanting to toggle a GPIO, then you might be able to refer to this post for some functions on getting a pin to toggle alongside the LED (e2e.ti.com/.../441930)

    EDIT: Also, I'd recommend looking into using 'AF_DATA_CONFIRM_CMD' if you're wishing to know whether the packet was received or not.


    Best,
    Sean

  • COULD U PLEASE HELP ME SOON THAT WHERE SHOULD I ADD THE MESSAGE IN SAMPLES TO SENDING?

  • excuse me , could u please explain me that where I exactly start for messaging ? from which section and layer? and at the end, which command exactly send to other device ? i'm confused.
  • In the light/switch example, the switch is sending the 'zclGeneral_SendOnOff_CmdToggle()' upon toggling via UI inside the function zclSampleSw_UiActionToggleLight(). This is inside the application layer in the file zcl_samplesw.c. This sends ZCL commands to the device which it has bound itself to.

    If you wish to send generic commands, you can using the Z-Stack API command 'AF_DataRequest' which is part of the Application Framework layer within the Z-Stack Thread. This command can be used as long as the endpoints are registered. For more information, you can refer to the Z-Stack API Reference.