cancel
Showing results for 
Search instead for 
Did you mean: 

Fails to execute from QSPI Flash but read works

Jeppe Frandsen
Associate

Hi,

I have some issues with executing directly from QSPI with a NUCLEO-F412ZG and a connected Winbond W25Q80DV QuadSPI Flash which we are looking into as a workaround for the component shortage (will be a L4 variant but using a F4 for testing).

Reading the memory after enabling memory mapped work works fine but as soon as we jump from our bootloader to address 0x90000000 everything stops (tried to toggle a pin in SystemInit but does not get this far). We are using Mbed OS but the issue does not seem to be related to this (I can jump from our bootloader to the bootloader address and the QSPI is still accessible so does not seem to be reset). For testing I changed the Flash address in the linker script from 0x8000000 to 0x90000000.

When attaching a debugger it states address 0xe000ed0b. When disabling MPU support in Mbed it states address 0x90000000 but just hangs and variables. Below is the function for enabling memory mapping.

Do you guys have any hints? Have just ordered a STM32L496 DISCOVERY kit which has a QSPI Flash mounted also just to check on a different platform. Thank you very much in advance. All inputs are really appreciated.

qspi_status_t qspi_enable_memory_mode(qspi_t *obj)
{
    QSPI_CommandTypeDef st_command;
    st_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
    st_command.Instruction       = 0xEB;
    st_command.AddressMode       = QSPI_ADDRESS_4_LINES;
    st_command.Address           = 0;
    st_command.AddressSize       = QSPI_ADDRESS_24_BITS;
    st_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
    st_command.DataMode          = QSPI_DATA_4_LINES;
    st_command.DummyCycles       = 10;
    st_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
    st_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
    st_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
    st_command.NbData            = 1;					
 
    QSPI_MemoryMappedTypeDef st_memory;
    st_memory.TimeOutPeriod = 0xFFFF;
    st_memory.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE;
 
    if (HAL_QSPI_MemoryMapped(&obj->handle, &st_command, &st_memory) != HAL_OK) {
        return QSPI_STATUS_ERROR;
    }
 
    return QSPI_STATUS_OK;
}

1 ACCEPTED SOLUTION

Accepted Solutions
Jeppe Frandsen
Associate

I found the issue. Issue was caused by the wrong number of dummy cycles causing the first bytes of the memory mapped area to be wrong and hereby the stack pointer to be totally off (first two bytes missing when using 10 cycles). Reduced to 6 cycles for the QuadSPI Flash and now works.

View solution in original post

1 REPLY 1
Jeppe Frandsen
Associate

I found the issue. Issue was caused by the wrong number of dummy cycles causing the first bytes of the memory mapped area to be wrong and hereby the stack pointer to be totally off (first two bytes missing when using 10 cycles). Reduced to 6 cycles for the QuadSPI Flash and now works.