Unable to disable write protection on an STM32G431K using CubeProgrammer
I am trying to disable the write protection on an STM32G431K (on a Nucleo-G431KB) by settings the option bytes using CubeProgrammer:

However, “Apply” fails with the log showing:
11:14:40:365 : Option byte command : -ob WRP1A_STRT=0x3f WRP1A_END=0x0
11:14:40:367 : qCmd : -ob WRP1A_STRT=0x3f WRP1A_END=0x0
11:14:40:367 : PROGRAMMING OPTION BYTES AREA ...
11:14:40:368 : Database: Config 0 is active.
11:14:40:368 : Bank : 0x00
11:14:40:368 : Address : 0x40022020
11:14:40:368 : Size : 84 Bytes
11:14:40:373 : halt ap 0
11:14:40:381 : Loader write option bytes...
11:14:40:381 : Init flashloader...
11:14:40:381 : halt ap 0
11:14:40:389 : run ap 0
11:14:40:390 : halt ap 0
11:14:40:396 : run ap 0
11:14:40:420 : Reconnecting...
11:14:41:549 : ST-LINK SN : 001900363133511236303739
11:14:41:549 : ST-LINK FW : V3J17M10
11:14:41:549 : Board : NUCLEO-G431KB
11:14:41:550 : Voltage : 3.27V
11:14:41:739 : Error: Unable to get core ID
11:14:41:739 : Error: Cannot connect to access port 0! If you are trying to connect to a device with TrustZone enabled please try to connect with HotPlug mode. If you are trying to connect to a device which supports Debug Authentication with certificate or password, please open your device using it.
<Above repeated a number of times>
11:14:44:357 : ...retrying...
11:14:44:689 : Error: failed to reconnect after reset !
11:14:44:996 : Error: Database: There's no active configuration for this device. All the 3 configurations are disabled!
11:14:45:007 : Error: Unable to reconnect after setting the Option Bytes
11:14:45:688 : Error: Unable to get core ID
11:14:45:689 : Error: Unable to get core ID
11:14:45:690 : Warning: Connection to device 0x468 is lost
11:14:45:715 : Disconnected
11:14:45:715 : Disconnected from device.
11:14:45:717 : Selected loader: C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin/ExternalLoader/MX25LM51245G_STM32H7B3I-DISCO.stldr
11:14:45:718 : External loader C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin/ExternalLoader/MX25LM51245G_STM32H7B3I-DISCO.stldr is loaded
I then need to power cycle the board to reconnect, and the WRP1A register has not been changed.
Readout protection is not set (level 0) and PCPROP is not active.
Any idea what’s going on here?
