Which file i can get port & pin configuration of led connected in light project for toggling,on and off process under home automation in z-stack home 1.2.2?
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.
Which file i can get port & pin configuration of led connected in light project for toggling,on and off process under home automation in z-stack home 1.2.2?
Hi Yikai,
this post is not related to false key interrupt. I have included my revised code for processing functions based on key press count. in P0.0 interrupt it will start event for counting the number of key press. after 10 sec(KEY_PRESS_COUNT_WAIT_TIME) zb_HandleOsalEvent() should be called which in turn will call Process_Key_Press_Event() which is used to count the number of times key is pressed and process according to that.
I am not able to set any breakpoint in zb_HandleOsalEvent() and Process_Key_Press_Event(). These functions are not called as after 10sec of first time key is pressed,HAL_KEY_SW_7_PRESS_COUNT should be 0 but it keeps on incrementing at each switch press.
uint8 HAL_KEY_SW_7_PRESS_COUNT = 0; //global variable to count the number of key press #define KEY_PRESS_COUNT_WAIT_TIME 10000 #define KEY_PRESS_COUNT_EVENT 0x0100 #define RESET_TO_FACTORY_EVENT 0x0200 HAL_ISR_FUNCTION( halKeyPort0Isr, P0INT_VECTOR ) { HAL_ENTER_ISR(); if (HAL_KEY_SW_7_PXIFG & HAL_KEY_SW_7_BIT) //sw7 connected to P0.0 { if(HAL_KEY_SW_7_PRESS_COUNT == 0) { //start event to calculate and process the key press count osal_start_timerEx (zclSampleDoorLock_TaskID, KEY_PRESS_COUNT_EVENT, KEY_PRESS_COUNT_WAIT_TIME); } HAL_KEY_SW_7_PRESS_COUNT++; //increment count on key press } HAL_KEY_SW_7_PXIFG = 0; HAL_KEY_CPU_PORT_0_IF = 0; . . } //defined in zcl_sampledoorlock.c file void zb_HandleOsalEvent( uint16 event ) { if( event & KEY_PRESS_COUNT_EVENT) { osal_stop_timerEx (zclSampleDoorLock_TaskID, KEY_PRESS_COUNT_EVENT); Process_Key_Press_Event(); event &= (~KEY_PRESS_COUNT_EVENT); } if( event & RESET_TO_FACTORY_EVENT) //factory reset microcontroller { event &= (~RESET_TO_FACTORY_EVENT); zgWriteStartupOptions(ZG_STARTUP_SET, (ZCD_STARTOPT_DEFAULT_NETWORK_STATE | ZCD_STARTOPT_DEFAULT_CONFIG_STATE)); ZDApp_ResetTimerStart(3000); } } void Process_Key_Press_Event( void ) { if(HAL_KEY_SW_7_PRESS_COUNT == 3) //set event to factory reset microcontroller when key is pressed 3 times { osal_set_event ( zclSampleDoorLock_TaskID, RESET_TO_FACTORY_EVENT); //set event to factory reset microcontroller HAL_KEY_SW_7_PRESS_COUNT=0; //reset key press count } if(HAL_KEY_SW_7_PRESS_COUNT == 5) { //do some process } }
HAL_ISR_FUNCTION( halKeyPort0Isr, P0INT_VECTOR )
{
HAL_ENTER_ISR();
if (HAL_KEY_SW_7_PXIFG & HAL_KEY_SW_7_BIT) //sw7 connected to P0.0
{
if(HAL_KEY_SW_7_PRESS_COUNT == 0)
{
//start event to calculate and process the key press count
osal_start_timerEx (zclSampleDoorLock_TaskID, KEY_PRESS_COUNT_EVENT, KEY_PRESS_COUNT_WAIT_TIME);
}
HAL_KEY_SW_7_PRESS_COUNT++; //increment count on key press
}
HAL_KEY_SW_7_PXIFG = 0;
HAL_KEY_CPU_PORT_0_IF = 0;
.
.
}
Hi Yikai,
I have included code for sending ZCL command using AF_DATA_REQUEST. For testing whether data is received, i am sending command from zed to zc. Is it correct?
i am getting following error for
dstAddr.addr.shortAddr = 0; and
srcEP.endPoint=SAMPLEDOORLOCK_ENDPOINT;
Error[Pe154]: expression must have struct or union type
afAddrType_t *dstAddr; endPointDesc_t *srcEP; uint8 *buf; uint8 *transID; dstAddr.addr.shortAddr = 0; dstAddr->addrMode=afAddr16Bit; srcEP.endPoint=SAMPLEDOORLOCK_ENDPOINT; buf[0]=0x08;//Frame control:command acts across entire profile,not manufacturer //specific,command sent from client to server. buf[1]=0x01;//transaction seq no buf[2]=0x01;//command identifier:Unlock door transID[0]=0x01; AF_DataRequest( dstAddr, srcEP, ZCL_CLUSTER_ID_CLOSURES_DOOR_LOCK, 3, buf, transID, AF_DEFAULT_RADIUS,0 );
Ya, after uninstalling all iar products, error is not received.
please check again whether AF_DATA_REQUEST fn is correct or not. now error is not received in dstAddr but data is not received at zc. i have checked this by placing breakpoint in case ZCL_INCOMING_MSG: of zc.
afAddrType_t dstAddr; endPointDesc_t srcEP; uint8 *buf; uint8 *transID; dstAddr.addr.shortAddr = 0; dstAddr.addrMode=afAddr16Bit; srcEP.endPoint=SAMPLEDOORLOCK_ENDPOINT; buf[0]=0x08;//Frame control:command acts across entire profile,not manufacturer //specific,command sent from client to server. buf[1]=0x01;//transaction seq no buf[2]=0x01;//command identifier:Unlock door transID[0]=0x01; AF_DataRequest( &dstAddr, &srcEP, ZCL_CLUSTER_ID_CLOSURES_DOOR_LOCK, 3, buf, transID, AF_DEFAULT_RADIUS,0 );
What is simpleDesc in your srcEP when you call AF_DataRequest? I see an unknown Profile ID in your sniffer log and I suspect this is the problem.
My sniffer has some problem and it often shows wrong device description like profile id,EP etc
Here i have included Active EP Request and Response,Simple desc Request and Response. Here you can see device description are received correctly through hyper terminal.
I will modify program to send data from zc to zed using Af_Datarequest() and check whether data is received at zed.
here i have included sniffer log and my revised code for af data request. now also data is not received at zc. i have used default parameters values as used in original z-stack.
static cId_t bindingInClusters1[] = { ZCL_CLUSTER_ID_GEN_ON_OFF, ZCL_CLUSTER_ID_CLOSURES_DOOR_LOCK }; #define ZCLSAMPLEDOORLOCK_BINDINGLIST1 (sizeof(bindingInClusters1) / sizeof(bindingInClusters1[0])) AddrType_t dstAddr; endPointDesc_t srcEP; uint8 *buf; uint8 *transID; dstAddr.addr.shortAddr = 0; dstAddr.addrMode=afAddr16Bit; srcEP.endPoint=SAMPLEDOORLOCK_ENDPOINT; srcEP.simpleDesc->EndPoint=SAMPLEDOORLOCK_ENDPOINT; srcEP.simpleDesc->AppProfId=ZCL_HA_PROFILE_ID; srcEP.simpleDesc->AppDeviceId=ZCL_HA_DEVICEID_DOOR_LOCK; srcEP.simpleDesc->AppNumInClusters=ZCLSAMPLEDOORLOCK_BINDINGLIST1; srcEP.simpleDesc->pAppInClusterList=bindingInClusters1; srcEP.simpleDesc->AppNumOutClusters=ZCLSAMPLEDOORLOCK_BINDINGLIST1; srcEP.simpleDesc->pAppOutClusterList=bindingInClusters1; //used in cluster temporarly buf[0]=0x08;//Frame control:command acts across entire profile,not manufacturer specific,command sent from client to //server. buf[1]=0x01;//transaction seq no buf[2]=0x01;//command identifier:Unlock door transID[0]=0x01; AF_DataRequest( &dstAddr, &srcEP, ZCL_CLUSTER_ID_CLOSURES_DOOR_LOCK, 3, buf, transID, AF_DEFAULT_RADIUS,0 );