Hello,
I have a problem, the BLE is not giving gAdvertisingDataSetupComplete_c callback after waking up from power down 0. It works if I run it directly from IAR (doesn't really enter power down 0).
Process (based on BLE profiling example)
Gap_StopAdvertising()
Prepare to sleep()
POWER_EnterPowerDown(0)
EXTI wakeup
Post sleep()
Gap_SetAdvertisingData(&gAppAdvertisingData, NULL) == gBleSuccess_c
(successfully getting here)
// not receiving gAdvertisingDataSetupComplete_c callback
========================================================
Post sleep(): (based on example):
_switch_to_XTAL(); /* required for PD0 */
SYSCON->CLK_EN = SYSCON_CLK_EN_CLK_CAL_EN_MASK | SYSCON_CLK_EN_CLK_BLE_EN_MASK; /* dont use it with BIT_SET! */
/* imr = 1 */
CALIB->VCO_MOD_CFG |= CALIB_VCO_MOD_CFG_IMR_MASK;
/* AA error */
BLEDP->DP_AA_ERROR_CTRL = 0x0000000EU;
POWER_RestoreIO(); /* after this DIO is user configurable */
/* BLE wake up */
//POWER_DisablePD(kPDRUNCFG_PD_BLE); // todo not used in example
/* Prevent BLE sleep */
BLE_disable_sleep();
APP_RestoreBleReg();
/* BLE wakeup is onging */
NVIC_DisableIRQ(OSC_IRQn);
if(NVIC_GetPendingIRQ(OSC_IRQn))
{
NVIC_ClearPendingIRQ(OSC_IRQn);
BLE_prevent_sleep_on_wakeup();
}
/* Check if BLE is in sleep mode */
while(SYSCON->SYS_STAT & SYSCON_SYS_STAT_CLK_STATUS_MASK)
{
/* request BLE soft wakeup */
BLE_disable_sleep();
ble_soft_wakeup_req_setf(1);
/* wait until BLE LL is up and running */
while(!(SYSCON->SYS_STAT & SYSCON_SYS_STAT_OSC_EN_MASK))
{
}
}
/* check if not in sleep */
ASSERT(BLE_get_sleep_mode() < kPmPowerDown0);
(successfully finishing)
Is there any status I could read out from BLE?
BLE seems to be fully powered and clocked.