Hi, Since in the Zstack all the event is based on timer, then if i connect interrupt sensor like vibration sensor(when ever vibrate occur it will inform to controller). Then how this stack will collect the info.
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.
Hi, Since in the Zstack all the event is based on timer, then if i connect interrupt sensor like vibration sensor(when ever vibrate occur it will inform to controller). Then how this stack will collect the info.
Ok. i plan to make custom board with CC2530/CC238.
which interface i have to connect the RF antenna.
Will TI provide antenna. what are the antenna available.
TI doesn't provide antenna. You need to design it by yourself or buy it from 3rd party. The antenna is connected to RF_P and RF_N pins, which you can refer to CC2530 datasheet.
I was searching the post in where i will get my answer. So I found this post is some what related, but still I want clear answer.
I)How can I configure any gpio pin as an interrupt pin.
ii)And where I will get sensor data(I mean the call back function/ISR function)
Hi Yikai,
I have gone through the hal_key.c. My sensor is connected to P1_7. Let me know if I am correct and my some question is marked. I think this will be very useful for others also.
zcl_xxx_Init( byte task_id)
{
P1SEL &= ~(1 << 7); /* Set pin function to GPIO */
P1DIR &= ~(1 << 7); /* Set pin direction to Input */
PICTL &= ~(1 << 1); /*Is this correct because i am using Port 1*/
P1IEN |= (1 << 7);
IEN1 |= /*what should i give here,i didn't get why their it BV(5) for P0_1*/;
P1IFG = ~ (1 << 7);
}
HAL_ISR_FUNCTION( halKeyPort0Isr, P0INT_VECTOR )
{
HAL_ENTER_ISR();
/* What is the if Condition mean*/
if (P1IFG & (1 << 7))
{
readSensorData();
}
P1IFG = 0;
P1IF = 0;
/* These two calling function is really nedded*/
CLEAR_SLEEP_MODE();
HAL_EXIT_ISR();
}
void readSensorData()
{
uint8 PortData;
PortData = P1_7;
/*Process*/
}
Is this Correct to call the read sensor Data function?
Is there any thing do apart from this?In hal_key.c, in function halProcessKeyInterrupt
if (HAL_KEY_SW_6_PXIFG & HAL_KEY_SW_6_BIT) /* Interrupt Flag has been set */
{
HAL_KEY_SW_6_PXIFG = ~(HAL_KEY_SW_6_BIT); /* Clear Interrupt Flag */
valid = TRUE;
}.
these steps I need to add in my code(Clear Interrupt Flag)?
Is there any thing I need to add in compile option?
I have define these for P1_7. Is any thing wrong.
/* SW_6 is at P0.1 */
#define HAL_KEY_SW_6_PORT P1
#define HAL_KEY_SW_6_BIT BV(7)
#define HAL_KEY_SW_6_SEL P1SEL
#define HAL_KEY_SW_6_DIR P1DIR
/* edge interrupt */
#define HAL_KEY_SW_6_EDGEBIT BV(0)
#define HAL_KEY_SW_6_EDGE HAL_KEY_FALLING_EDGE
/* SW_6 interrupts */
#define HAL_KEY_SW_6_IEN IEN1 /* CPU interrupt mask register */
#define HAL_KEY_SW_6_IENBIT BV(5) /* Mask bit for all of Port_0 */
#define HAL_KEY_SW_6_ICTL P1IEN /* Port Interrupt Control register */
#define HAL_KEY_SW_6_ICTLBIT BV(7) /* P0IEN - P0.1 enable/disable bit */
#define HAL_KEY_SW_6_PXIFG P1IFG /* Interrupt flag at source */
I used sample light as example.
HAL_ISR_FUNCTION( halKeyPort0Isr, P0INT_VECTOR )
{
HAL_ENTER_ISR();
HalLcdWriteString ("Enter ISR", HAL_LCD_LINE_3);
if (HAL_KEY_SW_6_PXIFG & HAL_KEY_SW_6_BIT)
{
HalLcdWriteString ("Enter ISR", HAL_LCD_LINE_3);
halProcessKeyInterrupt();
}
/*
Clear the CPU interrupt flag for Port_0
PxIFG has to be cleared before PxIF
*/
HAL_KEY_SW_6_PXIFG = 0;
HAL_KEY_CPU_PORT_0_IF = 0;
CLEAR_SLEEP_MODE();
HAL_EXIT_ISR();
}
When press the switch and joy stick.. No string I printing in the LCD. But LED is glowing. Please fix my issue.
1. You can refer to CC253x user manusl at http://www.ti.com/lit/ug/swru191f/swru191f.pdf and check if all register settings are correct.
2. You should't put LCD write in ISR function. You can set a break point in ISR and see if it is triggered by your GPI interrupt.