cancel
Showing results for 
Search instead for 
Did you mean: 

How External OCTO SPI Flash activete for custom board design?

Freedom_Neo
Senior

I am using below development tools

MCU: STM32H7B3IIT6

IDE: STM32CubeIDE Version: 1.8.0

GUI: TouchGFX Version: 4.18.1

SDRAM: IS45S16800F-7CTLA1-TR

FLASH: MX25LM51245GMI00

Schematic

0693W00000KbQfoQAF.png

static 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 */
 
  /* USER CODE END OCTOSPI1_Init 1 */
  /* OCTOSPI1 parameter configuration*/
  hospi1.Instance = OCTOSPI1;
  hospi1.Init.FifoThreshold = 1;
  hospi1.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;
  hospi1.Init.MemoryType = HAL_OSPI_MEMTYPE_MICRON;
  hospi1.Init.DeviceSize = 26;
  hospi1.Init.ChipSelectHighTime = 2;
  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 = 3;
  hospi1.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_NONE;
  hospi1.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_DISABLE;
  hospi1.Init.ChipSelectBoundary = 0;
  hospi1.Init.ClkChipSelectHighTime = 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();
  }
  sOspiManagerCfg.ClkPort = 1;
  sOspiManagerCfg.DQSPort = 1;
  sOspiManagerCfg.NCSPort = 1;
  sOspiManagerCfg.IOLowPort = HAL_OSPIM_IOPORT_1_LOW;
  sOspiManagerCfg.IOHighPort = HAL_OSPIM_IOPORT_1_HIGH;
  if (HAL_OSPIM_Config(&hospi1, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN OCTOSPI1_Init 2 */
  BSP_OSPI_NOR_Init_t Flash;
  Flash.InterfaceMode = BSP_OSPI_NOR_OPI_MODE;
  Flash.TransferRate  = BSP_OSPI_NOR_DTR_TRANSFER;
  BSP_OSPI_NOR_DeInit(0);
  int32_t RetVal = BSP_OSPI_NOR_Init(0, &Flash);
  if(RetVal != BSP_ERROR_NONE)
  {
    Error_Handler();
  }
  RetVal = BSP_OSPI_NOR_EnableMemoryMappedMode(0);
  if(RetVal != BSP_ERROR_NONE)
  {
    Error_Handler();
  }
  /* USER CODE END OCTOSPI1_Init 2 */
 
}

I am trying to activate octospi as custom board design, but the program gives an error. The program gets an error at the following place? What do you think could be the reason?

0693W00000KbQopQAF.png

35 REPLIES 35

Hi @Patrickhiapello​  I created external loader. But external loader file dont seem debug window. Do you have advice?

0693W00000Kc4MHQAZ.png0693W00000Kc4NjQAJ.png 

Great!

Good job!

ahahah yes i know :)

If you put this file for STM32CubeProgrammer you can "see" the file.

But if you put the same file for STM32CubeIDE you can not "see" the file.

Correct?

The problem is the name inside Dev_Inf.c

"QSPI_flashloader_CSP",      // Device Name + version number

Has to be egual to generate file stldr so ->QSPI_flashloader_CSP.stldr

Put name you want egual inside and outside the file in Dev_Inf.c

"franco",      // Device Name + version number

and generate file franco.stldr

Then you finally have your extenal loader work in STM32CubeIDE!

Hi @Patrickhiapello​ Thank you for support. I did your advice and I could see .*stldr file. But I see failed to erase memory. I wil create new post with "External OctoSPI loader how to".

Topics can be mixed. I will create a new topic.

0693W00000Kc7HKQAZ.png0693W00000Kc74qQAB.png 

Well that's me, and I'm monitoring things, but a week in and I'm not sure which pins you're using, and I don't have this IC or a STM32H7B3-DK board.

https://github.com/cturvey/stm32extldr/blob/main/h7a3_octo_pins.txt

Can we PLEASE establish which pins you're using?

At least with those it might be possible to patch/fix the DK's .stldr to match your hardware configuration, and see if it is simply that causing the issues, or if it's some mode/setting disagreement.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Dear @Community member​ Thank you for support. I am using below pins.

// STM32H7B3IIT6 PIN CHART
// MX25LM51245GMI00 (16-PIN SOP)
 
// OCTOSPIM P1
// D0   PD11:AF9   
// D1   PD12:AF9    
// D2   PE2:AF9    
// D3   PD13:AF9
// D4   PC1:AF10   
// D5   PC2:AF11   
// D6   PC3:AF11   
// D7   PD7:AF10
// CLK  PB2:AF9
// NCLK NOT USED
// NCS  PB10:AF9  
// DQS  PC5:AF10

0693W00000KcCgUQAV.png0693W00000KcCgjQAF.png 

Ok, so significantly different from DK and EVAL boards

// STM32H7B3IIT6 PIN CHART
// MX25LM51245GMI00 (16-PIN SOP)
 
// OCTOSPIM P1     DK        EVAL
// D0   PD11:AF9    .         .
// D1   PD12:AF9   PF9:AF10  PF9:AF10
// D2   PE2:AF9    PF7:AF10  PF7:AF10
// D3   PD13:AF9   PF6:AF10  PF6:AF10
// D4   PC1:AF10    .         .
// D5   PC2:AF11   PH3:AF9   PH3:AF9
// D6   PC3:AF11   PG9:AF9   PD6:AF10(B)/PG9:AF9(A)
// D7   PD7:AF10    .        PG14:AF9
// CLK  PB2:AF9     .         .
// NCLK NOT USED
// NCS  PB10:AF9   PG6:AF10  PG6:AF10
// DQS  PC5:AF10    .         .

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..