cancel
Showing results for 
Search instead for 
Did you mean: 

OCTOSPI: HAL_OSPIM_Config()

Marcel3
Visitor

I'm using a STM32U585AIIxQ. The firmware package is: STM32Cube FW_U5 V1.7.0. CubeMX version is 6.13.0.

OCTOSPI1 is configured as Single SPI on port1 and OCTOSPI2 is configured as Quad SPI on port2.

After initialisation only the last initialised OCTOSPI works, because HAL_OSPIM_Config() messes up the P1CR and P2CR registers of the OCTOSPIM.

This problem was mentioned 2 years ago here: https://community.st.com/t5/stm32-mcus-products/stm32-cube-h7-hal-ospim-config-corrupts-previous-port/m-p/126073#M22902

and here:

https://community.st.com/t5/stm32-mcus-embedded-software/stm32cubemx-l4-v1-13-0-hal-ospim-config-corrupts-port/m-p/296420

Why is this still not fixed?

4 REPLIES 4
TDK
Guru

Sometimes things fall through the cracks. Addressing bugs seems to be better in the past couple years.

@Amel NASRI Can you take a look? First thread has a lot of info.

If you feel a post has answered your question, please click "Accept as Solution".
KDJEM.1
ST Employee

Hello @Marcel3 and welcome to the community;

 

Thank you for bringing this issue to our attention. I reported this issue internally.

Could you please to modify these code lines in octospi.c file

 

 

  sOspiManagerCfg.ClkPort = 1;
  sOspiManagerCfg.NCSPort = 1;
  sOspiManagerCfg.IOLowPort = HAL_OSPIM_IOPORT_1_LOW;
  if (HAL_OSPIM_Config(&hospi1, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
  {
    Error_Handler();
  }
  sOspiManagerCfg.ClkPort = 2;
  sOspiManagerCfg.NCSPort = 2;
  sOspiManagerCfg.IOLowPort = HAL_OSPIM_IOPORT_2_LOW;
  if (HAL_OSPIM_Config(&hospi2, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
  {
    Error_Handler();
  }

 

 

by

 

 

  sOspiManagerCfg.ClkPort = 1;
  sOspiManagerCfg.NCSPort = 1;
  sOspiManagerCfg.IOLowPort = HAL_OSPIM_IOPORT_1_LOW;
  sOspiManagerCfg.IOHighPort = HAL_OSPIM_IOPORT_1_HIGH;
  sOspiManagerCfg.DQSPort = 1;
  if (HAL_OSPIM_Config(&hospi1, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
  {
    Error_Handler();
  }

 

 

 

  sOspiManagerCfg.ClkPort = 2;
  sOspiManagerCfg.NCSPort = 2;
  sOspiManagerCfg.IOLowPort = HAL_OSPIM_IOPORT_2_LOW;
  sOspiManagerCfg.IOHighPort = HAL_OSPIM_IOPORT_2_HIGH;
  sOspiManagerCfg.DQSPort = 2;
  if (HAL_OSPIM_Config(&hospi2, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
  {
    Error_Handler();
  }

 

 

Please let me know if the issue is solved or not?

Internal ticket number: 203289 (This is an internal tracking number and is not accessible or usable by customers

Thanks and best regards,

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Marcel3
Visitor

Hi Kaouthar,

Thanks for the quick reply.

If I only add:

  sOspiManagerCfg.IOHighPort = HAL_OSPIM_IOPORT_1_HIGH;

to

  sOspiManagerCfg.ClkPort = 1;
  sOspiManagerCfg.NCSPort = 1;
  sOspiManagerCfg.IOLowPort = HAL_OSPIM_IOPORT_1_LOW;
  if (HAL_OSPIM_Config(&hospi1, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
  {
    Error_Handler();
  }

it seems to work. Will test it further on monday.

KDJEM.1
ST Employee

Hello @Marcel3;

 

This update should be applied for OCTOSPI1 and OCTOSPI2.

I would be pleased to receive your confirmation of the proposed solution.

 

Thank you for your contribution in STCommunity.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.