Hi guys, anybody can help me please. I tried to design a Texas Home Automation simpleSW as a ZED, on my customized SOC. I had a success to connect on a commercial gateway. I got a success to join in a gateway. i see it on a Perytons Protocol Analyzer. You can see it on a message log below:
During the debug procedure on a IAR 8051 i can see that the join procedure was reached, as you can see it above, but wen the ZCL command On/Off came from the Gateway to ZED (my customized SOC). As you can see below, the "afIncomingMSGPacket_t", on the loop, was reached when the ZED received MgmntPermitJoinReq. But the ZCL_INCOMING MSG never was not reached. Please anybody can help me.
IAR Debug code:
Below i including a few parameters to help the code analyze:
void zclSampleSw_Init( byte task_id )
{
zclSampleSw_TaskID = task_id;
// Set destination address to indirect
zclSampleSw_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
zclSampleSw_DstAddr.endPoint = 0;
zclSampleSw_DstAddr.addr.shortAddr = 10;
// This app is part of the Home Automation Profile
zclHA_Init( &zclSampleSw_SimpleDesc );
// Register the ZCL General Cluster Library callback functions
zclGeneral_RegisterCmdCallbacks( SAMPLESW_ENDPOINT, &zclSampleSw_CmdCallbacks );
// Register the application's attribute list
zcl_registerAttrList( SAMPLESW_ENDPOINT, SAMPLESW_MAX_ATTRIBUTES, zclSampleSw_Attrs );
// Register the Application to receive the unprocessed Foundation command/response messages
zcl_registerForMsg( zclSampleSw_TaskID );
// Register for all key events - This app will handle all key events
RegisterForKeys( zclSampleSw_TaskID );
// Register for a test endpoint
afRegister( &sampleSw_TestEp );
ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, End_Device_Bind_rsp );
ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, Match_Desc_rsp );
}
/*********************************************************************
* @fn zclSample_event_loop
*
* @brief Event Loop Processor for zclGeneral.
*
* @param none
*
* @return none
*/
uint16 zclSampleSw_event_loop( uint8 task_id, uint16 events )
{
afIncomingMSGPacket_t *MSGpkt;
(void)task_id; // Intentionally unreferenced parameter
HalLedSet ( HAL_LED_2, HAL_LED_MODE_ON ); //ASA
HalLedSet ( HAL_LED_1, HAL_LED_MODE_ON ); //ASA
if ( events & SYS_EVENT_MSG )
{
while ( (MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( zclSampleSw_TaskID )) )
{
switch ( MSGpkt->hdr.event )
{
case ZCL_INCOMING_MSG:
// Incoming ZCL Foundation command/response messages
zclSampleSw_ProcessIncomingMsg( (zclIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;
case ZDO_CB_MSG:
zclSampleSw_ProcessZDOMsgs( (zdoIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;
default:
break;
}
// Release the memory
osal_msg_deallocate( (uint8 *)MSGpkt );
}
// return unprocessed events
return (events ^ SYS_EVENT_MSG);
}
if ( events & SAMPLESW_IDENTIFY_TIMEOUT_EVT )
{
zclSampleSw_IdentifyTime = 10;
zclSampleSw_ProcessIdentifyTimeChange();
return ( events ^ SAMPLESW_IDENTIFY_TIMEOUT_EVT );
}
// Discard unknown events
return 0;
}
void zclSampleSw_Init( byte task_id )
{
zclSampleSw_TaskID = task_id;
// Set destination address to indirect
zclSampleSw_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
zclSampleSw_DstAddr.endPoint = 0;
zclSampleSw_DstAddr.addr.shortAddr = 10;
// This app is part of the Home Automation Profile
zclHA_Init( &zclSampleSw_SimpleDesc );
// Register the ZCL General Cluster Library callback functions
zclGeneral_RegisterCmdCallbacks( SAMPLESW_ENDPOINT, &zclSampleSw_CmdCallbacks );
// Register the application's attribute list
zcl_registerAttrList( SAMPLESW_ENDPOINT, SAMPLESW_MAX_ATTRIBUTES, zclSampleSw_Attrs );
// Register the Application to receive the unprocessed Foundation command/response messages
zcl_registerForMsg( zclSampleSw_TaskID );
// Register for all key events - This app will handle all key events
RegisterForKeys( zclSampleSw_TaskID );
// Register for a test endpoint
afRegister( &sampleSw_TestEp );
ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, End_Device_Bind_rsp );
ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, Match_Desc_rsp );
}
/*********************************************************************
* @fn zclSample_event_loop
*
* @brief Event Loop Processor for zclGeneral.
*
* @param none
*
* @return none
*/
uint16 zclSampleSw_event_loop( uint8 task_id, uint16 events )
{
afIncomingMSGPacket_t *MSGpkt;
(void)task_id; // Intentionally unreferenced parameter
HalLedSet ( HAL_LED_2, HAL_LED_MODE_ON ); //ASA
HalLedSet ( HAL_LED_1, HAL_LED_MODE_ON ); //ASA
if ( events & SYS_EVENT_MSG )
{
while ( (MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( zclSampleSw_TaskID )) )
{
switch ( MSGpkt->hdr.event )
{
case ZCL_INCOMING_MSG:
// Incoming ZCL Foundation command/response messages
zclSampleSw_ProcessIncomingMsg( (zclIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;
case ZDO_CB_MSG:
zclSampleSw_ProcessZDOMsgs( (zdoIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;
default:
break;
}
// Release the memory
osal_msg_deallocate( (uint8 *)MSGpkt );
}
// return unprocessed events
return (events ^ SYS_EVENT_MSG);
}
if ( events & SAMPLESW_IDENTIFY_TIMEOUT_EVT )
{
zclSampleSw_IdentifyTime = 10;
zclSampleSw_ProcessIdentifyTimeChange();
return ( events ^ SAMPLESW_IDENTIFY_TIMEOUT_EVT );
}
// Discard unknown events
return 0;
}
void zclSampleSw_Init( byte task_id )
{
zclSampleSw_TaskID = task_id;
// Set destination address to indirect
zclSampleSw_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
zclSampleSw_DstAddr.endPoint = 0;
zclSampleSw_DstAddr.addr.shortAddr = 10;
// This app is part of the Home Automation Profile
zclHA_Init( &zclSampleSw_SimpleDesc );
// Register the ZCL General Cluster Library callback functions
zclGeneral_RegisterCmdCallbacks( SAMPLESW_ENDPOINT, &zclSampleSw_CmdCallbacks );
// Register the application's attribute list
zcl_registerAttrList( SAMPLESW_ENDPOINT, SAMPLESW_MAX_ATTRIBUTES, zclSampleSw_Attrs );
// Register the Application to receive the unprocessed Foundation command/response messages
zcl_registerForMsg( zclSampleSw_TaskID );
// Register for all key events - This app will handle all key events
RegisterForKeys( zclSampleSw_TaskID );
// Register for a test endpoint
afRegister( &sampleSw_TestEp );
ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, End_Device_Bind_rsp );
ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, Match_Desc_rsp );
}
/*********************************************************************
* @fn zclSample_event_loop
*
* @brief Event Loop Processor for zclGeneral.
*
* @param none
*
* @return none
*/
uint16 zclSampleSw_event_loop( uint8 task_id, uint16 events )
{
afIncomingMSGPacket_t *MSGpkt;
(void)task_id; // Intentionally unreferenced parameter
HalLedSet ( HAL_LED_2, HAL_LED_MODE_ON ); //ASA
HalLedSet ( HAL_LED_1, HAL_LED_MODE_ON ); //ASA
if ( events & SYS_EVENT_MSG )
{
while ( (MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( zclSampleSw_TaskID )) )
{
switch ( MSGpkt->hdr.event )
{
case ZCL_INCOMING_MSG:
// Incoming ZCL Foundation command/response messages
zclSampleSw_ProcessIncomingMsg( (zclIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;
case ZDO_CB_MSG:
zclSampleSw_ProcessZDOMsgs( (zdoIncomingMsg_t *)MSGpkt );
HalLedSet ( HAL_LED_3, HAL_LED_MODE_OFF ); //ASA
break;
default:
break;
}
// Release the memory
osal_msg_deallocate( (uint8 *)MSGpkt );
}
// return unprocessed events
return (events ^ SYS_EVENT_MSG);
}
if ( events & SAMPLESW_IDENTIFY_TIMEOUT_EVT )
{
zclSampleSw_IdentifyTime = 10;
zclSampleSw_ProcessIdentifyTimeChange();
return ( events ^ SAMPLESW_IDENTIFY_TIMEOUT_EVT );
}
// Discard unknown events
return 0;
}
Thanks a lot.
BR
Alex















