Skip to main content
Explorer II
November 30, 2023
Solved

BSP_QSPI_MemoryMappedMode Enable doesn't work with W25QXX

  • November 30, 2023
  • 3 replies
  • 1676 views

Hi,
I am trying to do a memory map with this board W25QXX and it's not working. For some reason even on the original code we can see the function for BSP_QSPI_MemoryMappedMode have a comment (https://www.waveshare.com/wiki/W25QXX_DataFlash_Board). Any idea why?

I am using this board, with STM32H743IIT the configuration of my QUADSPI is:

aabba1_0-1701326010915.png

aabba1_1-1701326039424.png

    This topic has been closed for replies.
    Best answer by aabba.1

    this should be the implementation:

    uint8_t BSP_QSPI_MemoryMappedMode(void)
    {
    QSPI_CommandTypeDef sCommand;
    QSPI_MemoryMappedTypeDef sMemMappedCfg;
     
    /* Enable Memory-Mapped mode-------------------------------------------------- */
     
    sCommand.InstructionMode    = QSPI_INSTRUCTION_1_LINE;
    sCommand.Instruction        = QUAD_INOUT_FAST_READ_CMD;
    sCommand.AddressSize        = QSPI_ADDRESS_24_BITS;
    sCommand.AddressMode        = QSPI_ADDRESS_4_LINES;
    sCommand.Address            = 0;
    sCommand.AlternateByteMode  = QSPI_ALTERNATE_BYTES_4_LINES;
    sCommand.AlternateBytes     = 0xFF;
    sCommand.AlternateBytesSize = QSPI_ADDRESS_8_BITS;
    sCommand.DdrMode            = QSPI_DDR_MODE_DISABLE;
    sCommand.DdrHoldHalfCycle   = QSPI_DDR_HHC_ANALOG_DELAY;
    sCommand.SIOOMode           = QSPI_SIOO_INST_EVERY_CMD;
    sCommand.DataMode           = QSPI_DATA_4_LINES;
    sCommand.NbData             = 0;
    sCommand.DummyCycles        = 4;
     
    sMemMappedCfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE;
    sMemMappedCfg.TimeOutPeriod = 0;
     
    if (HAL_QSPI_MemoryMapped(&hqspi, &sCommand, &sMemMappedCfg) != HAL_OK) {
    return HAL_ERROR;
    }
    return HAL_OK;
    }
     

    3 replies

    Technical Moderator
    November 30, 2023

    Hello @aabba.1 ,

    For some reason even on the original code we can see the function for BSP_QSPI_MemoryMappedMode have a comment (https://www.waveshare.com/wiki/W25QXX_DataFlash_Board). Any idea why?

    The shared code isn't supported by ST. But, I noted that the TIMEOUT Counter is enabled in the comment code line, and it mentioned in the STM32F746 errata sheet that Memory-mapped read operations may fail when timeout counter is enabled and the workaround is to disable the timeout counter.

    s_mem_mapped_cfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_ENABLE;

     

    To configure QSPI in memory mapped mode using STM32H743 devices, I advise you to start with an available QSPI_MemoryMapped example in STM32CubeH7 package.

    If you using STM32CubeMX toolchain to configure the QUADSPI interface, I recommend you to follow the steps shared in AN4760 precisely section 4. QUADSPI configuration.

    Thank you.

    Kaouthar

    Graduate II
    November 30, 2023

    What's the comment? Imagine I can't get to this on my phone, present better.

    Make the command template work in direct mode, this maps directly to how the memory mapped read works, a template it stuffs an address field into.

    aabba.1AuthorAnswer
    Explorer II
    December 10, 2023

    this should be the implementation:

    uint8_t BSP_QSPI_MemoryMappedMode(void)
    {
    QSPI_CommandTypeDef sCommand;
    QSPI_MemoryMappedTypeDef sMemMappedCfg;
     
    /* Enable Memory-Mapped mode-------------------------------------------------- */
     
    sCommand.InstructionMode    = QSPI_INSTRUCTION_1_LINE;
    sCommand.Instruction        = QUAD_INOUT_FAST_READ_CMD;
    sCommand.AddressSize        = QSPI_ADDRESS_24_BITS;
    sCommand.AddressMode        = QSPI_ADDRESS_4_LINES;
    sCommand.Address            = 0;
    sCommand.AlternateByteMode  = QSPI_ALTERNATE_BYTES_4_LINES;
    sCommand.AlternateBytes     = 0xFF;
    sCommand.AlternateBytesSize = QSPI_ADDRESS_8_BITS;
    sCommand.DdrMode            = QSPI_DDR_MODE_DISABLE;
    sCommand.DdrHoldHalfCycle   = QSPI_DDR_HHC_ANALOG_DELAY;
    sCommand.SIOOMode           = QSPI_SIOO_INST_EVERY_CMD;
    sCommand.DataMode           = QSPI_DATA_4_LINES;
    sCommand.NbData             = 0;
    sCommand.DummyCycles        = 4;
     
    sMemMappedCfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE;
    sMemMappedCfg.TimeOutPeriod = 0;
     
    if (HAL_QSPI_MemoryMapped(&hqspi, &sCommand, &sMemMappedCfg) != HAL_OK) {
    return HAL_ERROR;
    }
    return HAL_OK;
    }