-
Notifications
You must be signed in to change notification settings - Fork 804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nimble ota check crc of the receive sector before writing into the flash #437
Conversation
👋 Hello StrugglingBunny, we appreciate your contribution to this project! Click to see more instructions ...
Review and merge process you can expect ...
|
Hi @StrugglingBunny thanks for your contribution! We will review ASAP! |
Hi @StrugglingBunny, In existing implementation, we receive the entire data, write to flash, apply the SHA-256 algorithm once to check the integrity of the full data set. If the data is not intact, we do not mark the flash as active, otherwise the process continues and reboot happens. . This approach ensures that we only need to perform the integrity check once, after the full data is written to flash. In the proposed patch, however, the integrity of each packet is being checked before it’s written to flash, meaning multiple checks occur throughout the process. This will increase the overall time for OTA ( which is not recommended). Can you please help share more information as to understand what the goal is with this change ? Could you clarify the benefit of checking each packet before writing, instead of waiting until all data is received and checking once? Also, i observe in your solution, if any packet's CRC check fails, you are simply dropping the packet, and continue to receive others. If controller has sent the packet to host, it will not resend the packet , so dropping packet at host would effectively lose the data, so what is the expected behaviour in this case ? Thank you !! |
Hi @strange969 2: For app ,the app of the product should know the status of the update process. Crc check result should be send from device to center(The README file of the ble ota example also mention that :"Server will check the total length and CRC of the data from the client, reply the correct ACK, and then start receive the next sector of firmware data.".). 3:In the lastest commit,i increase the cur_sector only if the current sector crc match,if the current sector crc mismatch,device will response CRC ERR to notify the app,so the app can ether send the sector again(For the demo app,do not send crc error to the phone and do not increase the sector index in the device can let the app send the sector again ).so in this case ,the app size not need to restart the whole ota process again. or stop the ota process(If send the crc error,the app will stop the ota process and report ). I found that ,lots of the OTA protocol have the crc check of each chunk and also have the re-send chunks function when needed, in fact this will not increase lots of the overall time of the OTA process and can sometime reduce the OTA overall time when there is some issues in some chunks.So I think it's necessary. Thank you !!! |
Hi @StrugglingBunny, thank you so much for your time and effort in reviewing and providing the patch. I truly appreciate your help! I’ve applied the patch which you provided and tested it on my side. However, I noticed that when a CRC checksum mismatch occurs, the EspBleOTA app (Espressif app) doesn’t retransmit the packet and disconnects. If it's not too much trouble, could you kindly clarify which app you are using to check this behavior? |
Hi @strange969 |
Hi @strange969 Test log. Thanks. |
2002749
to
15d0cb1
Compare
Hi @StrugglingBunny , I have tested the changes, and they are working perfectly for both normal OTA and Delta OTA. However, I encountered issue when testing with encrypted OTA and Protocomm OTA. Could you please help clarify why this PR was closed? Is there something incorrect in the implementation, or are there additional changes required? Kindly let me know if I can assist in addressing any concerns. |
BLE nimble ota ,add check crc of the receive sector before writing to the flash.