If I try to update advertisment data as follows:
// Disable advertising
uint8 advertEnabled = FALSE;
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &advertEnabled );
// Update the advertising data
GAP_UpdateAdvertisingData( 0, TRUE, sizeof( advertData ), advertData);
// Enable advertising
advertEnabled = TRUE;
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &advertEnabled );
Advertisment data is not updated and after ~250 times the GAPROLE_ERROR state is reached and after this weird things happen (sometimes even the advertised MAC changes).
Splitting this in two parts, disable and update/enable, solves the problem, but this still leaves the question of how to recover from GAPROLE_ERROR should it ever happen anyway.
Is there a way to recover from GAPROLE_ERROR: I would like to reset the BLE stack without resetting the whole system with SystemReset().