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
merged 2 commits into from
Jan 15, 2016

Conversation

m-mcgowan
Copy link
Contributor

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

technobly and others added 2 commits January 15, 2016 01:33
FIRM-303 solved.

Because of a typo in flash_mal.c
5fafd11

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.
https://github.com/spark/firmware/blob/develop/platform/MCU/STM32F2xx/STM32_USB_Device_Driver/src/usbd_flash_if.c#L101-L102

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.
# Conflicts:
#	platform/MCU/STM32F2xx/STM32_USB_Device_Driver/src/usbd_dfu_core.c
@m-mcgowan
Copy link
Contributor Author

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
…ation

Feature/electron/bl dfu err propagation
@m-mcgowan m-mcgowan merged commit 35e8aef into develop Jan 15, 2016
@technobly technobly deleted the feature/electron/bl-dfu-err-propagation branch February 8, 2016 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants