GigaDevice GD32H7 Option Bytes Programming
Jump to navigation
Jump to search
GigaDevice GD32H7 option bytes programming and SPC locking/unlocking features are implemented in the PCode_DevPro_GigaDevice_GD32H7.pex script file.
Important notes
- For the correct operation, the nRESET signal must be connected.
- Performing SPC level 1 unlocking starts regression sequence. Flash memory is completely erased in this case.
- Setting SPC to level 2 permanently locks the device. No unlock/regression possible.
- After option bytes write operation, the target device must be power-cycled.
Usage
DevPro -operation [operation_name] -if SWD -speed 4000 [parameter_name=value] -ScriptFile PCode_DevPro_GigaDevice_GD32H7.pex
Operation | Parameters | Values | Description |
---|---|---|---|
ReadOptionBytes | OptionName | FMC_OBSTAT0 | Read Option byte status register 0. |
FMC_OBSTAT1 | Read Option byte status register 1. | ||
FMC_DCRPADDR | Read DCRP address register. | ||
FMC_SCRADDR | Read Secure address register. | ||
FMC_WP | Read Erase/program protection register. | ||
FMC_BTADDR | Read Boot address register. | ||
WriteOptionBytes | OptionName | FMC_OBSTAT0 | Write Option byte status register 0. |
FMC_OBSTAT1 | Write Option byte status register 1. | ||
FMC_DCRPADDR | Write DCRP address register. | ||
FMC_SCRADDR | Write Secure address register. | ||
FMC_WP | Write Erase/program protection register. | ||
FMC_BTADDR | Write Boot address register. | ||
Value | 0xXXXXXXXX | 32-bit value to be written to the register specified in "OptionName" parameter. |
Detailed description
ReadOptionBytes
- Reads and prints out description of the selected option-byte register.
WriteOptionBytes
- Writes selected option-byte register. Using hex value is recommended.
Note:
Writing FMC_OBSTAT0 register is used to lock device. The SPC[7:0] bits represent device locking level:
Value 0xAA - Device not locked
Value 0xBB or other than 0xAA or 0xCC - Level 1 protection
Value 0xCC - Level 2 protection
Writing FMC_OBSTAT0 register is used to lock device. The SPC[7:0] bits represent device locking level:
Value 0xAA - Device not locked
Value 0xBB or other than 0xAA or 0xCC - Level 1 protection
Value 0xCC - Level 2 protection
Examples
Reading option bytes register:
DevPro -operation ReadOptionBytes -if SWD -speed 4000 -SetConfigVal "OptionName=FMC_OBSTAT0" -ScriptFile "PCode_DevPro_GigaDevice_GD32H7.pex" SEGGER Device Provisioner V7.96l Compiled Jun 12 2024 18:55:19 'q' to quit '?' for help Command line: -operation ReadOptionBytes -if SWD -speed 4000 -SetConfigVal OptionName=FMC_OBSTAT0 -ScriptFile PCode_DevPro_GigaDevice_GD32H7.pex Opened script file: 'PCode_DevPro_GigaDevice_GD32H7.pex' J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: FMC_OBSTAT0 value: 0x01C6AAD0 J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: BOR threshold value BOR_TH[1:0]: 0x00000000 J-Link log: |-> BOR threshold value 3 J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: Watchdog value nWDG_HW: 0x00000001 J-Link log: |-> Software free watchdog J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: Deepsleep reset value nRST_DPSLP: 0x00000001 J-Link log: |-> No reset when entering Deep-sleep mode J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: Standby reset value nRST_STDBY: 0x00000001 J-Link log: |-> No reset when entering standby mode J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: Security Protection code SPC[7:0]: 0x000000AA J-Link log: |-> No security protection J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: FWDGT suspend option in deepsleep mode: 0x00000001 J-Link log: |-> FWDGT is running in system deepsleep mode J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: FWDGT suspend option in standby mode: 0x00000001 J-Link log: |-> FWDGT is running in system standby mode J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: Secure mode: 0x00000000 J-Link log: |-> Disable secure mode J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: ITCM ECC function enable: 0x00000001 J-Link log: |-> Enable CPU ITCM ECC function J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: DTCM0 ECC function enable: 0x00000001 J-Link log: |-> Enable CPU DTCM0 ECC function J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: DTCM1 ECC function enable: 0x00000001 J-Link log: |-> Enable CPU DTCM1 ECC function J-Link log: ----------------------------------------------------------------------------------------------- J-Link log: I/O speed optimization at low-voltage enable: 0x00000000 J-Link log: |-> Chip operating voltage greater than 2.5V, so I/O speed optimization is not allowed
Writing option bytes register (setting SPC level 1 protection):
DevPro -operation WriteOptionBytes -if SWD -speed 4000 -SetConfigVal "OptionName=FMC_OBSTAT0" -SetConfigVal "Value=0x01C6BBD0"-ScriptFile "PCode_DevPro_GigaDevice_GD32H7.pex" SEGGER Device Provisioner V7.96l Compiled Jun 12 2024 18:55:19 'q' to quit '?' for help Command line: -operation WriteOptionBytes -if SWD -speed 4000 -SetConfigVal OptionName=FMC_OBSTAT0 -SetConfigVal Value=0x01C6BBD0 -ScriptFile PCode_DevPro_GigaDevice_GD32H7.pex Opened script file: 'PCode_DevPro_GigaDevice_GD32H7.pex' J-Link log: Option bytes programmed successfully