Skip to content

Commit 18b8091

Browse files
committed
STM32H7: Fix wrong block size in flash ops
F/367
1 parent 1c756b3 commit 18b8091

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

hal/stm32h7.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ int RAMFUNCTION hal_flash_write(uint32_t address, const uint8_t *data, int len)
160160

161161
void RAMFUNCTION hal_flash_unlock(void)
162162
{
163-
flash_wait_complete(1);
163+
flash_wait_complete(0);
164164
if ((FLASH_CR1 & FLASH_CR_LOCK) != 0) {
165165
FLASH_KEYR1 = FLASH_KEY1;
166166
DMB();
@@ -170,7 +170,7 @@ void RAMFUNCTION hal_flash_unlock(void)
170170
;
171171
}
172172

173-
flash_wait_complete(2);
173+
flash_wait_complete(1);
174174
if ((FLASH_CR2 & FLASH_CR_LOCK) != 0) {
175175
FLASH_KEYR2 = FLASH_KEY1;
176176
DMB();
@@ -183,11 +183,11 @@ void RAMFUNCTION hal_flash_unlock(void)
183183

184184
void RAMFUNCTION hal_flash_lock(void)
185185
{
186-
flash_wait_complete(1);
186+
flash_wait_complete(0);
187187
if ((FLASH_CR1 & FLASH_CR_LOCK) == 0)
188188
FLASH_CR1 |= FLASH_CR_LOCK;
189189

190-
flash_wait_complete(2);
190+
flash_wait_complete(1);
191191
if ((FLASH_CR2 & FLASH_CR_LOCK) == 0)
192192
FLASH_CR2 |= FLASH_CR_LOCK;
193193
}
@@ -619,4 +619,3 @@ int hal_flash_otp_read(uint32_t flashAddress, void* data, uint32_t length)
619619
}
620620

621621
#endif /* FLASH_OTP_KEYSTORE */
622-

0 commit comments

Comments
 (0)