Posts: 13
Joined: Tue Jul 11, 2017 5:24 pm

Writing to OTP registers without rebooting

Thu Oct 11, 2018 5:29 pm

It looks like the advertised way to write to the OTP registers is to insert a special statement into the /boot/config.txt file (such as program_usb_boot_mode=1), and then reboot the Pi. Apparently, something during the boot process sees this magic line in config.txt and performs some other magic to actually write to a bit in one of the OTP registers.

Surely there is an easier way to program an OTP register?

Admittedly, you don't want it to be "too easy" to program the OTP registers, because such programming is irreversible. But surely there is an API (perhaps in the bowels of the VC interface?) that would allow me to program an OTP register by writing a C program and executing it? I searched through all the source at but I can't find anything that writes to OTP registers. (Of course reading the OTP registers is easy).

Any advice on how to program an OTP register without resorting to the contortions of modifying config.txt, rebooting, and restoring config.txt?

User avatar
Posts: 40547
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Writing to OTP registers without rebooting

Fri Oct 12, 2018 6:23 am

You can't do it any other way.

The OTP bits that can be set are set by special code in the firmware. That code only runs at boot time and only reads its commands from /boot/config.txt

On a 3B+ the USB boot bit is set in the factory.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
Posts: 229
Joined: Sun Jun 16, 2013 1:18 pm
Location: Germany
Contact: Website

Re: Writing to OTP registers without rebooting

Sat Oct 13, 2018 1:12 pm

There's also this readme that describes how to write(?) some OTP values. No idea if that's helpful and I didn't try any of the mentioned commands. Proceed with care.
info-beamer hosted - A user and programmer friendly digital signage platform for the Pi:

Return to “Advanced users”