Might be that a malloc() goes wrong. I would try increasing the heap size. In .cydwr view System-Tab.
Now the heap size is 0x400 (1024), I tested it by using CySmart PC version, it does not happen this problem,
but when I test it by using CySmart Android version, this problem will bring out frequently even I increased the heap size to 0x600.
Are you using sprintf()? I experienced some strange behaving especially when sprintf float numbers.
Is your program using malloc() and free()? Can that be a cause??
When all fails, I would suggest you to get in contact with Cypress directly: At top of this page select "Design support -> Create a Support Case" and ask your question. You will be helped by a Cypress engineer. But keep in mind it's independence day on July 4th.
How quickly are you sending notifications? Some buffering is needed because packets can't all be sent immediately, and the stack has limited space available for buffering packets. If you are attempting to send notifications faster than they can be transmitted, then the internal buffers will fill and ultimately reject new packets until some have been sent.
In the "sending too fast" case, which I suspect is the issue here, there are two solutions:
- Introduce some delay between notifications so that this condition doesn't occur
- Retry sending the same failed notification repeatedly until the API method returns a success result
There is no problem with using either approach, but option #2 may use more power on average since there's no possibility for sleep. If you throttle your transmissions down to perhaps once ever 5 ms or so (for example), the CPU and stack can sleep between each transmission.
Yes, you are right.
When I slow down the frequency of sending notification, the CySmart Android version will not happen the error "CYBLE_ERROR_MEMORY_ALLOCATION_FAILED".
But I wonder about why this error only occurs on CySmart Android version ?
(Both CySmart PC and iOS version are OK by using the same condition to test for.)
The Stack state has to be free before sending the notification.
So checking the stack busy state is the way to avoid the "CYBLE_ERROR_MEMORY_ALLOCATION_FAILED".
Hey Aaron, could you provide the code you used to avoid this problem? I'm running into it, and checking the busy state doesn't seem to help. (http://www.cypress.com/forum/proc-ble/problems-ble-notifications)