cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with flashloader/driver for STM32H7A3ZIT6Q with Octo-spi FLASH (twin quad) NOR flash MT25TL256

I have a custom board with an STM32H7A3ZIT6Q. It has the MT25TL256 NOR flash connected to the pins of OCTOSPI1.

I'm trying to write a flashloader/driver.

In our application we do not need to execute code from this flash. We only need it for data. But if there is a way to get execution working that would be nice too.

I'm following the tutorial from ST:

ST tutorial:

https://www.st.com/content/st_com/en/support/learning/stm32-education/stm32-moocs/external_QSPI_loader.html

https://www.youtube.com/watch?v=YFIvJVsvIsE&list=PLnMKNibPkDnHIrq5BICcFhLsmJFI_ytvE&index=1

Template project: https://drive.google.com/drive/folders/1KiaqXgiubk81EvevofK-y3LxrCl9NHfi

STM git repo https://github.com/STMicroelectronics/stm32-external-loader/tree/contrib

Application note: https://www.st.com/content/ccc/resource/technical/document/application_note/group0/91/dd/af/52/e1/d3/48/8e/DM00407776/files/DM00407776.pdf/jcr:content/translations/en.DM00407776.pdf

MCU Datasheet: https://www.st.com/resource/en/datasheet/stm32h7a3ri.pdf

Reference manual: https://www.st.com/resource/en/reference_manual/rm0455-stm32h7a37b3-and-stm32h7b0-value-line-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

MT25TL256: https://media-www.micron.com/-/media/client/global/documents/products/data-sheet/nor-flash/serial-nor/mt25t/generation-b/mt25t_qlhs_l_256_xba_0.pdf?rev=443b2b18a725408b9ba5b028fa46e840

Here is what I have figured out so far:

MCU is clocked to 270MHZ.

Prescaler is set to 4 (value 3 in register) so MT25TL256 is clocked at 90MHz in DTR mode.

chip-select high time (CSHT) is hard to find, but since all similar timings are <= 5ns this equals to 1 clock cycle, so this is set to 1

Our MCU is the Q variant with SMPS, so not all pins of OCTOSPI2 are available.

Here is what I'm struggling with:

In table 4 of AN5050 Rev 7 it says the flash has to be connected to OCTOSPI2, but ours is connected to OCTOSPI1.

In Table 1 of DS13195 Rev 8 it says nor flash is not supported directly only in Multiplexed mode.

In figure 10 of AN5050 Rev 7 the Multiplexed mode is visualized. In this figure Memory 2 is connected to OCTOSPI1 and its CSn pin (S#) is connected to OCTOSPI2.

In Table 6 of RM0455 Rev 9 it seems like NOR flash could be mapped to OCTOSPI1 (I assume the first addresses are for OCTOSPI1), but that "Execute never" is set to yes, so it cannot be executed.

Since our memory has the CSn connected to OCTOSPI1 instead of two I wonder if we can get this to work, with or without support for execution, without making hardware changes.

So my questions are:

1) Can we get this chip to work without changing the hardware? If, so how?

2) What value should I use for FifoThreshold?

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
10 REPLIES 10

I've found the bug. The debugger doesn't hard reset the processor so the reset line of the FLASH chip doesn't toggle. The FLASH chip is still in quad mode. The solution was to simply reset the chip in both quad and single mode.

I've also improved the driver structure so I can enable Discard unused sections (-Wl,--gc-sections):

	//trick compiler not to discard unused functions and data with option Discard unused sections (-Wl,--gc-sections)
	volatile bool useUnused = false;
	volatile unsigned long DeviceSize;
 
	if (useUnused)
	{	DeviceSize = StorageInfo.DeviceSize;
		UNUSED(DeviceSize);
		SectorErase(0, 0);
		MassErase();
		Write(0,0,NULL);
		CheckSum(0, 0, 0);
		Verify(0,0,0,0);
	}

Edit: driver can be found here: https://github.com/STMicroelectronics/stm32-external-loader/pull/13

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.