我想用QSPI FLASH 作OTA,选用的是W25Q64,现在对QSPI的读写都正常,但是把QSPI 映射成内存模式,一对 0x9000000UL 进行读,就进入HardFault_Handler, 下面是我配置映射的代码,哪位大侠能帮看看有什么问题没有我芯片是用的
STM32H750VB 用的STM32CUBE
sta
tic unsigned int QSPI_EnableMemoryMappedMode(QSPI_HandleTypeDef *QSPIHandle)
{
QSPI_CommandTypeDef s_command;
QSPI_MemoryMappedTypeDef s_mem_mapped_cfg;
// Configure the command for the read instruction
s_command.InstructionMode = QSPI_INSTRUCTION_1_LINE;
s_command.Instruction = QUAD_INOUT_FAST_READ_CMD;
s_command.Address = 0;
s_command.AddressMode = QSPI_ADDRESS_4_LINES;
s_command.AddressSize = QSPI_ADDRESS_24_BITS;
s_command.AlternateBytes = 0x00;
s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
s_command.AlternateBytesSize = QSPI_ALTERNATE_BYTES_8_BITS;
s_command.DataMode = QSPI_DATA_4_LINES;
s_command.NbData = 1; //???????
s_command.DummyCycles = 6;
s_command.DdrMode = QSPI_DDR_MODE_DISABLE;
s_command.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
s_command.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
// Configure the memory mapped mode
s_mem_mapped_cfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE;
s_mem_mapped_cfg.TimeOutPeriod = 0;
return HAL_QSPI_MemoryMapped(QSPIHandle, s_command, s_mem_mapped_cfg);
}
*/
static unsigned int QSPI_EnableMemoryMappedMode(QSPI_HandleTypeDef *QSPIHandle)
{
QSPI_CommandTypeDef s_command;
QSPI_MemoryMappedTypeDef s_mem_mapped_cfg;
// Configure the command for the read instruction
s_command.InstructionMode = QSPI_INSTRUCTION_4_LINES;
s_command.Instruction = QUAD_INOUT_FAST_READ_CMD;
s_command.Address = 0;
s_command.AddressMode = QSPI_ADDRESS_4_LINES;
s_command.AddressSize = QSPI_ADDRESS_32_BITS; // 24 32 都试过
s_command.AlternateBytes = 0x00;
s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
s_command.AlternateBytesSize = QSPI_ALTERNATE_BYTES_8_BITS;
s_command.DataMode = QSPI_DATA_4_LINES;
s_command.NbData = 1; //???????
s_command.DummyCycles = 6;
s_command.DdrMode = QSPI_DDR_MODE_DISABLE;
s_command.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
s_command.SIOOMode = QSPI_SIOO_INST_EVERY_CMD;
// Configure the memory mapped mode
s_mem_mapped_cfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE;
s_mem_mapped_cfg.TimeOutPeriod = 0;
return HAL_QSPI_MemoryMapped(QSPIHandle, s_command, s_mem_mapped_cfg);
}