Other Parts Discussed in Thread: CC2541, CC2540
Dear all,
I have a big problem to start pairing on my remote by using CC2541.
I need to press a key during 4 secondes to start pairing, here the code that i use :
uint16 Pairing_ProcessEvent( uint8 task_id, uint16 events ){
if ( events & EVENT_START_PAIRING )
{
if( softCmdGapState != GAPROLE_CONNECTED )
{
uint8 current_adv_enabled_status;
uint8 new_adv_enabled_status;
//démarrer l'appairage
VOID GAPRole_StartDevice( &softCmdPeripheralCBs );
//Find the current GAP advertisement status
GAPRole_GetParameter( GAPROLE_ADVERT_ENABLED, ¤t_adv_enabled_status );
if( current_adv_enabled_status == FALSE )
new_adv_enabled_status = TRUE;
else
new_adv_enabled_status = FALSE;
//change the GAP advertisement status to opposite of current status
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &new_adv_enabled_status );
}
return ( events ^ EVENT_START_PAIRING);
}
if ( events & EVENT_STOP_PAIRING ){
GAPRole_TerminateConnection();
uint8 test = FALSE;
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &test );
// Clear event and return.
return ( events ^ EVENT_STOP_PAIRING);
}
// Return unrecognized events.
return (0);
}
The problem is, if i want to start a pairing nothing append because my stack pointer is out of bound. See the picture to understand : 
So i reset my chip and i test to EVENT_STOP_PAIRING and it works perfectly, after execute this code :
if ( events & EVENT_STOP_PAIRING ){
GAPRole_TerminateConnection();
uint8 test = FALSE;
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &test );
// Clear event and return.
return ( events ^ EVENT_STOP_PAIRING);
My chip goes back in low power mode.
I don't understand why the code after EVENT_START_PAIRING doesn't work.
Thanks to help me.
Anthony
