diff options
-rwxr-xr-x | mule-attiny/i2c-flash/src/mule-attiny_i2c_flash/i2c_flash.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mule-attiny/i2c-flash/src/mule-attiny_i2c_flash/i2c_flash.py b/mule-attiny/i2c-flash/src/mule-attiny_i2c_flash/i2c_flash.py index c424808..c867558 100755 --- a/mule-attiny/i2c-flash/src/mule-attiny_i2c_flash/i2c_flash.py +++ b/mule-attiny/i2c-flash/src/mule-attiny_i2c_flash/i2c_flash.py @@ -54,6 +54,16 @@ class BootModeController: sleep(0.1) self.__flashMode = True + self.enterRoMode() + + # Flashloader sub-mode (read-only: read bootloader data) + def enterRoMode(self): + if self.__flashMode: + self.__bootReq.set_value(0) + + def exitRoMode(self): + if self.__flashMode: + self.__bootReq.set_value(1) def exitFlashloader(self): if self.__bootReq.is_requested(): @@ -178,8 +188,9 @@ def main(): ) try: - # Request flashloader through bootloader + # Request flashloader through bootloader (Set to read-only-mode by default) bootCtrl.enterFlashloader() + bootCtrl.exitRoMode() ret = fw_flash(_bin, args.i2c_bus) except Exception as err: |