發新話題
打印

Flash lock byte 使用疑問

Flash lock byte 使用疑問

你好
想請問關於使用Lock Byte鎖定固定PAGE時出現的問題。
在程式段寫入想鎖定的頁面後
例如 lock_byte(0xFBFF)=0xF0 => LOCK 15 page。
在第一次燒錄啟動時都可以正常動作,可是當斷電後就無法再動作,
檢查後發現可能是因為斷電後重複執行lock_byte(0xFBFF)=0xFE導致Reset
這樣的狀況是正常的嗎。

TOP

hi!
1. 寫入flash lock byte之後要在下一次reset之後lock byte才有作用.所以也要檢查lock byte是否寫對要lock page的位置.

2.
在spec中有對flash lock byte的使用限制說明
Accessing FLASH from user firmware executing on a locked page:
1. Any unlocked page except the page containing the Lock Byte may be read, written, or erased.
2. Any locked page except the page containing the Lock Byte may be read, written, or erased.
3. The page containing the Lock Byte cannot be erased. It may only be read or written.
4. Reading the contents of the Lock Byte is always permitted.
5. Locking additional pages (changing 1s to 0s in the Lock Byte) is not permitted.
6. Unlocking FLASH pages (changing 0s to 1s in the Lock Byte) is not permitted.
7. The Reserved Area cannot be read, written, or erased. Any attempt to access the reserved area, or any other locked page, will result in a FLASH Error device reset.

TOP

發新話題