It was discovered that the event did not trigger because CyBle_SoftReset() was executed.
However, CyBle_SoftReset() returns CYBLE_ERROR_INVALID_OPERATION, which "occurs if this function is invoked before invoking CyBle_StackInit function".
However, there is no CyBle_StackInit function described anywhere in the entire document.
QUESTION: Is there a CyBle_StackInit function and, if so, where is it?
Thanks once again,
CyBle_StackInit() found in header file and is called in CyBle_Start().
Question: How is CyBle_SoftReset() to be properly performed?
Thanks yet again,
Assuming you have the required clock running (24 MHz ECO) and not calling Low power mode before, try this:
Ensure that you get the event 'CYBLE_EVT_STACK_ON' after the above code. If not, then there is something wrong with the BLE block itself.
If you do get the above event, then you can call CyBle_GappStartAdvertisement(), either in the above event or outside after the CyBle_ProcessEvents().
Also ensure you have the global interrupt enabled (call CyGlobalIntEnable before starting anything in main).
Do you have any interrupt source in your project that may be triggering before calling the CyBle_Start()? If yes, ensure that the BLE ISR gets the highest priority (priority 0). You can set this in the project's CYDWR -> Interrupts tab.
I would suggest not to fix around CyBle_SoftReset() as it is normally used internal to BLE stack.
The code was confirmed with your comments and all suggestions, and several other combinations, were tried.
Whenever CyBle_SoftReset() is called, there will be no events, even if CyGlobalIntEnable; is called afterwards (or not) for all combinations.
The purpose of using CyBle_SoftReset() was to emulate the Microchip RN4020 Factory Reset UART commands (i.e. SF,1 and SF,2).
Therefore, instead of calling CyBle_SoftReset() for a reset, I will call CyBle_Stop(); followed by the following as performed at the beginning in main:
if (CyBle_Start(StackEventHandler) != CYBLE_ERROR_OK)
UART_UartPutString("ERROR: CyBle_Start(StackEventHandler) failed\r\n");
Thank you for your input,