This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

handling BLE disconnect/reconnect in C# app

Hi, I have a C# app connecting to 51822 devices, doing data/firmware download. When I try to send erase page command (before write), erase works, but there is a disconnect; Why? Also, why can't the central and peripheral stay connected reliably during this 2+ mins continuous download? If they do disconnect (for whatever reason, remote disconnected / peripheral going out of range)I get a OnDisconnected() call back, but my main function attempting data download loses control; giving me no chance to recover/reconnect and finish rest data. I set Slave Latency=0, connection interval 15 msec, Supervision time-out 9000 msec; hope that's ok? Is there a C# example code on how to handle gracefully disconnect/reconnect?

Thanks!

Parents
  • Hi Looks like you are hitting the issue of the CPU being stalled while there is flash write or erase. This means radio events are not serviced and so my guess is that the hopping sequence is out of sync and so the connection cannot be maintained. Flash write is not so much of an issue as it is less than 100us. However each flash sector erase can take 21ms. Remember the minimum connection interval can be 7.5m, nearly 3 times less than the flash erase time.

    A workaround would be to set a connection interval of double that.

Reply
  • Hi Looks like you are hitting the issue of the CPU being stalled while there is flash write or erase. This means radio events are not serviced and so my guess is that the hopping sequence is out of sync and so the connection cannot be maintained. Flash write is not so much of an issue as it is less than 100us. However each flash sector erase can take 21ms. Remember the minimum connection interval can be 7.5m, nearly 3 times less than the flash erase time.

    A workaround would be to set a connection interval of double that.

Children
No Data
Related