This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

QSPI and w25q64fv flash

Hi all. I try to configure QSPI example to work with w25q64fv flash. I connected all pins from flash to same pins on nRF as on PCA10056 DK board. After all i have "Data inconsistent" message.  I looked in to data array from flash and in it every element was equal to 0x88. I have a couple questions about how to configure driver to work with my flash and how to configure nrfx_qspi_cinstr_xfer function configuration structure.

static void configure_memory()
{
    uint8_t temporary[2] = {0x00, 0x02};
		uint8_t rx_buf[3];
    uint32_t err_code;
    nrf_qspi_cinstr_conf_t cinstr_cfg = {
        .opcode    = QSPI_STD_CMD_RSTEN,
        .length    = NRF_QSPI_CINSTR_LEN_1B,
        .io2_level = true,
        .io3_level = true,
        .wipwait   = true,
        .wren      = true
    };

    // Send reset enable
    err_code = nrf_drv_qspi_cinstr_xfer(&cinstr_cfg, NULL, NULL);
    APP_ERROR_CHECK(err_code);

    // Send reset command
    cinstr_cfg.opcode = QSPI_STD_CMD_RST;
    err_code = nrf_drv_qspi_cinstr_xfer(&cinstr_cfg, NULL, NULL);
    APP_ERROR_CHECK(err_code);
		
		cinstr_cfg.opcode =	QSPI_STD_CMD_JID;
		cinstr_cfg.length = NRF_QSPI_CINSTR_LEN_4B;
		
		err_code = nrf_drv_qspi_cinstr_xfer(&cinstr_cfg, NULL, rx_buf);
		APP_ERROR_CHECK(err_code);
		
		
		SEGGER_RTT_printf(0, "ID = %x%x%x\r\n", rx_buf[0], rx_buf[1], rx_buf[2]);
		
//    // Switch to qspi mode
    cinstr_cfg.opcode = QSPI_STD_CMD_WRSR;
    cinstr_cfg.length = NRF_QSPI_CINSTR_LEN_3B;
    err_code = nrf_drv_qspi_cinstr_xfer(&cinstr_cfg, temporary, NULL);
    APP_ERROR_CHECK(err_code);
		
}

If i connect logic analyzer to IO0 pin i always get NRFX_ERROR_TIMEOUT err code.

Parents Reply Children
  • I started with the qspi example code.

    Here is the config (we are using a custom board):

      nrfx_qspi_config_t config = {                                                                       
        .xip_offset  = NRFX_QSPI_CONFIG_XIP_OFFSET,                         
        .pins = {                                                           
          .sck_pin     = NRF_GPIO_PIN_MAP(0,22),                                
          .csn_pin     = NRF_GPIO_PIN_MAP(0,26),                                
          .io0_pin     = NRF_GPIO_PIN_MAP(0,20),                                
          .io1_pin     = NRF_GPIO_PIN_MAP(0,24),                                
          .io2_pin     = NRF_GPIO_PIN_MAP(1,00),                                
          .io3_pin     = NRF_GPIO_PIN_MAP(0,15),                                
        },                                                                  
        .irq_priority   = 7,           
        .prot_if = {                                                        
            .readoc     = NRF_QSPI_READOC_READ4IO,       
            .writeoc    = NRF_QSPI_WRITEOC_PP4O,     
            .addrmode   = NRF_QSPI_ADDRMODE_24BIT,   
            .dpmconfig  = false,                                            
        },                                                                  
        .phy_if = {                                                         
            .sck_freq   = NRF_QSPI_FREQ_32MDIV2, 
            .sck_delay  = 1,              
            .spi_mode   = NRF_QSPI_MODE_0,       
            .dpmen      = false                                             
        },                                                                  
      };
    

    And I just skipped the configure_memory function, since the power-on defaults for our part (W25Q128JV) seem to work just fine.
    From a quick look at nrf_qspi.h, the problem with WRITEOC=3 seems to be that the opcode is 0x38, which on winbond is "Enter QPI mode", but for the Macronix part on the DK, it's "4PP" (quad page program).
  • Thanks a lot , I was able to make it work with WRITEOC=2 as well. This is good for my evaluation and hardware tick-off.

Related