During first BLE OTA DFU attempt I get an error, second attempt always works

Hello. I am using an nRF52832 in an HCI UART connection with my application processor. I'm running Zephyr 4.2 on both MCUs. I'm using MCUMGR and MCUBOOT to get OTA FW updates working via BLE. 

On my first OTA DFU attempt, I always get the error message "<err> mcumgr_img_grp: Irrecoverable error: flash write failed: 12". This is ENOMEM. 

The second attempt always seems to work. 

It's not heap exhaustion, and I've increased workq stack sizes considerably. Any insight what might be the issue here?

Thanks,

Rob

Related