STM32F7 3 Embedded Flash memory (FLASH)

Started by tha, October 05, 2022, 07:22:52 AM

Previous topic - Next topic

tha

3.7.3 Flash option key register (FLASH_OPTKEYR)

The Flash option key register ถูกใช้เพื่ออนุญาตให้ program and erase operations ใน the information block.

Address offset: 0x08
Reset value: 0x0000 0000
Access: no wait state, word access



Bits 31:0 OPTKEYR[31:0]: Option byte key
     ค่าต่อไปนี้ต้องถูกโปรแกรมอย่างต่อเนื่องเพื่อปลดล็อค the FLASH_OPTCR register และอนุญาตให้โปรแกรมมัน:
     a) OPTKEY1 = 0x08192A3B
     b) OPTKEY2 = 0x4C5D6E7F

tha

3.7.4 Flash status register (FLASH_SR)

The Flash status register ให้ information เกี่ยวกับ program and erase operations ที่กำลังดำเนินการอยู่.

Address offset: 0x0C
Reset value: 0x0000 0000
Access: no wait state, word, half-word and byte access



Bits 31:17 Reserved, must be kept cleared.

Bit 16 BSY: Busy
     บิตนี้แสดงให้เห็นว่า a Flash memory operation กำลังดำเนินการอยู่. มันถูกเซ็ตที่จุดเริ่มต้นของ a Flash memory operation และ
     ถูกเคลียร์เมื่อ the operation สำเร็จลงหรือ an error เกิดขึ้น.
     0: ไม่มี Flash memory operation กำลังดำเนินการอยู่
     1: Flash memory operation กำลังดำเนินการอยู่

Bits 15:8 Reserved, must be kept cleared.

Bit 7 ERSERR: Erase Sequence Error
     ถูกเซ็ตโดย hardware เมื่อ a write เข้าถึงไปยัง the Flash memory ถูกดำเนินการโดย the code ในขณะที่ the control
     register ไม่ได้ถูกกำหนดค่าอย่างถูกต้องไว้.
     ถูกเคลียร์โดยการเขียน 1.

Bit 6 PGPERR: Programming parallelism error
     ถูกเซ็ตโดย hardware เมื่อขนาดของ the access (byte, half-word, word, double word) ในระหว่าง the program
     sequence ไม่ตรงกันกับ the parallelism configuration PSIZE (x8, x16, x32, x64).
     ถูกเคลียร์โดยการเขียน 1.

Bit 5 PGAERR: Programming alignment error
     ถูกเซ็ตโดย hardware เมื่อ the data ไปยัง program ไม่สามารถถูกบรรจุใน the same 128-bit Flash memory row.
     ถูกเคลียร์โดยการเขียน 1.

Bit 4 WRPERR: Write protection error
     ถูกเซ็ตโดย hardware เมื่อ an address ที่จะถูกลบ/โปรแกรมเป็นของ a write-protected part ของ the Flash memory.
     ถูกเคลียร์โดยการเขียน 1.

Bits 3:2 Reserved, must be kept cleared.

Bit 1 OPERR: Operation error
     ถูกเซ็ตโดย hardware เมื่อ a flash operation (programming / erase /read) request ถูกตรวจพบและไม่สามารถถูกรัน
     เนื่องจาก parallelism, alignment, หรือ write protection error. บิตนี้ถูกเซ็ตเฉพาะถ้า error interrupts ถูกเปิดใช้งาน (ERRIE
     = 1).

Bit 0 EOP: End of operation
     ถูกเซ็ตโดย hardware เมื่ออย่างน้อยหนึ่ง Flash memory operations (program/erase) สำเร็จเสร็จสมบูรณ์แล้ว. มันถูกเซ็ต
     เฉพาะถ้า the end of operation interrupts ถูกเปิดใช้งาน (EOPIE =1).
     ถูกเคลียร์โดยการเขียน 1.

tha

3.7.5 Flash control register (FLASH_CR)

The Flash control register ถูกใช้เพื่อกำหนดค่าและสตาร์ท Flash memory operations.

Address offset: 0x10
Reset value: 0x8000 0000
Access: ไม่มี wait state เมื่อไม่มี Flash memory operation กำลังดำเนินการอยู่, word, half-word and byte access.



Bit 31 LOCK: Lock
     เขียนเป็น 1 เท่านั้น. เมื่อมันถูกเซ็ต, บิตนี้แสดงให้เห็นว่า the FLASH_CR register ถูกล็อค. มันถูกเคลียร์โดย hardware หลังจาก
     ตรวจพบ the unlock sequence.
     ในกรณีของ an unsuccessful unlock operation, บิตนี้ยังคง set จนกว่า the next reset.

Bits 30:26 Reserved, must be kept cleared.

Bit 25 ERRIE: Error interrupt enable
     บิตนี้เปิดใช้งาน the interrupt generation เมื่อ the OPERR bit ใน the FLASH_SR register ถูกเซ็ตเป็น 1.
     0: Error interrupt generation ถูกปิดใช้งาน
     1: Error interrupt generation ถูกเปิดใช้งาน

Bit 24 EOPIE: End of operation interrupt enable
     บิตนี้เปิดใช้งาน the interrupt generation เมื่อ the EOP bit .o the FLASH_SR register ไปเป็น 1.
     0: Interrupt generation ถูกปิดใช้งาน
     1: Interrupt generation ถูกเปิดใช้งาน

Bits 23:17 Reserved, must be kept cleared.

Bit 16 STRT: Start
     บิตนี้จะทริก an erase operation เมื่อ set. มันถูกเซ็ตเฉพาะโดย software และถูกเคลียร์เมื่อ the BSY bit ถูกเคลียร์.

Bits 15:10 Reserved, must be kept cleared.

Bits 9:8 PSIZE: Program size
     บิตเหล่านี้เลือก the program parallelism.
     00 program x8
     01 program x16
     10 program x32
     11 program x64

Bit 7 Reserved, must be kept cleared.

Bits 6:3 SNB[3:0]: Sector number
     บิตเหล่านี้เลือก the sector ที่จะลบ.
     0000 sector 0
     0001 sector 1
     ...
     0111 sector 7
     อื่นๆไม่ได้รับการอนุญาต

Bit 2 MER: Mass Erase
     การลบถูกทำให้ทำงานสำหรับทุก user sectors.

Bit 1 SER: Sector Erase
     Sector Erase ถูกทำให้ทำงาน.

Bit 0 PG: Programming
     Flash programming ถูกทำให้ทำงาน


tha

3.7.6 Flash option control register (FLASH_OPTCR)

The FLASH_OPTCR register ถูกใช้ในการแก้ไข the user option bytes.

Address offset: 0x14
Reset value: 0xC0FFAAFD. The option bytes ถูกโหลดด้วยค่าจาก Flash memory ที่การปลดปล่อยรีเซ็ต.
Access: ไม่มี wait state เมื่อไม่มี Flash memory operation กำลังดำเนินการอยู่, word, half-word and byte access.



Bit 31 IWDG_STOP: Independent watchdog counter freeze in Stop mode
     0: แช่แข็ง IWDG counter ใน STOP mode.
     1: IWDG counter ทำงานใน STOP mode.

Bit 30 IWDG_STDBY: Independent watchdog counter freeze in standby mode
     0: แช่แข็ง IWDG counter ใน standby mode.
     1: IWDG counter ทำงานใน standby mode.

Bits 29:24 Reserved, must be kept cleared.

Bits 23:16 nWRP[7:0]: Not write protect
     บิตเหล่านี้บรรจุค่าของ the write-protection option bytes สำหรับ sectors 0 ถึง 7 หลังจากรีเซ็ต. พวกมันสามารถถูกเขียนเพื่อ
     โปรแกรม a new write-protect ลงใน Flash memory.
     0: Write protection ทำงานบน sector i
     1: Write protection ไม่ทำงานบน sector i

Bits 15:8 RDP[7:0]: Read protect
     บิตเหล่านี้บรรจุค่าของ  the read-protection option level หลังจากรีเซ็ต. พวกมันสามารถถูกเขียนเพื่อโปรแกรม a new read
     protection value ลงใน Flash memory.
     0xAA: Level 0, read protection ไม่ทำงาน
     0xCC: Level 2, chip read protection ทำงาน
     อื่นๆ: Level 1, read protection of memories ทำงาน

tha

Bits 7:4 USER: User option bytes
     บิตเหล่านี้บรรจุค่าของ the user option byte หลังจากรีเซ็ต. พวกมันสามารถถูกเขียนเพื่อโปรแกรม a new user option byte value
     ลงใน Flash memory.
     Bit 7: nRST_STDBY
     Bit 6: nRST_STOP
     Bit 5: IWDG_SW
     Bit 4: WWDG_SW

Bits 3:2 BOR_LEV[1:0]: BOR reset Level
     บิตเหล่านี้บรรจุ the supply level threshold ที่ทำให้ทำงาน/ปลดปล่อย the reset. พวกมันสามารถถูกเขียนเพื่อโปรแกรม a new
     BOR level. โดยค่าเริ่มต้น, BOR จะถูกปิด. เมื่อ the supply voltage (VDD) ดร็อปลงต่ำกว่า the selected BOR level, a device
     reset จะถูกสร้าง.
     00: BOR Level 3 (VBOR3), brownout threshold level 3
     01: BOR Level 2 (VBOR2), brownout threshold level 2
     10: BOR Level 1 (VBOR1), brownout threshold level 1
     11: BOR ปิด, POR/PDR reset threshold level ถูกใช้งาน
  Note: สำหรับรายละเอียดเต็มเกี่ยวกับ BOR characteristics, ดูที่ the "Electrical characteristics" section ของ the product
            datasheet.


Bit 1 OPTSTRT: Option start
     บิตนี้จะทริก a user option operation เมื่อเซ็ต. มันถูกเซ็ตเฉพาะโดย software และเคลียร์เมื่อ the BSY bit ถูกเคลียร์.

Bit 0 OPTLOCK: Option lock
     เขียนเป็น 1 เท่านั้น. เมื่อมันถูกเซ็ต, มันแสดงให้เห็นว่า the FLASH_OPTCR register ถูกล็อค. บิตนี้ถูกเคลียร์โดย hardware หลัง
     จากตรวจพบ the unlock sequence.
     ในกรณีของ an unsuccessful unlock operation, บิตนี้ยังคง set จนกว่า the next reset.

Note: เมื่อแก้ไข the IWDG_SW, IWDG_STOP or IWDG_STDBY option byte, a system reset ถูกต้องการเพื่อทำให้การ
          เปลี่ยนแปลงเป็นผล.

tha

3.7.7 Flash option control register (FLASH_OPTCR1)

The FLASH_OPTCR1 register ถูกใช้ในการแก้ไข the user option bytes.

Address offset: 0x18
Reset value: 0x0040 0080 (ITCM-FLASH). The option bytes ถูกโหลดด้วยค่าจาก Flash memory ที่การปลดปล่อยรีเซ็ต.
Access: ไม่มี wait state เมื่อไม่มี Flash memory operation กำลังดำเนินการอยู่, word, half-word and byte access.



Bits 31:16 BOOT_ADD1[15:0]: Boot base address when Boot pin =1
     BOOT_ADD1[15:0] ตรงกันกับ address [29:14],
     The boot memory address สามารถถูกโปรแกรมไปยัง address ใดๆในช่วง 0x0000 0000 ถึง 0x2004 FFFF ด้วยความละเอียด
     16KB.
     Example:
     BOOT_ADD1 = 0x0000: Boot from ITCM RAM (0x0000 0000)
     BOOT_ADD1 = 0x0040: Boot from System memory bootloader (0x0010 0000)
     BOOT_ADD1 = 0x0080: Boot from Flash on ITCM interface (0x0020 0000)
     BOOT_ADD1 = 0x2000: Boot from Flash on AXIM interface (0x0800 0000)
     BOOT_ADD1 = 0x8000: Boot from DTCM RAM (0x2000 0000)
     BOOT_ADD1 = 0x8004: Boot from SRAM1 (0x2001 0000)
     BOOT_ADD1 = 0x8013: Boot from SRAM2 (0x2004 C000)

Bits 15:0 BOOT_ADD0[15:0]: Boot base address when Boot pin =0
     BOOT_ADD0[15:0] ตรงกันกับ  address [29:14],
     The boot base address สามารถถูกโปรแกรมไปยัง address ใดๆในช่วง 0x0000 0000 ถึง 0x2004 FFFF ด้วยความละเอียด
     16KB.
     Example:
     BOOT_ADD0 = 0x0000: Boot from ITCM RAM (0x0000 0000)
     BOOT_ADD0 = 0x0040: Boot from System memory bootloader (0x0010 0000)
     BOOT_ADD0 = 0x0080: Boot from Flash on ITCM interface (0x0020 0000)
     BOOT_ADD0 = 0x2000: Boot from Flash on AXIM interface (0x0800 0000)
     BOOT_ADD0 = 0x8000: Boot from DTCM RAM (0x2000 0000)
     BOOT_ADD0 = 0x8004: Boot from SRAM1 (0x2001 0000)
     BOOT_ADD0 = 0x8013: Boot from SRAM2 (0x2004 C000)

tha