cancel
Showing results for 
Search instead for 
Did you mean: 

H7 QUADSPI weirdness

Seen this on two board designs, about two year different in age and many steppings of STM32H7

The H743I-EVAL and H745I-DISCO have 1Gb (128MB) of Micron QSPI flash, one as a dual die single chip, the other as two SOP16

Using the BSP code I can access the parts, both via the Read and Memory Mapped methods.

If it do a bytewise read of the entire array in memory mapped mode the first pass returns the wrong CRC32, and the second one hangs during the next read of a byte at 0x90000000. Stopping execution, it keeps falling in the Systick_Handler, and never reads any memory

If I do half the array, or 128MB - 32 bytes, I get the correct CRC, and can do it multiple times.

...
	status = BSP_QSPI_EnableMemoryMappedMode();
	if (status == QSPI_ERROR)
		puts("QSPI Error");
	else
		puts("QSPI Ok");
	
	printf("%u\n", FlashSize);
	printf("CRC:%08X\n", CRC32(0xFFFFFFFF, FlashSize, (void *)0x90000000)); // Returns wrong sum
	printf("CRC:%08X\n", CRC32(0xFFFFFFFF, FlashSize, (void *)0x90000000)); // Hangs
	printf("CRC:%08X\n", CRC32(0xFFFFFFFF, FlashSize, (void *)0x90000000));
	printf("CRC:%08X\n", CRC32(0xFFFFFFFF, FlashSize, (void *)0x90000000));
	printf("CRC:%08X\n", CRC32(0xFFFFFFFF, FlashSize, (void *)0x90000000));
...
 
//******************************************************************************
 
uint32_t CRC32(uint32_t Crc, uint32_t Size, uint8_t *Buffer)
{
  while(Size--)
  {
    static const uint32_t CrcTable[] = {
      0x00000000,0x1DB71064,0x3B6E20C8,0x26D930AC,0x76DC4190,0x6B6B51F4,0x4DB26158,0x5005713C,
      0xEDB88320,0xF00F9344,0xD6D6A3E8,0xCB61B38C,0x9B64C2B0,0x86D3D2D4,0xA00AE278,0xBDBDF21C };
 
    Crc = Crc ^ (uint32_t)*Buffer++;
 
    Crc = (Crc >> 4) ^ CrcTable[Crc & 0x0F];
    Crc = (Crc >> 4) ^ CrcTable[Crc & 0x0F];
  }
 
  return(Crc);
}
 
//****************************************************************************

It is as if the QUADSPI state machine malfunctions in getting the end bytes, or sends something breaking the Micron parts.

134217696 <-- 32 bytes less

CRC:E741A92C <-- Works

CRC:E741A92C

CRC:E741A92C

CRC:E741A92C

CRC:E741A92C

Infinite loop...

134217697 <--- 31 bytes less

CRC:1F3DC2C7 <- First completes correctly, but then locks

134217728 <-- Whole array

CRC:C3C26772 <- First completes incorrectly, and next pass locks

READ ID (QUAD)

MT25QL 512 (DUAL BANK) / MT25TL01G

UID-0 : 44 00 2E EF 92 00 13 FA FF 26 00 DE A8 FE ED 6C

UID-1 : 44 00 2E EF 92 00 09 12 00 11 00 45 F5 FE 0A B6

 Size 134217728

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

Back referencing this so I can find the threads again later

https://community.st.com/s/question/0D53W000015ZrGUSA0/stm32h7-crashes-when-reading-the-last-bytes-from-a-memorymapped-qspi

2 Years on, @Amel NASRI​ @Andreas Bolsch​ 

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