From fca69cc702b40b2048b79da77559f6502cbddb30 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sun, 25 Aug 2024 09:34:14 +0200 Subject: [PATCH] spiFlash: added configuration/nonvolatile configuration register for spansion and micron SPI Flash --- src/spiFlash.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/spiFlash.cpp b/src/spiFlash.cpp index 2d5eb5adf..5961e4f3a 100644 --- a/src/spiFlash.cpp +++ b/src/spiFlash.cpp @@ -609,7 +609,7 @@ void SPIFlash::display_status_reg(uint8_t reg) printf("BUSY : %d\n", (reg >> 7) & 0x01); } - /* function register */ + /* function and/or configuration register */ switch (dev_id) { case 0x9d60: _spi->spi_put(FLASH_RDFR, NULL, ®, 1); @@ -631,6 +631,30 @@ void SPIFlash::display_status_reg(uint8_t reg) printf("BPNV : %d\n", ((reg >> 3) & 0x01)); printf("TBPROT : %d\n", ((reg >> 5) & 0x01)); break; + case 0x0160: + _spi->spi_put(FLASH_RDCR, NULL, ®, 1); + printf("\nConfiguration Register\n"); + printf("RDCR : %02x\n", reg); + printf("SUS_D : %d\n", ((reg >> 7) & 0x01)); + printf("CMP_NV : %d\n", ((reg >> 6) & 0x01)); + printf("LB : %d\n", ((reg >> 2) & 0x0f)); + printf("QUAD_NV : %d\n", ((reg >> 1) & 0x01)); + printf("SRP1_D : %d\n", ((reg >> 0) & 0x01)); + break; + case 0x20BA: + uint16_t nv_reg; + _spi->spi_put(FLASH_RDNVCR, NULL, (uint8_t*)&nv_reg, 2); + printf("\nNonvolatile Configuration Register\n"); + printf("RDNVCR : %02x\n", nv_reg); + printf("Dummy Clock Cycles : %d\n", ((nv_reg >> 12) & 0x0f)); + printf("XIP mode at power-on/rst : %d\n", ((nv_reg >> 9) & 0x07)); + printf("Output Driver strength : %d\n", ((nv_reg >> 6) & 0x07)); + /* 5: reserved */ + printf("RST/HLD : %d\n", ((nv_reg >> 4) & 0x01)); + printf("QUAD : %d\n", ((nv_reg >> 3) & 0x01)); + printf("DUAL : %d\n", ((nv_reg >> 2) & 0x01)); + /* 1:0: reserved */ + break; } }