2023-01-05 05:13 AM
Hello everybody.
I want to ask a question about a project. In my project, when octoSPI and RTC work together, an error occurs (counting incorrectly) in RTC's counting and it starts to count slower, but when I turn off octoSPI, RTC starts counting correctly. What do you think could be the reason?
The processor I am using is STM32h723vet6
2023-01-09 05:17 AM
Hello @Mtopa.1 ,
Check your HyperRam and make sure to configure the memory properly.
You can share your configuration this will help users Community to answer you.
Imen
2023-04-13 01:55 AM
Hello Imen DAHMEN (ST Employee),
My ram configuration is as follows.
i am using APS6408L-3OBM-BA ram
OSPIM_CfgTypeDef OSPIM_Cfg_Struct = {0};
OSPI_RegularCmdTypeDef sCommand;
OSPI_MemoryMappedTypeDef sMemMappedCfg = {0};
OSPIHandle.Instance = OCTOSPI1;
HAL_OSPI_DeInit(&OSPIHandle);
OSPIM_Cfg_Struct.ClkPort = 1;
OSPIM_Cfg_Struct.DQSPort = 1;
OSPIM_Cfg_Struct.NCSPort = 1;
OSPIM_Cfg_Struct.IOLowPort = HAL_OSPIM_IOPORT_1_LOW;
OSPIM_Cfg_Struct.IOHighPort = HAL_OSPIM_IOPORT_1_HIGH;
if (HAL_OSPIM_Config(&hospi1, &OSPIM_Cfg_Struct, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
OSPIHandle.Init.FifoThreshold = 1;
OSPIHandle.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;
OSPIHandle.Init.MemoryType = HAL_OSPI_MEMTYPE_APMEMORY;
OSPIHandle.Init.DeviceSize = 23; /* 256 MBits */
OSPIHandle.Init.ChipSelectHighTime = 1;
OSPIHandle.Init.FreeRunningClock = HAL_OSPI_FREERUNCLK_DISABLE;
OSPIHandle.Init.ClockMode = HAL_OSPI_CLOCK_MODE_0;
OSPIHandle.Init.WrapSize = HAL_OSPI_WRAP_NOT_SUPPORTED;
OSPIHandle.Init.ClockPrescaler = 2;//3;
OSPIHandle.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_NONE;
OSPIHandle.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_ENABLE;
OSPIHandle.Init.ChipSelectBoundary = 10;
OSPIHandle.Init.FreeRunningClock = HAL_OSPI_FREERUNCLK_ENABLE;
OSPIHandle.Init.DelayBlockBypass = HAL_OSPI_DELAY_BLOCK_USED;//HAL_OSPI_DELAY_BLOCK_BYPASSED;
OSPIHandle.Init.Refresh = 0xFFFF;
if (HAL_OSPIM_Config(&OSPIHandle, &OSPIM_Cfg_Struct, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
if (HAL_OSPI_Init(&OSPIHandle) != HAL_OK) {
Error_Handler();
}
if (HAL_OSPI_Init(&OSPIHandle) != HAL_OK)
{
Error_Handler() ;
}
__HAL_OSPI_DISABLE(&OSPIHandle);
HAL_Delay(100);
CLEAR_BIT(OSPIHandle.Instance->DCR1, OCTOSPI_DCR1_FRCK);
__HAL_OSPI_ENABLE(&OSPIHandle);
HAL_Delay(1000);
sCommand=read_reg(sCommand);
if (HAL_OSPI_Command(&OSPIHandle, &sCommand, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
if (HAL_OSPI_Receive(&OSPIHandle, MR_R, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
//-----------write Register------------
sCommand=write_reg(sCommand);
if (HAL_OSPI_Command(&OSPIHandle, &sCommand, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
if (HAL_OSPI_Transmit(&OSPIHandle, MR_write, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
sCommand.Instruction = WRITE_CMD_SRAM;
sCommand.OperationType = HAL_OSPI_OPTYPE_WRITE_CFG;
sCommand.NbData = 10;
sCommand.DummyCycles = DUMMY_CLOCK_CYCLES_SRAM_WRITE;
if (HAL_OSPI_Command(&OSPIHandle, &sCommand, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
Error_Handler();
}
sCommand.OperationType = HAL_OSPI_OPTYPE_READ_CFG;
sCommand.Instruction = READ_CMD_SRAM;
sCommand.DummyCycles = DUMMY_CLOCK_CYCLES_SRAM_READ;
if (HAL_OSPI_Command(&OSPIHandle, &sCommand, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
Error_Handler();
}
sMemMappedCfg.TimeOutActivation = HAL_OSPI_TIMEOUT_COUNTER_DISABLE;
if (HAL_OSPI_MemoryMapped(&OSPIHandle, &sMemMappedCfg) != HAL_OK) {
Error_Handler();
}