2024-10-24 02:08 AM
I am trying to make a custom external loader for a qspi nor flash. the erase sector and write operation is success but after I tried the read operation the operation is fail the device is disconnected and showing this message
I have tried to run a program like this demo project , the program is working normally and I can read the data . buat after I comment the write section :
if (CSP_QSPI_WriteMemory(buffer_test, var * MEMORY_SECTOR_SIZE,
sizeof(buffer_test)) != HAL_OK) {
Error_Handler();
}
and read the memorry, the device is disonnected and I have restart the device if I want to connect again. any one know why ?, thank you.
Solved! Go to Solution.
2024-10-24 07:17 PM
Exit path for Write() should enable Memory Mapped Mode
2024-10-24 04:15 AM
Will need to drop out of Memory Mapped mode to erase, write and wait for completion, and then switch back to Memory Mapped mode for the tools to Read/Verify the content.
2024-10-24 04:17 AM
Describe the specific parts involved here and the pin usage that connects them.
2024-10-24 06:50 PM
Hello , thank you for the reply. I am using HAL_XSPI_Abort(&hospi1); to exit from memory mapped mode so the code I am running look like this
if (CSP_QUADSPI_Init() != HAL_OK) {
Error_Handler();
}
if (CSP_QSPI_EnableMemoryMappedMode() != HAL_OK) {
Error_Handler();
}
HAL_XSPI_Abort(&hospi1);
the disconnect problem is clear but of course I can't see the data with read memorry fiture on stm32cubeide. if I comment the HAL_XSPI_Abort(&hospi1);, the disconnect problem occurs again after I use the read memory fiture on stm32cubeide.
2024-10-24 07:05 PM
Hello, thank you for the reply. I am using two W25Q128JVPIQ connected with STM32H573IIT3Q. the pin connections are :
FLASH 1,2 CLK -> PA3
FLASH 1,2 IO0 -> PF8
FLASH 1,2 IO1->PF9
FLASH 1,2 IO2 -> PF7
FLASH 1,2 IO3 -> PF6
FLASH 1 NCS -> PB10
FLASH 2 NCS -> PB6
But for now, I am trying to make an external loader for FLASH 1
2024-10-24 07:17 PM
Exit path for Write() should enable Memory Mapped Mode
2024-10-24 07:56 PM - edited 2024-10-24 08:06 PM
This doesn't memory map, but should Erase, Read and Write content
2024-10-24 08:36 PM
Hello thank you for the reply. Sorry I don't understand. Do you mean to add write function before memory mapped mode?. since I don't wanna write anything, I made this function :
uint8_t WriteButNotWrite()
{
XSPI_RegularCmdTypeDef sCommand ={0};
sCommand.OperationType = HAL_XSPI_OPTYPE_COMMON_CFG;
sCommand.IOSelect = HAL_XSPI_SELECT_IO_3_0;
sCommand.InstructionMode = HAL_XSPI_INSTRUCTION_1_LINE;
sCommand.Instruction = QUAD_IN_FAST_PROG_CMD;
sCommand.InstructionWidth = HAL_XSPI_INSTRUCTION_8_BITS;
sCommand.AddressMode = HAL_XSPI_ADDRESS_NONE;
sCommand.AddressWidth = HAL_XSPI_ADDRESS_24_BITS;
sCommand.AlternateBytesMode = HAL_XSPI_ALT_BYTES_NONE;
sCommand.DataDTRMode = HAL_XSPI_DATA_DTR_DISABLE;
// sCommand.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY;
sCommand.SIOOMode = HAL_XSPI_SIOO_INST_EVERY_CMD;
sCommand.DataMode = HAL_XSPI_DATA_NONE;
// sCommand.DataLength = buffer_size;
// sCommand.Address = address;
sCommand.DQSMode = HAL_XSPI_DQS_DISABLE;
sCommand.DummyCycles = 0;
if (QSPI_WriteEnable() != HAL_OK) {
return HAL_ERROR;
}
/* Configure the command */
if (HAL_XSPI_Command(&hospi1, &sCommand, HAL_XSPI_TIMEOUT_DEFAULT_VALUE)
!= HAL_OK) {
return HAL_ERROR;
}
if (QSPI_AutoPollingMemReady() != HAL_OK) {
return HAL_ERROR;
}
return HAL_OK;
}
I don't know what am I doing actually, but after I call this function before enable memory mapped mode, I can read the data. but the problem still ocours if I added to the external loader. maybe I will continue later since your loader works fine. Thank you
2024-10-24 08:38 PM
Thank you so much, I have tried erase, read, write, and verify with your loader, it works fine