Hi Hugo Olivera,
What is the operating sequence of events generated?
As you know, the first event which will get triggered is 'CYBLE_EVT_STACK_ON' . The order in which the next events get generated will depends on your application and profile chosen (Central/Peripheral). The best way to track/understand the flow of the event triggering is use a UART in the application, put UART prints in which and all events you are using.
For the issue mentioned above in your application, Please create a TechSupport case under cypress.com -> Mycases
The code snippet which you shared is not enough to understand the issue. So preferably please create the Tech support case, elaborate the problem and share the project. So that we can help you to fix it.