In my firmware, I am monitoring a GPIO pin state to decide:
- when to exit Hibernate mode and start running the firmware
- when to stop running the firmware and re-enter Hibernate mode
I am also allowing the option to do an FOTA via BLE.
During testing, I am noticing that sometimes, during the FOTA, my device will decide that it doesn't want to be in "active" mode and will attempt to go back into Hibernate mode halfway through the FOTA, which causes things to crash. I notice it happens whilst the new image is being uploaded.
So, I want to be able to prevent my hardware from checking the state of the relevant GPIO whilst its doing a FOTA, and only look at the state of this pin once its all completed and has rebooted and switched over to the new image. I can probably use a mutex lock/unlock to achieve this, but I'm just not sure where in my firmware this needs to go. As I understand it, all the FOTA is handled by the SMP Server/MCUmgr but I'm not sure I can go modifying that code.
I'm already setting the following in my mcuboot.conf file.
Can anyone give me some ideas on how I can fix this problem?
Thanks and regards,
Mike