cancel
Showing results for 
Search instead for 
Did you mean: 

ST-Link not configuring QSPI flsah for STM32F746

YAdan
Associate II

I have built a custom board using STM32F746BET6. I have MT25QL512ABB8ESF-0SIT flash connected to the STM32F746BET6 (same pins as the discovery board) . When I upload my code ST-Link does not write into the external flash. Uploading the hex file goes well for the internal flash but ST-Link stalls when writing to the external flash mentioning a programming error in address 0X90000000 or above. I checked the connectivity, probed the QSPI traffic with a scope, performed erase and read with ST-LInk all seems to be good. I checked what flash they put in the discovery board 746 because they seem to have changed them quite few times. I found they are using the MT25QL128ABA1EW9-0SIT on the discovery board I have. While initially I have used on my board the MT25QL512ABB8ESF-0SIT. So both flashes are from the same family but the one I used is double the size. I swapped flash from discovery to my board and programmed fine. The ST-link seem to be picky about the flash, but I still don’t understand why.

I will be grateful if someone can help me solve the problem.

4 REPLIES 4
Andreas Bolsch
Lead II

The external loader used by ST-Link utility is of course specific to the type of flash memory:

  • chip id (most certainly read and verified by the external loader) is different for QL128 vs. QL512
  • capacity is different, i.e. QL128 uses 3 byte addresses whereas QL512 needs 4 byte addresses (if the full capacity is to be used)
  • the external loader might use 4-line (aka QPI) mode, this has to be enabled via volatile or non-volatile configuration register. Althought this works in the same way for both types, the external loader probably doesn't "know" that, so as soon the chip id is different from the expected one ...

So, you have to write your own external loader (or find one for the QL512 using the same pins). Bear in mind that compatibility even within the same line from the same manufacturer is limited. For simple SPI mode usually the 16 MByte limit is the only obstacle, but anything beyond that ...

BTW: capacity of QL512 is four times capacity of QL128, not just two times.

YAdan
Associate II

Hi Andreas,

Thank you for your answer and yes you are right the capacity is quadruple not double. Honestly this shows how clunky all this ST business is and everyone is saying that. However, the STM32F7 series are wonderful controllers and I can't be grateful enough to find all these tools like CubeIDE and TouchGFX free of charge.

While doing some research I found that cutsom board external flash is a common problem for many designers. Mostly they were saying the same thing as you to write our own external loader. This is not straightforward so I will need to look into that deeper, I wish if was just a simple text configuration file. They also advised to use STM32Cube Programmer rather than ST-Link. After doing so I found a way to fool the STM32Cube Programmer without spending time on writing an external loader.

1- I select on the external loader the N25Q128A with the STM32F746 Disco

0693W000000UvT0QAK.png

2- I go to memory & file edition tab and type address 0x90000000 then do a read. This gives me access to the external flash.

3- I go back to the external loader and select MT25QL512A flash

0693W000000UvTPQA0.png

4- I go to Erasing and Programming tab and program the chip.

I think the first step allows to set the microcontroller QSPI and the 3rd step allows to have the right chip ID checked.

Do you have any documentation that explains how to create an external loader ?

Thanks,

Yacine

Loaders are quite involved, ST has a subset of example sources under the ST-LINK Utilities and STM32 Cube Programmer trees

If an existing loader is available for the STM32 Family, just using different pins, it is probably easier to patch. I've posted a couple with alternate pin configurations.

See Section 5 in this

https://www.st.com/resource/en/user_manual/cd00262073-stm32-stlink-utility-software-description-stmicroelectronics.pdf

https://www.st.com/resource/en/application_note/dm00227538-quad-spi-interface-quadspi-on-stm32-microcontrollers-stmicroelectronics.pdf

https://www.st.com/resource/en/application_note/dm00514974-external-memory-code-execution-on-stm32f7x0-value-line-and-stm32h750-value-line-mcus-stmicroelectronics.pdf

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

For "just a simple text configuration file": been there, too ;) Look at OpenOCD with the patch at http://openocd.zylin.com/#/c/4321/