cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading option bytes over DFU

mateijordache
Associate II

Hi, 

I have a custom board using STM32G431CBU6. I am using `dfu-util` to upload firmware and option bytes. I don't have any problem reading/writing flash area with DFU, and I can read the Option Bytes area with DFU, but when I try to upload a valid option bytes file, I get an error that it can't write the last page. I know the file is valid because it was dumped from another board that had option bytes configured by STM32CubeProg. 

The reference for the chip mentions that in order to write Option Bytes that there is a pattern and some registers that have to be addressed. Some questions on that:

  • Does STM32CubeProg apply this patten of register writes in order to program the option bytes? The messages emitted to the console during programming do not suggest this. 
    • The messages emitted to console during option byte flashing in STM32CubeProg actually show a different address than what the reference shows as the option byte memory location (supposed be 0x1FFF7800)
  • Is it possible to do this with a generic DFU flashing tool like `dfu-util`? I don't want to use STM32CubeProg because I want a command line utility that runs natively on MacOS. 

The error given by dfu-util: 

DfuSe interface name: "Option Bytes   "

Downloading element to address = 0x1fff7800, size = 48

dfu-util: Last page at 0x1fff782f is not writeable

 

Thanks,

Matei

1 REPLY 1
mateijordache
Associate II

Nevermind, it seems that there could be some error in the G431 reference. If I just let `dfu-util` read to end of region at 0x1fff7800, it will only produce 40 kbytes rather than the stated 48kbyte. I can read and write this file just fine, there are no problems.