In multi connection use case, the recommended minimum connection interval per connection should be greater than N * Max Time taken by individual connections to complete a BLE Connection Event (CE).
Min_CI = N * Average Time Per CE. Where, N is the no. of BLE Connections supports.
Average time for each CE is the amount of time taken to complete one BLE Tx and Rx transaction. This time varies depending on Link Layer Data Length Extension (DLE) and BLE data rate (1 Mbps or 2 Mbps) configuration. Please refer the description of Cy_BLE_GAPC_InitConnection() for recommended Connection Interval values in cy_ble_stack_gap_central.h file.
Please let me know if this helps.
My connection interval was to low (I had it set to 7.5 ms and with DLE enabled and 2 Mbps, it should be at least 14 ms according to the descrition). However, I changed the minimum connection interval to 25 ms and maximum to 50 ms. It did not help, the problem persists
Cy_BLE_GAPC_InitConnection() and Cy_BLE_GAP_Disconnect() can return CY_BLE_ERROR_INSUFFICIENT_RESOURCES if HCI commands queue is FULL, so BLE stack can't allocate resource for this command.
1. Before calling Cy_BLE_GAPC_InitConnection, you called another couple Stack functions without waiting the response (by event). Will be good to review your implementation of BLE part in gateway project,
2. You do not enough call Cy_BLE_ProcessEvent (refer to documentation for this function),
3. Application corrupts memory related to BLE middleware.
* I call Cy_BLE_ProcessEvent() every loop in my main task, so it should run approx. once per ms, that should be often enough
* I have run valgrind on all my unit tests and not found any memory corruption errors. I guess I can try to put a conditional breakpoint if there is some specific struct you'd like me to check. When connect is called, as far as I can see all parameters have reasonable/correct values.
So, the reason is then likely your point 2). I have reviewed my code, and I have a lot of error handling code to try to recover from some scenarios in which I never get completion events from the stack. I guess that might be a cause. So I have removed the error handling code and I'm experiencing three kinds of failures:
* In Cy_BLE_GAPC_ConnectDevice() the call to Cy_BLE_StartTimer() returns CY_BLE_ERROR_INVALID_OPERATION which according to API documentation simply means "On failed operation.". cy_ble_connectionParameters has the values timerHandle = 0 and timeout = 30. cy_ble_state is CY_BLE_STATE_ON and all four entires in cy_ble_connState is DISCONNECTED. When this happens I added a retry after 15 seconds. That ran for several hours without recovering
* I have experienced never (let it try fro 30 minutes) receiving the connection event after a successfull call to Cy_BLE_GAPC_ConnectDevice(). I checked cy_ble_state and it was still CY_BLE_STATE_CONNECTING. I added calling Cy_BLE_GAPC_CancelConnection() when this occured, but then the completion event for that was not received either
* I have experienced Cy_BLE_GAP_Disconnect() not generating the disconnect events. I have tried calling Cy_BLE_GAP_Disconnect() again if event is not received within 30 seconds. That has either had the same effect or returned INSUFFICENT_RESOURCES. I have tried powering off the device that it thinks it's connected to, but it is still shown as connected in cy_ble_connState
Ok, so I did two changes to my code yesterday:
* Previously I had the BLE controller om the M0+ core and the BLE host on M4. I changed so that the entire stack ran on M4
* I upgraded PDL from version 3.0.4 to 3.1.0
After these changes, I have not seen these issues
1 of 1 people found this helpful
Could you confirm that you do not observe problem with BLE dual mode (BLE controller on the M0+ core and the BLE host on M4) on 3.1.0?
What is BLESS ISR configuration on project which was failed (3.0.4 + BLE dual)?
Did you do any modification in cy_ipc_config.h?