CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP event

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

According to the 'PSoC Creator Component Datasheet, Bluetooth Low Energy (BLE)
2.0' document, the CyBle_GappStartAdvertisement() starts advertisement and: "On start of advertisement, GAP Peripheral receives the CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP event."
However, that event is not being triggered. The device is configured for Peripheral.
Anyone have any idea why that event is not being triggered?

   

Thank you,
Tim
P.S. In regard to a previous post, it is apparently impossible to determine what the 128 bit UUID is for configured services or characteristics.

0 Likes
5 Replies
Anonymous
Not applicable

It was discovered that the event did not trigger because CyBle_SoftReset() was executed.

0 Likes
Anonymous
Not applicable

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,

   

Tim

0 Likes
Anonymous
Not applicable

CyBle_StackInit() found in header file and is called in CyBle_Start().

   

Question: How is CyBle_SoftReset() to be properly performed?

   

Thanks yet again,

   

Tim

0 Likes
Anonymous
Not applicable

Tim,

   

Assuming you have the required clock running (24 MHz ECO) and not calling Low power mode before, try this:

   

CyBle_Start(genericEventHandler);

   

CyBle_ProcessEvents();

   

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.

0 Likes
Anonymous
Not applicable

Hello Roit:

   

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:

   

    CyGlobalIntEnable;

   

    if (CyBle_Start(StackEventHandler) != CYBLE_ERROR_OK)

   

    {

   

        UART_UartPutString("ERROR: CyBle_Start(StackEventHandler) failed\r\n");

   

    }

   

    CyBle_ProcessEvents();  

   

Thank you for your input,

   

Tim

0 Likes