2019-04-24 01:28 AM
I am using the eval board STM32L4R9I-EVAL.
The generated code failde in OCTOSPI1_Init/ HAL_OSPI_AutoPolling:
it runs by
if ((hospi->State == HAL_OSPI_STATE_CMD_CFG) && (cfg->AutomaticStop == HAL_OSPI_AUTOMATIC_STOP_ENABLE))
{
.....
}
else
{
..........
}
into HAL_Error.
does any one know why?
CubeMX: V5.1.0
Package for STM32L4: V1.13.0
Octospi2 on Hyperram works fine.
2019-04-24 01:39 AM
the OCTOSPI1 in CubeMX Config:
2019-04-24 01:40 AM
2019-04-24 06:09 AM
Hello @Leo_Panda ,
Have a look to the STM32L4Rxxx Errata sheet to check if you have the same conditions as described in the 2.7 OCTOSPI section.
You can share your ioc file or code and provide more details to let community users helping you.
Regards,
Imen
2019-04-24 07:19 AM
Using L4R9I-EVAL Board. cubemx generate the ini cod for OCTOSPI1:
static void MX_OCTOSPI1_Init(void)
{
/* USER CODE BEGIN OCTOSPI1_Init 0 */
/* USER CODE END OCTOSPI1_Init 0 */
OSPIM_CfgTypeDef OSPIM_Cfg_Struct = {0};
OSPI_AutoPollingTypeDef cfg = {0};
/* USER CODE BEGIN OCTOSPI1_Init 1 */
/* USER CODE END OCTOSPI1_Init 1 */
/* OCTOSPI1 parameter configuration*/
hospi1.Instance = OCTOSPI1;
hospi1.Init.FifoThreshold = 4;
hospi1.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;
hospi1.Init.MemoryType = HAL_OSPI_MEMTYPE_MACRONIX;
hospi1.Init.DeviceSize = 25;
hospi1.Init.ChipSelectHighTime = 4;
hospi1.Init.FreeRunningClock = HAL_OSPI_FREERUNCLK_DISABLE;
hospi1.Init.ClockMode = HAL_OSPI_CLOCK_MODE_0;
hospi1.Init.WrapSize = HAL_OSPI_WRAP_NOT_SUPPORTED;
hospi1.Init.ClockPrescaler = 1;
hospi1.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_NONE;
hospi1.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_DISABLE;
hospi1.Init.ChipSelectBoundary = 0;
if (HAL_OSPI_Init(&hospi1) != HAL_OK)
{
Error_Handler();
}
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();
}
cfg.Match = 2;
cfg.Mask = 2;
cfg.MatchMode = HAL_OSPI_MATCH_MODE_AND;
cfg.AutomaticStop = HAL_OSPI_AUTOMATIC_STOP_ENABLE;
cfg.Interval = 0x10;
if (HAL_OSPI_AutoPolling(&hospi1, &cfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
if (HAL_OSPI_AutoPolling_IT(&hospi1, &cfg) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN OCTOSPI1_Init 2 */
/* USER CODE END OCTOSPI1_Init 2 */
The call to HAL_OSPI_AutoPolling (line 87) runs into error.
Attached is the ioc file
2019-04-25 03:14 AM
Hello @Leo_Panda,
We cannot reproduce your issue and your code is passed in OCTOSPI1_Init/HAL_OSPI_AutoPolling.
You can check with OSPI examples available within STM32CubeL4 Cube firmware package to identify if the problem here seems related to your hardware used: STM32Cube_FW_L4_V1.14.0\Projects\STM32L4R9I-EVAL\Examples\OSPI
Regards,
Imen
2019-04-25 05:01 AM
Dear Imen,
as i mentioned in my posting, i used the CubeMX: V5.1.0 and the Package for STM32L4: V1.13.0. and it was no newer version there. As I now saw your anwser, i checked the update again and see there is a new version of cubemx v5.2.
I guess if i update the cubemx, i'll get the l4 package V1.14 and will check if the init will success.
thanks anyway!
best regards
2019-04-25 05:18 AM
Hello,
Your attached code is successfully generated when checked it using CubeMX V5.1.0 and STM32CubeL4 V1.13.0.
You can check the new versions, then keep us informed about your progress.
Regards,
Imen
2019-04-25 07:29 AM
Dear Imen,
after donwload the cubemx 5.2 and package L4.1.14, the error remains. could you send me your generated code? I need only the project source code.
I test it now with a blank new STM32L4R9I-EVAL Board and without any modification of the code generated from cubemx. Since the standard Error-Handler() is an empty function, one have step into it, otherwise it runs through without any warnings!
With original code it runs into error even in MX_OCTOSPI2_Init / HAL_OSPI_MemoryMapped, but this is a known bug. HAL_OSPI_MemoryMapped() will be called after hyperbus is configured (call HAL_OSPI_HyperbusCfg) and the memory-mapped mode i configured (call HAL_OSPI_HyperbusCmd
with
sCommand.AddressSpace = HAL_OSPI_MEMORY_ADDRESS_SPACE;
sCommand.AddressSize = HAL_OSPI_ADDRESS_32_BITS;
sCommand.DQSMode = HAL_OSPI_DQS_ENABLE;
sCommand.Address = 0;
sCommand.NbData = 1;)
I wonder why it is still not changed in the new Package L4.1.14
thanks and regards
2019-04-25 08:10 AM
Have you checked if you have the same problem with the working examples under STM32CubeL4?
STM32Cube_FW_L4_V1.14.0\Projects\STM32L4R9I-EVAL\Examples\OSPI
Regards,
Imen