Memory operation failed
Could not read or write to the device memory.
READ_WRITE_FAILED
Symptoms
- Individual variable reads fail while the connection itself stays up.
- Errors appear when accessing a specific address or peripheral region.
- Reads start failing after the firmware enters a low-power mode.
Likely causes
- The address is invalid or unmapped for this MCU (stale symbol file from a different build/chip).
- Accessing a peripheral register whose clock is gated triggers a bus fault on some devices.
- The MCU entered STOP/STANDBY and its debug interface lost access to the bus.
- A marginal SWD link corrupts transfers under load.
How to fix it
-
Confirm the symbol file matches the firmware
If the .elf loaded in MCUHex is from a different build than what is flashed, addresses point into the wrong places. Re-upload the .elf that matches the running firmware.
-
Check the address region
Verify the variable lives in RAM/flash mapped on this exact part (a smaller-memory variant of the same family maps less RAM).
-
Keep debug alive in low-power modes
On STM32, set the DBGMCU low-power debug bits (DBG_STOP/DBG_STANDBY) during development so SWD keeps working when firmware sleeps.
-
Stabilize the link
Shorten wiring and reduce noise if failures are random rather than address-specific.