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
Peter Chang
Associate III

If BSP_OSPI_NOR_Init() function fail then you can not do anything.

We need detail to known which point failed.

I think this Flash is damaged. Please replace it.

And, Make sure the Flash was come from authorized channel.

Hello @molecule.192g​ I replaced with new FLASH. But this problem continues. FLASH came from Macronicx sample

Hi @Patrickhiapello​ 

These files for board not for STM32H7B3IIT6. Wouldn't it cause the same situation?

0693W00000KboIiQAJ.png

The loaders are highly implementation specific, both MCU, pinning, and memory device. The H74x / H75x devices use QSPI, not OSPI, and the peripherals and pin configuration are different.

You'd need to look at the BSP and Schematics for these other boards to see what pins they use, and how these differ from your design.

You've not listed your pin utilization. These get to the be the "details" that are important.

You get to review the data sheets and function for the parts you have chosen.

You can't debug this with top-level error reporting logs from the programmer, it is far too vague and non-specific.

You CAN debug the underlying BSP code outside of the programmer, and fully validate that.

You CAN build a harness to test/stress loader code

You CAN output debug/diagnostic information from your own loader via USART to understand what's happening internally. You can add instrumentation to understand specific flow, and device responses.

You CAN'T single-step or breakpoint debug the loader in the programmer. But you can get registers and other details with Verbose Level of 3.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Dear Freedom, So, finally you solve external loader problem by set Flash interface to SPI-STR mode. It means OPI-DTR work in your project, but it can not work in external loader. Am I right ? If yes then it's a very strange things. I can help to detail trace this issue if you want. Thanks & best regards ! Peter Chang 張耀�? Macronix International Co., LTD. (O) +886-2-25093300 ext : 207 "ST Community" 2022/03/08 下�?� 07:45 請回信 給 "Reply to ST Community" <0-1bcxwsri99pkaj.yoyaj690n9stx2fk.z41oyo9i2qqn0xj0@66wlj7ts8xn84pya.nwklyxs6rhfswjvt.b-ytg6eak.eu28.chatter.salesforce.com> 收件人 "peterchang01@mxic.com.tw" , 副本抄�? 主旨 Freedom_Neo mentioned you in an answer to: How External OCTO SPI Flash activete for custom board design? Hello @molecule.192g​ I replaced with new FLASH. But this problem continues. FLASH came from Macronicx sample Freedom_Neo (Community Member) Hello @molecule.192g (Community Member)​ I replaced with new FLASH. But this problem continues. FLASH came from Macronicx sample View/Answer or reply to this email Replying to How External OCTO SPI Flash activete for custom board design? Peter Chang (Community Member) Tuesday, March 8, 2022 10:13 AM If BSP_OSPI_NOR_Init() function fail then you can not do anything. We need detail to known which point failed. I think this Flash is damaged. Please replace it. And, Make sure the Flash was come from authorized channel. Freedom_Neo (Community Member) Hello @molecule.192g (Community Member)​ I replaced with new FLASH. But this problem continues. FLASH came from Macronicx sample Tuesday, March 8, 2022 7:45 PM You're receiving emails when someone "Mentions me in a comment." To change or turn off ST Community email, log in as peterchang01@mxic.com.tw.st. STMicroelectronics N.V. CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd.

Dear @molecule.192g​ 

So, finally you solve external loader problem by set Flash interface to SPI-STR mode.

I am useing OPI-DTR. But For try I changed from OPI-DTR to SPI-STR. There was no change.Problem continues.

// BSP_OSPI_NOR_Init_t Flash;
// Flash.InterfaceMode = BSP_OSPI_NOR_OPI_MODE;
// Flash.TransferRate = BSP_OSPI_NOR_DTR_TRANSFER;
 
BSP_OSPI_NOR_Init_t Flash;
Flash.InterfaceMode = BSP_OSPI_NOR_SPI_MODE;
Flash.TransferRate = BSP_OSPI_NOR_STR_TRANSFER;

It means OPI-DTR work in your project, but it can not work in external loader. Am I right ?

I work with OPI-DTR. Why cant work im external loader. STM32H7B3-DK development board works external loader with OPI-DTR. So I sampled it

If yes then it's a very strange things.

Yes. I work on this problem for 1 week

Dear Freedom, Please make sure Flash RESET# pin is at hi when you running the external loader. I remember I face to a strange problem of external loader that storageInfo structure must align to 16 Byte address. Please try to add alignment command to Dev_Inf.c file : __attribute__((aligned(16))) structure StorageInfo const StorageInfo = { ... } Thanks & best regards ! Peter Chang 張耀�? Macronix International Co., LTD. (O) +886-2-25093300 ext : 207 "ST Community" 2022/03/09 下�?� 02:41 請回信 給 "Reply to ST Community" <0-bup3jpf9g6tp15.v1ay8hqvqaj3hsqr.uf3dc8xqzfhnvfkn@b48plthd8khvnhd1.zzjaknvt8d72hvm.b-ytg6eak.eu28.chatter.salesforce.com> 收件人 "peterchang01@mxic.com.tw" , 副本抄�? 主旨 Freedom_Neo mentioned you in an answer to: How External OCTO SPI Flash activete for custom board design? Dear @molecule.192g​ So, finally you solve external loader problem by set Flash interface to SPI-STR mode. I am useing OPI-DTR. But For try I changed from OPI-DTR to SPI-STR. There was no change.Problem continues. [Start code block] // BSP_OSPI_NOR_Init_t Flash; // Flash.InterfaceMode = BSP_OSPI_NOR_OPI_MODE; // Flash.TransferRate = BSP_OSPI_NOR_DTR_TRANSFER; BSP_OSPI_NOR_Init_t Flash; Flash.InterfaceMode = BSP_OSPI_NOR_SPI_MODE; Flash.TransferRate = BSP_OSPI_NOR_STR_TRANSFER; [End code block]It means OPI-DTR work in your project, but it can not work in external loader. Am I right ? I work with OPI-DTR. Why cant work im external loader. STM32H7B3-DK development board works external loader with OPI-DTR. So I sampled it If yes then it's a very strange things. Yes. I work on this problem for 1 week Freedom_Neo (Community Member) Dear @molecule.192g (Community Member)​ So, finally you solve external loader problem by set Flash interface to SPI-STR mode. I am useing OPI-DTR. But For try I changed from OPI-DTR to SPI-STR. There was no change.Problem continues. // BSP_OSPI_NOR_Init_t Flash; // Flash.InterfaceMode = BSP_OSPI_NOR_OPI_MODE; // Flash.TransferRate = BSP_OSPI_NOR_DTR_TRANSFER; BSP_OSPI_NOR_Init_t Flash; Flash.InterfaceMode = BSP_OSPI_NOR_SPI_MODE; Flash.TransferRate = BSP_OSPI_NOR_STR_TRANSFER; It means OPI-DTR work in your project, but it can not work in external loader. Am I right ? I work with OPI-DTR. Why cant work im external loader. STM32H7B3-DK development board works external loader with OPI-DTR. So I sampled it If yes then it's a very strange things. Yes. I work on this problem for 1 week View/Answer or reply to this email Replying to How External OCTO SPI Flash activete for custom board design? Freedom_Neo (Community Member) Tuesday, March 8, 2022 7:45 PM Hello @molecule.192g (Community Member)​ I replaced with new FLASH. But this problem continues. FLASH came from Macronicx sample Peter Chang (Community Member) Dear Freedom, So, finally you solve external loader problem by set Flash interface to SPI-STR mode. It means OPI-DTR work in your project, but it can not work in external loader. Am I right ? If yes then it's a very strange things. I can help to detail trace this issue if you want. Thanks & best regards ! Peter Chang 張耀�? Macronix International Co., LTD. (O) +886-2-25093300 ext : 207 "ST Community" 2022/03/08 下�?� 07:45 請回信 給 "Reply to ST Community" < 0-1bcxwsri99pkaj.yoyaj690n9stx2fk.z41oyo9i2qqn0xj0@66wlj7ts8xn84pya.nwklyxs6rhfswjvt.b-ytg6eak.eu28.chatter.salesforce.com > 收件人 "peterchang01@mxic.com.tw" , 副本抄�? 主旨 Freedom_Neo mentioned you in an answer to: How External OCTO SPI Flash activete for custom board design? Hello @molecule.192g​ I replaced with new FLASH. But this problem continues. FLASH came from Macronicx sample Freedom_Neo (Community Member) Hello @molecule.192g (Community Member)​ I replaced with new FLASH. But this problem continues. FLASH came from Macronicx sample View/Answer or reply to this email Replying to How External OCTO SPI Flash activete for custom board design? Peter Chang (Community Member) Tuesday, March 8, 2022 10:13 AM If BSP_OSPI_NOR_Init() function fail then you can not do anything. We need detail to known which point failed. I think this Flash is damaged. Please replace it. And, Make sure the Flash was come from authorized channel. Freedom_Neo (Community Member) Hello @molecule.192g (Community Member)​ I replaced with new FLASH. But this problem continues. FLASH came from Macronicx sample Tuesday, March 8, 2022 7:45 PM You're receiving emails when someone "Mentions me in a comment." To change or turn off ST Community email, log in as peterchang01@mxic.com.tw.st. STMicroelectronics N.V. CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd. Wednesday, March 9, 2022 11:04 AM Freedom_Neo (Community Member) Dear @molecule.192g (Community Member)​ So, finally you solve external loader problem by set Flash interface to SPI-STR mode. I am useing OPI-DTR. But For try I changed from OPI-DTR to SPI-STR. There was no change.Problem continues. // BSP_OSPI_NOR_Init_t Flash; // Flash.InterfaceMode = BSP_OSPI_NOR_OPI_MODE; // Flash.TransferRate = BSP_OSPI_NOR_DTR_TRANSFER; BSP_OSPI_NOR_Init_t Flash; Flash.InterfaceMode = BSP_OSPI_NOR_SPI_MODE; Flash.TransferRate = BSP_OSPI_NOR_STR_TRANSFER; It means OPI-DTR work in your project, but it can not work in external loader. Am I right ? I work with OPI-DTR. Why cant work im external loader. STM32H7B3-DK development board works external loader with OPI-DTR. So I sampled it If yes then it's a very strange things. Yes. I work on this problem for 1 week Wednesday, March 9, 2022 2:41 PM You're receiving emails when someone "Mentions me in a comment." To change or turn off ST Community email, log in as peterchang01@mxic.com.tw.st. STMicroelectronics N.V. CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd.
Freedom_Neo
Senior

Dear @Community member​ 

Do you have ant opinion this problem?

PChia.2237
Senior

Hi @Community member​ 

at which point you are?

I mean, your code is working with BSP_OSPI_NOR_Init() ?

When you have this working you have to do the external loader.

You post " These files for board not for STM32H7B3IIT6."

Okay.

You have to see the more simular to your application, take the example code and modify for your application to have extenal loader

okay?

Hi @Patrickhiapello​ Thank you for support. I am working on external loader for my board. The reason for this problem my board pins different of STM32H7B3-DK has pins.