Skip to content

Commit

Permalink
stm32h7: Use a more conservative ACR for H7Bx from its defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
ALTracer committed Apr 14, 2024
1 parent 221b82a commit 758d665
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/target/stm32h7.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,11 @@ static bool stm32h7_flash_erase(target_flash_s *const target_flash, target_addr_
if (!stm32h7_flash_unlock(target, addr))
return false;
/* We come out of reset with HSI 64 MHz. Adapt FLASH_ACR.*/
target_mem_write32(target, flash->regbase + FLASH_ACR, 0);
uint32_t acr = 0;
/* H7Bx starts up in VOS3 from HSI 64 MHz with default ACR of 0x13 */
if (sector_size == 0x2000U)
acr = 0x13;
target_mem_write32(target, flash->regbase + FLASH_ACR, acr);
/* Calculate SNB span */
addr &= target_flash->length - 1U;
const size_t end_sector = (addr + len - 1U) / sector_size;
Expand Down

0 comments on commit 758d665

Please sign in to comment.