Skip to content

Commit a5643a4

Browse files
JordanYateskartben
authored andcommitted
flash: stm32l4/g4: force load option bytes after write
After writing option bytes, force them to be loaded. Failing to perform this step means the values are never applied and not actually written to non-volatile memory. Signed-off-by: Jordan Yates <[email protected]>
1 parent 59b1bb2 commit a5643a4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

drivers/flash/flash_stm32g4x.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,10 @@ int flash_stm32_option_bytes_write(const struct device *dev, uint32_t mask,
285285
return rc;
286286
}
287287

288-
return 0;
288+
/* Force the option byte loading */
289+
regs->CR |= FLASH_CR_OBL_LAUNCH;
290+
291+
return flash_stm32_wait_flash_idle(dev);
289292
}
290293

291294
uint32_t flash_stm32_option_bytes_read(const struct device *dev)

drivers/flash/flash_stm32l4x.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ int flash_stm32_option_bytes_write(const struct device *dev, uint32_t mask,
276276
return rc;
277277
}
278278

279-
return 0;
279+
/* Force the option byte loading */
280+
regs->CR |= FLASH_CR_OBL_LAUNCH;
281+
282+
return flash_stm32_wait_flash_idle(dev);
280283
}
281284

282285
uint32_t flash_stm32_option_bytes_read(const struct device *dev)

0 commit comments

Comments
 (0)