cancel
Showing results for 
Search instead for 
Did you mean: 

BSP_QSPI_MemoryMappedMode Enable doesn't work with W25QXX

aabba.1
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
aabba.1
Associate III

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;
}
 

View solution in original post

3 REPLIES 3
KDJEM.1
ST Employee

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
aabba.1
Associate III

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;
}