Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CM4 stuck in infinite loop if EEPROM write protection is set and firmware upgrade is present #597

Closed
uplogix-mmcclain opened this issue Aug 19, 2024 · 2 comments

Comments

@uplogix-mmcclain
Copy link

Describe the bug

System is stuck in infinite loop when bootloader attempts to upgrade the firmware, but the EEPROM is write protected.

I would expect the bootloader to not attempt a firmware update when the EEPROM is write protected.

276.96 pieeprom.sig
276.96 hash: 7d24337713cf5f617f67fc65accbaf27a69b299669d38a168acdb6bc3a00a098
276.02 ts: 1724092212
276.92 SELF-UPDATE timestamp current 1724092073 new 1724092212 
276.94 Updating bootloader EEPROM
276.17 Reading EEPROM: 524288 bytes 0x00b60000
276.66 347ms
276.00 EEPROM is write protected (bc)
276.01 Reading EEPROM: 524288 bytes 0x00b60000
277.33 628ms
277.68 EEPROM is write protected (bc)
283.91 pieeprom.sig
283.91 hash: 7d24337713cf5f617f67fc65accbaf27a69b299669d38a168acdb6bc3a00a098
283.97 ts: 1724092212
283.87 SELF-UPDATE timestamp current 1724092073 new 1724092212 
283.90 Updating bootloader EEPROM
283.13 Reading EEPROM: 524288 bytes 0x00b60000
283.62 347ms
283.96 EEPROM is write protected (bc)
283.96 Reading EEPROM: 524288 bytes 0x00b60000
284.29 628ms
284.63 EEPROM is write protected (bc)

Steps to reproduce the behaviour

This is with a CM4 and CM4io board.

Add the following to config.txt.

eeprom_write_protect=1

[cm4]
dtparam=spi=on
dtoverlay=audremap
dtoverlay=spi-gpio40-45

Put a jumper across the EEPROM_nWP pin to ground.

Put new pieeprom.upg and pieeprom.sig files in firware directory.

sync and umount the filesystem.

Unplug the power and reconnect.

Below is output from latest firmware 2024/07/30.
This is also broken in the default firmware dated 2023/01/11 and 2024/04/15.
I didn't test any other versions.

Device (s)

Raspberry Pi CM4

Bootloader configuration.

eeprom_write_protect=1

[cm4]
dtparam=spi=on
dtoverlay=audremap
dtoverlay=spi-gpio40-45

System

No response

Bootloader logs

infinite_loop_firmware_20240730.txt
infinite_loop_firmware_20230111.txt

USB boot

No response

NVMe boot

No response

Network (TFTP boot)

No response

@timg236
Copy link
Collaborator

timg236 commented Aug 20, 2024

Sounds like a bug but there's no way for the bootloader to sense the nWP pin directly. Therefore, it will have to try the update at least once before giving up and booting anyway

timg236 added a commit to timg236/rpi-eeprom that referenced this issue Sep 5, 2024
…rotected (latest)

* arm_dt: Consult the hat_map for all HATs
* USB boot - ignore RP2 / RP3 MSD device in BOOTSEL mode.
* recovery.bin - Fix erase_eeprom to not block reboot_recovery
* Fix self-update to continue to boot instead of retrying forever
  if the EEPROM is write protected.
  raspberrypi#597
timg236 added a commit that referenced this issue Sep 5, 2024
…rotected (latest)

* arm_dt: Consult the hat_map for all HATs
* USB boot - ignore RP2 / RP3 MSD device in BOOTSEL mode.
* recovery.bin - Fix erase_eeprom to not block reboot_recovery
* Fix self-update to continue to boot instead of retrying forever
  if the EEPROM is write protected.
  #597
@timg236
Copy link
Collaborator

timg236 commented Oct 17, 2024

Closing as fixed

@timg236 timg236 closed this as completed Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants