@@ -160,7 +160,7 @@ int RAMFUNCTION hal_flash_write(uint32_t address, const uint8_t *data, int len)
160160
161161void 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
184184void 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