Skip to content
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

Feature/electron/bl dfu err propagation #813

merged 2 commits into from Jan 15, 2016


Copy link

commented Jan 15, 2016

creating a PR from @technobly's fix so I can review + merge

technobly and others added 2 commits Jan 15, 2016
propagate dfu write and erase errors back to host
FIRM-303 solved.

Because of a typo in flash_mal.c

All addresses were being converted to sector0 and the bootloader was unprotected temporarily until the
system parts could be ran and sectors 0, 5, 6, 7 would be re-protected.

Erases were pointing to the correct sector, but silently failing.
Writes were pointing to the correct sector, but also silently failing.

This commit propagates the DFU erase and write errors back to the host machine.

To test, erase electron completely and flash new bootloader compiled with `make clean all PLATFORM_ID=10 -s COMPILE_LTO=n`
Write protect sectors 0, 5, 6 & 7.  Attempt to flash system-part1.bin and system-part2.bin.  They should flash fine, but don't be alarmed if you see errors.  I found that when I had my antenna plugged in and battery removed, the modem would try to connect to the tower while I was DFU'ing new firmware and sometimes the noise would be enough to cause a failure.  Disconnecting my antenna and also plugging in the battery kept the modem from attempting to connect to the network, and ultimately proved to have many error-free DFU transfers.  Soft powering down the electron first also seems to work well.  Double tap the SETUP button to completely power off the modem and STM32 processor.  Hold SETUP and tap RESET until the RGB blinks yellow for DFU mode.

Additional notes:
* After making USB DFU errors more visible, it's clear that we need to retry the erase and write operations to improve the success rate when antennas are attached and modem is communicating with the tower.
* A verification scheme was discussed as well, however this will add much more time to the DFU transfer even if no errors occur.
* OTA Updates and USB DFU transfers could be made more robust by ensuring that the modem is in a low power state (not necessarily off) while copying the OTA update to memory.
* The bootloader is close to the max limit of 16384 bytes and will surely go over with more retry logic added.  With COMPILE_LTO=y, the new bootloader worked just as well during testing as with COMPILE_LTO=n.
Merge branch 'develop' into feature/electron/bl-dfu-err-propagation
# Conflicts:
#	platform/MCU/STM32F2xx/STM32_USB_Device_Driver/src/usbd_dfu_core.c

This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2016

looks good. 👍

@m-mcgowan m-mcgowan added this to the 0.4.9 milestone Jan 15, 2016

m-mcgowan added a commit that referenced this pull request Jan 15, 2016
Merge pull request #813 from spark/feature/electron/bl-dfu-err-propag…

Feature/electron/bl dfu err propagation

@m-mcgowan m-mcgowan merged commit 35e8aef into develop Jan 15, 2016

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
continuous-integration/travis-ci/push The Travis CI build is in progress

@cmsunu28 cmsunu28 removed the in progress label Jan 15, 2016

@technobly technobly deleted the feature/electron/bl-dfu-err-propagation branch Feb 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.