cancel
Showing results for 
Search instead for 
Did you mean: 

Facing issue while creating external flash loader

Nagarajan
Associate III

I am using NUCLEO-H563ZI evaluation board and i want to create external flash loader for IS25LP128 QSPI flash memory. I used external loader files from GIT HUB and .stldr file in STCUBE programmer external loader folder location. when i try to read from 0x90000000 location, i am getting read failure error. I used the below path to create external loader for IS25LP128 QSPI flash memory,

stm32-external-loader/Loader_Files/other devices at contrib · STMicroelectronics/stm32-external-loader · GitHub

Could you please help me to solve the below issue?

 

Nagarajan_2-1711548543593.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

>>What could be the reason for Init function not called?

I don't know, use your imagination.

Set the STM32 Cube Programmer side to Verbose Logging Level 3, see what it's doing.

Make sure it pulls in the loader image to RAM, that it correctly identifies the Init() entry point, and calls it. Use objdump or fromelf to dump/disassemble the .STLDR

Other H5 loaders use 0x20003004 as the basis, not 0x20000004 or 0x24000004

C:\STM32Cube\STM32CubeProgrammer_v2.15.0\bin\ExternalLoader>C:\Keil537\ARM\ARMCLANG\bin\fromelf.exe  -csd MX25LM51245G_STM32H573I-DK.stldr

========================================================================

** ELF Header Information

    File Name: MX25LM51245G_STM32H573I-DK.stldr

    Machine class: ELFCLASS32 (32-bit)
    Data encoding: ELFDATA2LSB (Little endian)
    Header version: EV_CURRENT (Current version)
    Operating System ABI: none
    ABI Version: 0
    File Type: ET_EXEC (Executable) (2)
    Machine: EM_ARM (ARM)

    Image Entry point: 0x20003005
    Flags: None (0x05000000)

    ARM ELF revision: 5 (ABI version 2)

    Conforms to Base float procedure-call standard

    Header size: 52 bytes (0x34)
    Program header entry size: 32 bytes (0x20)
    Section header entry size: 40 bytes (0x28)

    Program header entries: 2
    Section header entries: 20

    Program header offset: 159376 (0x00026e90)
    Section header offset: 159440 (0x00026ed0)

    Section header string table index: 1

========================================================================

** Program header #0 (PT_LOAD) [PF_R]
    Size : 200 bytes
    Virtual address: 0x00000000 (Alignment 4)


====================================

** Program header #1 (PT_LOAD) [PF_X + PF_W + PF_R]
    Size : 16205 bytes
    Virtual address: 0x20003004 (Alignment 4)


========================================================================
...
    267  Init                       0x20003005   Gb    5  Code  De   0x66
    268  MassErase                  0x2000306b   Gb    5  Code  De   0x3e
    269  Write                      0x200030a9   Gb    5  Code  De   0x46
    270  SectorErase                0x200030ef   Gb    5  Code  De   0x60
    271  CheckSum                   0x2000320d   Gb    5  Code  De   0xd4
    272  Verify                     0x200032e1   Gb    5  Code  De   0x5e
...
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

51 REPLIES 51

Test and debug your loader and BSP code in application space, using a harness or fixture to allow you to exercise the basic functionality.

With the loader you can use any/all of the resources of your hardware, ie UART/VCP, to provide diagnostic and telemetry as to what's happening internally. The interactions on the STM32 Cube Programmer side can be seen via the log at an appropriate verbosity level.

Here Init() or Read() function are not completing without an error/failure. On a NOR_FLASH Init() is expected to memory map the device, and return without an error.

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

While debugging i found out that if it is charcter string, i am able to wirte n number of bytes but if it is numerical value, i am able to store only 8 bytes.

for example, i am trying to store 1 to 24 values in flash but it is storing 1 to 8 only after that it is writing/reading some junk values. Could you please help me to solve this issue.

for(int i=0; i<24; i++)

{

data_Fl[i] = i;

}

Enter_QPI_Mode();

HAL_Delay(50);

QSPI_data_erase_handler_4Lines(ERASE_BLOCK, (uint32_t)BLOCK0_64K_ADDR);

HAL_Delay(500);

QSPI_data_write_handler_4Lines((uint32_t)BLOCK0_64K_ADDR, &data_Fl[0], sizeof(data_Fl));

HAL_Delay(500);

 

Nagarajan_0-1711608414976.png

 

KDJEM.1
ST Employee

Hello @Nagarajan and welcome to the Community 🙂,

Could you please check the OCTOSPI configuration parameters like as Chip select boundary (CSBOUND) configured depending on the memory datasheet. The chip select must go high when crossing the page boundary (2^CSBOUND bytes defines the page size).

May be this "MOOC - External QSPI loader how to" can help you.

Thank you.

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.

Likely an issue with the write code not shown. Either the transfer or waiting for the completion. Don't view the peripheral registers in the debugger, it will break the FIFO

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

I tried CSBOUND register by giving different values but no luck.
This code is working fine for string but it is not working for numerical values.
The below configuration only I am using, also attached my full code with chat.
Please help me to solve the issue.


static void MX_OCTOSPI1_Init(void)

{

/* USER CODE BEGIN OCTOSPI1_Init 0 */

 

/* USER CODE END OCTOSPI1_Init 0 */

 

/* USER CODE BEGIN OCTOSPI1_Init 1 */

 

/* USER CODE END OCTOSPI1_Init 1 */

/* OCTOSPI1 parameter configuration*/

hospi1.Instance = OCTOSPI1;

hospi1.Init.FifoThresholdByte = 4;

hospi1.Init.MemoryMode = HAL_XSPI_SINGLE_MEM;

hospi1.Init.MemoryType = HAL_XSPI_MEMTYPE_MICRON;

hospi1.Init.MemorySize = HAL_XSPI_SIZE_16MB;

hospi1.Init.ChipSelectHighTimeCycle = 1;

hospi1.Init.FreeRunningClock = HAL_XSPI_FREERUNCLK_DISABLE;

hospi1.Init.ClockMode = HAL_XSPI_CLOCK_MODE_0;

hospi1.Init.WrapSize = HAL_XSPI_WRAP_NOT_SUPPORTED;

hospi1.Init.ClockPrescaler = 1;

hospi1.Init.SampleShifting = HAL_XSPI_SAMPLE_SHIFT_NONE;

hospi1.Init.DelayHoldQuarterCycle = HAL_XSPI_DHQC_DISABLE;

hospi1.Init.ChipSelectBoundary = HAL_XSPI_BONDARYOF_NONE;

hospi1.Init.DelayBlockBypass = HAL_XSPI_DELAY_BLOCK_BYPASS;

hospi1.Init.Refresh = 0;

if (HAL_XSPI_Init(&hospi1) != HAL_OK)

{

Error_Handler();

}

/* USER CODE BEGIN OCTOSPI1_Init 2 */

/* USER CODE END OCTOSPI1_Init 2 */

}

 

 

The execution didn't stop Anyware in transmission function and it came out of the function with success only. i would like to know any difference is there for string and numeric data to write into flash memory. My OCTO SPI clk freq is 32MHz. I connected eval board and external flash memory with short wires.

KDJEM.1
ST Employee

Hi @Nagarajan ,

Thank you for updating post and sharing these details.

About the code configuration, please make sure that :

  • Sample shifting (SSHT) enabled in STR mode and disabled in DTR mode.
  •  Delay hold quarter cycle (DHQC) enabled in DTR mode and disabled in STR mode
  • DEVSIZE: The memory sizes = 2^(DEVSIZE+1)

I hope this help you!

Thank you.

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.

Nagarajan
Associate III

I corrected the memory size from 16Mega bits to 128 Mega bits and sample shifting i enabled. DHQC is disabled only as it is in STR mode but still i am facing the same issue. Now my configuration is like below,

 

hospi1.Instance = OCTOSPI1;
hospi1.Init.FifoThresholdByte = 1;
hospi1.Init.MemoryMode = HAL_XSPI_SINGLE_MEM;
hospi1.Init.MemoryType = HAL_XSPI_MEMTYPE_MICRON;
hospi1.Init.MemorySize = HAL_XSPI_SIZE_128MB;
hospi1.Init.ChipSelectHighTimeCycle = 1;
hospi1.Init.FreeRunningClock = HAL_XSPI_FREERUNCLK_DISABLE;
hospi1.Init.ClockMode = HAL_XSPI_CLOCK_MODE_0;
hospi1.Init.WrapSize = HAL_XSPI_WRAP_NOT_SUPPORTED;
hospi1.Init.ClockPrescaler = 1;
hospi1.Init.SampleShifting = HAL_XSPI_SAMPLE_SHIFT_HALFCYCLE;
hospi1.Init.DelayHoldQuarterCycle = HAL_XSPI_DHQC_DISABLE;
hospi1.Init.ChipSelectBoundary = HAL_XSPI_BONDARYOF_NONE;
hospi1.Init.DelayBlockBypass = HAL_XSPI_DELAY_BLOCK_BYPASS;
hospi1.Init.Refresh = 0;

A bit confused about the mixed use of XSPI and SPI peripherals here.

Can you provide a pin designation list for how this IS25LP128 is connected too the STM32H5 chip?

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