I have a CC2510 Mini Development Kit with the CC Debugger. I am running the CC1110 and CC2510 Mini DK Software Example (swrc133) which is the "smpl_link_srfccxx10".
In this example, there is a function called "uint8_t BSP_SleepUntilButton(uint8_t mode, uint8_t button)" which is defined in the "bsp_extended.c" file. For the CC2510 Mini DK, this function defines it as the "BSP_BOARD_SRFCCXX10". The definition of this function is shown below.
/**************************************************************************************************
* @fn BSP_SleepUntilButton
*
* @brief Enter sleep mode, Set up DMA workaround according to errata note for CC251x & CC111x
* Will wake up on Button pushes
*
* @param mode : Power mode, can be 0-3
* button : Button to wake up on, can be 1 (master), 2 (slave) or 3 (both)
*
* @return none
**************************************************************************************************
*/
uint8_t BSP_SleepUntilButton(uint8_t mode, uint8_t button)
{
// Set radio to sleep
SMPL_Ioctl(IOCTL_OBJ_RADIO,IOCTL_ACT_RADIO_SLEEP,0);
IEN2 &= ~0x01; // Disable RF interrupt
BSP_ENABLE_INTERRUPTS();
BSP_SET_MAIN_CLOCK_RC(); // Set main clock source to RC oscillator
#ifdef BSP_BOARD_SRFCCXX10
//Using SRFCCxx10 board
/* Clear Port 1 Interrupt flags */
P1IFG = 0x00;
P1IF = 0;
P1IEN &= ~0x0C;
P1IEN |= (button<<2); // Enable Port interrupts
/* Enable CPU Interrupt for Port 1 (IEN2.P1IE = 1) */
IEN2 |= 0x10;
#endif
#ifdef BSP_BOARD_SRF04EB
//Using SFR04 board
/* Clear Port 0 Interrupt flags */
P0IFG = 0x00;
P0IF = 0;
PICTL &= ~0x18;
PICTL |= (button<<3); // Enable Port interrupts
/* Enable CPU Interrupt for Port 0 (IEN1.P0IE = 1) */
IEN1 |= 0x20;
#endif
BSP_ENABLE_INTERRUPTS();
bsp_PowerMode(mode);
BSP_SET_MAIN_CLOCK_XOSC(); // Set main clock source to External oscillator
// Wake up the radio and set it in Idle
SMPL_Ioctl(IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_AWAKE,0);
IEN2 |= 0x01; // Enable RF interrupt
return sButtonPushed;
}
From the function definition, it looks that the CC2520 Mini DK uses rising edge of Port 1 pins to trigger the interrupt and wakeup the radio since the default setting of the PICTL.P1ICON is 0. For my own application, I need to change this to use falling edge to trig the interrupt. Thus, I add an additional line to the original code as shown below sandwiched between two /*??????????*/ lines.
#ifdef BSP_BOARD_SRFCCXX10
//Using SRFCCxx10 board
/* Clear Port 1 Interrupt flags */
P1IFG = 0x00;
P1IF = 0;
/*???????????????????????????????????????????????????????????????????????*/
PICTL |= 0x02; // Falling edge triggers interrupts
/*???????????????????????????????????????????????????????????????????????*/
P1IEN &= ~0x0C;
P1IEN |= (button<<2); // Enable Port interrupts
/* Enable CPU Interrupt for Port 1 (IEN2.P1IE = 1) */
IEN2 |= 0x10;
#endif
After recompiling the code, I found that the BSP_SleepUntilButton seems not working anymore. Can you please help to debug this problem and show me how to change the rising edge to the falling edge?