From a27118a42877deac36c3a742be0232eecea709d8 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Sun, 11 Oct 2026 02:47:05 +0200 Subject: [PATCH] flash: add the dummy cycles required by the security register read Opcode 0x48 outputs 8 dummy clocks between the address and the first data byte. flash_configure_sio() sets DUMMYCYCLES to 0 and flash_read_security() never raises it, so the controller captures the dummy slot as the first of its four data bytes while the address still advances by four. The printed output therefore shows 0xff in place of every fourth byte and skips one content byte per transfer. flash_read_uid() already sets DUMMYCYCLES for opcode 0x4b, which needs the same allowance. --- rtl837x_flash.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rtl837x_flash.c b/rtl837x_flash.c index c1357b04..1c2f65fc 100644 --- a/rtl837x_flash.c +++ b/rtl837x_flash.c @@ -269,6 +269,7 @@ void flash_read_security(void) // Set slow read mode SFR_FLASH_CMD_R = CMD_READ_SECURITY_REGS; // read security register + SFR_FLASH_DUMMYCYCLES = 8; // Transfer 4 bytes (command + 3byte address) SFR_FLASH_TCONF = 4;