cancel
Showing results for 
Search instead for 
Did you mean: 

Programming OSPI flash of STM32U5G-DK1 in Indirect memory mode

Sudarshan
Associate II

Hello,

I am using STM32U5G-DK1 Discovery kit and need to store a large amount of data in on-board OSPI flash. Now, the example code by STM32 for this kit uses this OPSI flash in Memory-mapped mode. This mode is good to store an small amount of data but time-consuming when writing a large data to this Flash. Therefore, I need to use this Flash in Indirect mode where I can write to flash Page by Page. For this, I use the below configuration of OSPI:

sCommand.OperationType = HAL_OSPI_OPTYPE_COMMON_CFG;
sCommand.Instruction = OCTAL_PAGE_PROG_CMD;

sCommand.InstructionMode = HAL_OSPI_INSTRUCTION_8_LINES;
sCommand.InstructionSize = HAL_OSPI_INSTRUCTION_16_BITS;

sCommand.AddressMode = HAL_OSPI_ADDRESS_8_LINES;
sCommand.AddressSize = HAL_OSPI_ADDRESS_32_BITS;
sCommand.Address = address;

sCommand.DataMode = HAL_OSPI_DATA_8_LINES;
sCommand.NbData = BUFFERSIZE; // :warning: max 256 bytes per page

sCommand.DummyCycles = 0;

sCommand.DQSMode = HAL_OSPI_DQS_ENABLE;
sCommand.SIOOMode = HAL_OSPI_SIOO_INST_EVERY_CMD;

 

if (HAL_OSPI_Command(&hospi1, &sCommand, HAL_MAX_DELAY) != HAL_OK)
{
Error_Handler();
}

 

if (HAL_OSPI_Transmit(&hospi1, aTxBuffer, HAL_MAX_DELAY) != HAL_OK)
{
Error_Handler();
}

OSPI_AutoPollingMemReady(&hospi1);




But immediately after HAL_OSPI_Transmit ():, it stuck  at Error_Handler(). Can you provide me code or tell me how can I write large chunks of data in this OSPI flash ?

With regard,

Sudarshan Chaudhary

0 REPLIES 0