cancel
Showing results for 
Search instead for 
Did you mean: 

Two instances of OCTOSPI not working simultaneously on STM32H7A3ZGT

ABricout
Associate III

Hello,

I am developing on the STM32H7A3ZGT and I am trying to use both OCTOSPI instances that are on the microcontroller

I am able to use both of them separately (only initialising one instance) but when I do both the initialization only the last initialised instance is working fine.

I get no errors codes from any function on the first octospi instance that is initialised, but the data that I receive are all "0".

If I switch the init order it switches the instance that is working.

I am working on cube MX V6.6.1 but I tried generating a new project on the latest version and I get the same result

Tank you for your help,

Best regards

Augustin

1 ACCEPTED SOLUTION

Accepted Solutions
KDJEM.1
ST Employee

Hi @ABric.1​ ,

To solve your problem try to change these code lines generated by CubeMx

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();
  }

 By these code lines

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();
  }

This update should be applied for OCTOSPI1 and OCTOSPI2

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

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.

View solution in original post

4 REPLIES 4
KDJEM.1
ST Employee

Hello @ABric.1​ ,

I confirm the issue, when a project is generated with STM32CubeMX 6.8.0, the HAL_OSPIM_Config function is called within the initialization of the OCTOSPI instance and executing the OCTOSPIM config function in the second interface initialization overwrites all configuration for the first OSPI which causes the problem.

This issue is reported internally.

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

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

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.

KDJEM.1
ST Employee

Hi @ABric.1​ ,

To solve your problem try to change these code lines generated by CubeMx

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();
  }

 By these code lines

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();
  }

This update should be applied for OCTOSPI1 and OCTOSPI2

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

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.

ABricout
Associate III

Thank you, it seems to be working

Have a nice day,

Augustin

Mister KDJEM.1!

I have also encountered this issue with stm32h723zgt6. The code you provided did not solve the problem, but based on information you provided about the issue i moved HAL_OSPIM_Config before HAL_OSPI_Init and i worked out. I am only writing this comment to inform you of the still persisting issue.

Best Regards,

Samo Benko, Student

 

My solution for the problem:

void MX_OCTOSPI1_Init(void)

{

 

/* USER CODE BEGIN OCTOSPI1_Init 0 */

 

/* USER CODE END OCTOSPI1_Init 0 */

 

OSPIM_CfgTypeDef sOspiManagerCfg = {0};

 

/* USER CODE BEGIN OCTOSPI1_Init 1 */

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();

}

/* USER CODE END OCTOSPI1_Init 1 */

hospi1.Instance = OCTOSPI1;

hospi1.Init.FifoThreshold = 12;

hospi1.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;

hospi1.Init.MemoryType = HAL_OSPI_MEMTYPE_MACRONIX;

hospi1.Init.DeviceSize = 22;

hospi1.Init.ChipSelectHighTime = 3;

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 = 256;

hospi1.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_HALFCYCLE;

hospi1.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_DISABLE;

hospi1.Init.ChipSelectBoundary = 0;

hospi1.Init.DelayBlockBypass = HAL_OSPI_DELAY_BLOCK_BYPASSED;

hospi1.Init.MaxTran = 0;

hospi1.Init.Refresh = 0;

if (HAL_OSPI_Init(&hospi1) != HAL_OK)

{

Error_Handler();

}

 

/* USER CODE BEGIN OCTOSPI1_Init 2 */

 

/* USER CODE END OCTOSPI1_Init 2 */

 

}