cancel
Showing results for 
Search instead for 
Did you mean: 

Embedding option bytes in hex file

nonesuch
Associate

Hi all,

The goal is to embed option bytes in hexfile, such that when production are doing their thing, the correct settings are automagically selected.

But stm32cubeprogrammer fails with:

Error: Data mismatch found at address 0x1FFF781B (byte = 0x00 instead of 0xFF)

(the older st-link utility also fails at the same address, with a similarly-worded error)

This is an STM32L422RB, and the reference manual says:

USER_OPT: 0xFFEF F8AA

PCROP start: 0xFFFF FFFF

PCROP end: 0xFFFF 0000

WRP A: 0xFF00 FFFF

WRP B: 0xFF00 FFFF

reading back the device memory after programming these values, all is well apart from both WRP fields, which read back as 0x0000FFFF, and thus verification fails

What gives? Is the reference manual wrong? Is embedding option bytes no longer the recommended way?

I'm loathe to skip verification, and I have no control over what tools our customer will be using in production.

Any suggestions appreciated!

1 REPLY 1
Pavel A.
Evangelist III

The option byte at 0x1FFF781B is unused, according to RM0394.

0693W00000NpOHFQA3.pngMaybe, program the same value as it reads out (FF or 00).

Same in the bits 63:32 - program the same value in the "unused" bits as they read out.