[STM32H7] STM32H7B0的OTP地址0x08fff000写入不了

[复制链接]
 楼主| elephant00 发表于 2023-1-3 09:13 | 显示全部楼层 |阅读模式

如题,用HAL代码和STM32CubeProgrammer都写入不成功,一直是fffffff
香水城 发表于 2023-1-3 10:26 | 显示全部楼层

另外对OTP区域编程要注意正确的操作顺序,先要做开锁操作。
手册里有明确出来:

1. Unlock FLASH_OPTCR and set PG_OTP bit in the FLASH_OPTCR register.
其中,解锁FLASH_OPTCR可以通过调用库函数HAL_FLASH_OB_Unlock(void)来完成。

2. Check the protection status of the target OTP word (see Table 17). The corresponding LOCKBi bit must be cleared to 0.

3. Write two OTP words (32 bits) corresponding to the 4-byte aligned address . Alternatively, the application software
can program separately the 16-bit MSB or 16-bit LSB. In this case the first 16-bit write operation starts immediately
without waiting for the second one.

4. Check that QW1 bit in FLASH_SR1 has been raised and wait until it is reset to 0.

另外,OTP只能写1次。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1030

主题

3864

帖子

7

粉丝
快速回复 在线客服 返回列表 返回顶部