打印
[STM32H7]

STM32H7B0的OTP地址0x08fff000写入不了

[复制链接]
338|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
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次。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

970

主题

2982

帖子

7

粉丝