cancel
Showing results for 
Search instead for 
Did you mean: 

Custom External Loader can pass the test but doesn't work with STM32CubeProgrammer

kb24
Senior

Hello, I am trying to create external loader for MX25L12835F flash memory. My MCU is STM32H7B0RBTx and I followed "External QSPI loader how to" video series on Youtube. I used source files from the Github link that is shared below the videos. I had to change content of functions in quadspi.c file because STM32H7B0RBTx has OCTOSPI and contents of libraries are different. But I didn't change name of functions.

0693W00000APMtmQAH.jpgWhen I try this test code it can reach end of the code without any error so I can read memory in the debug screen.0693W00000APMuVQAX.jpg 

After finishing test I include Dev_Inf.c, Dev_Inf.h, Loader_Src.c and linker.ld files. I used linker.ld for H7 devices to be sure that RAM start address is 0x24000000. In the Loader_Src.c file I only made these changes:0693W00000APMydQAH.jpg 

I compiled code and created .stldr file and prepare it for STM32CubeProgrammer.

0693W00000APN6HQAX.jpg 

When I try to read data STM32CubeProgrammer it says Data read successfully but it isn't showing correct data.0693W00000APMyEQAX.jpg

When I try to upload test binary file with these settings0693W00000APN41QAH.jpg 

I get this error.0693W00000APN62QAH.jpg 

Also in the test code it can delete sectors 0-2047, it cant delete 2048 and stuck in while loop. Device size is 16 MB and sector size is 4 KB so there must be 4096 sectors.

What am I doing wrong and how can I solve it? Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
qq3g7bad
Associate III

Hello. I think HAL_OSPI_Abort(&hospi1) in Loader_Src.c cause the error. In fact, I have experienced the same problem as you.

To check quickly, how about commenting out HAL_OSPI_Abort(&hospi1) in Loader_Src.c? If it is not the solution, your problem is not the same as mine (Sorry...).

View solution in original post

11 REPLIES 11
qq3g7bad
Associate III

Hello. I think HAL_OSPI_Abort(&hospi1) in Loader_Src.c cause the error. In fact, I have experienced the same problem as you.

To check quickly, how about commenting out HAL_OSPI_Abort(&hospi1) in Loader_Src.c? If it is not the solution, your problem is not the same as mine (Sorry...).

I just tried but it didn't work unfortunately.

Last time I commented out but I didn't write there anything. I must init and deinit OSPI instead of calling HAL_OSPI_Abort. Below the video there are two GitHub links and both has codes for H7 devices. I thought Loader_Src.c files are same because same person wrote both of those and I used first one and it didn't work well because of HAL_OSPI_Abort, second file doesn't have HAL_OSPI_Abort.

Also I could reach only half of memory because I made wrong device size settings. Device size 2^24 so I made device size setting 23 because it was 2^(n+1) with older HAL libraries but now they changed it and it must be 2^(n) so that n or setting must be 24.

Here is the source files for MX25L12835F with OSPI configuration.

I can only add 1 file

 
 
 

Thank you for updating information!!​

>>I can only add 1 file

Make it a .ZIP, or start a thread, you can only attach singular files to subposts.

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