Skip to main content
Associate II
December 3, 2024
Solved

QSPI Write Issue on STM32H745 with MT25QL512 in IAR

  • December 3, 2024
  • 3 replies
  • 958 views

Hello,

I am working on interfacing an external flash memory IC MT25QL512 with the STM32H745 microcontroller using QSPI in IAR Embedded Workbench.

The Problem:

When attempting to write data to the external flash using the HAL_QSPI_Transmit function, the operation fails at the following line:

status = QSPI_WaitFlagStateUntilTimeout(hqspi, QSPI_FLAG_TC, SET, tickstart, Timeout);

Details of My Setup:

  • Microcontroller: STM32H745
  • Flash Memory IC: MT25QL512
  • Development Environment: IAR Embedded Workbench   

 

  • Has anyone encountered a similar issue with the QSPI_FLAG_TC not being set during a write operation?
  • Are there specific configuration or timing considerations for the STM32H745 and MT25QL512 combination that I might be overlooking?
  • Any debugging tips or suggestions would be greatly appreciated.

 

Thank you for your support!!

Best answer by Tesla DeLorean

Hard to say, you're pushing the content, so should have control of the speed of the transaction.

Are you placing a Debug View of the QSPI Peripheral Registers? Should probably avoid that due to secondary effects of the debugger, the status registers, and the data/FIFO registers.

Anything else trying to operate concurrently with the memory?

Able to get a logic analyzer on the pins?

Other code examples working? Clock/Peripheral enabled? ie non-zero content in registers and writable.

3 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
December 3, 2024

Hard to say, you're pushing the content, so should have control of the speed of the transaction.

Are you placing a Debug View of the QSPI Peripheral Registers? Should probably avoid that due to secondary effects of the debugger, the status registers, and the data/FIFO registers.

Anything else trying to operate concurrently with the memory?

Able to get a logic analyzer on the pins?

Other code examples working? Clock/Peripheral enabled? ie non-zero content in registers and writable.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Associate II
December 4, 2024

Attached IAR debug logs

 

0.001: File generated Wed Dec 4 10:36:52 2024

0.000: Pass 3 of 3
0.000: Starting fragment-style flashloader pass.
0.000: Device: C:\Users\harshal.gajjalwar\Desktop\External_IAR_LODER\FlashSTM32H745I-DISCO_QSPI_test.flash
0.001: Flash loader: C:\Users\harshal.gajjalwar\Desktop\External_IAR_LODER\FlashSTM32H7xx_QSPI_MICRON.out
0.154: FlashInitEntry is at 0x2400'25f4
0.154: FlashWriteEntry is at 0x2400'25fc
0.154: FlashEraseWriteEntry is at 0x2400'2604
0.154: FlashBreak is at 0x2400'00f8
0.154: FlashBufferStart is at 0x2400'4800
0.154: FlashBufferEnd is at 0x2404'0000
0.154: theFlashParams is at 0x2400'2644
0.154: FlashPreInitEntry not found
0.156: FlashChecksumEntry not found
0.156: FlashSignoffEntry not found
0.156: page size is 256 (0x100)
0.156: filler is 0xff
0.156: buffer size is 243712 (0x3'b800) 0.156:
0.156: Base of flash at 0x9000'0000
0.156: SimpleCode records (after offset):
0.156: Record 0: @ 0x9000'0000 [6824272 (0x68'2150) bytes] 0x9000'0000 - 0x9068'214f [0 0 0 0 ... ]
0.156: ->init : base @ 0x9000'0000, image size 0x68'2150
0.156: Store TargetParams to 0x2400'2644
0.157: Setting PC to 0x2400'25f4 (FlashInitEntry)
0.196: timing(init): 0.0000 (CPU) 0.0310 (elapsed)
0.196: Load TargetParams from 0x2400'2644
0.199: Transaction list:
0.199: Transaction 0: @ 0x9000'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9000'0000 (0x1'0000 bytes)
0.199: 1: 0x9001'0000 (0x1'0000 bytes)
0.199: 2: 0x9002'0000 (0x1'0000 bytes)
0.199: Transaction 1: @ 0x9003'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9003'0000 (0x1'0000 bytes)
0.199: 1: 0x9004'0000 (0x1'0000 bytes)
0.199: 2: 0x9005'0000 (0x1'0000 bytes)
0.199: Transaction 2: @ 0x9006'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9006'0000 (0x1'0000 bytes)
0.199: 1: 0x9007'0000 (0x1'0000 bytes)
0.199: 2: 0x9008'0000 (0x1'0000 bytes)
0.199: Transaction 3: @ 0x9009'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9009'0000 (0x1'0000 bytes)
0.199: 1: 0x900a'0000 (0x1'0000 bytes)
0.199: 2: 0x900b'0000 (0x1'0000 bytes)
0.199: Transaction 4: @ 0x900c'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x900c'0000 (0x1'0000 bytes)
0.199: 1: 0x900d'0000 (0x1'0000 bytes)
0.199: 2: 0x900e'0000 (0x1'0000 bytes)
0.199: Transaction 5: @ 0x900f'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x900f'0000 (0x1'0000 bytes)
0.199: 1: 0x9010'0000 (0x1'0000 bytes)
0.199: 2: 0x9011'0000 (0x1'0000 bytes)
0.199: Transaction 6: @ 0x9012'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9012'0000 (0x1'0000 bytes)
0.199: 1: 0x9013'0000 (0x1'0000 bytes)
0.199: 2: 0x9014'0000 (0x1'0000 bytes)
0.199: Transaction 7: @ 0x9015'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9015'0000 (0x1'0000 bytes)
0.199: 1: 0x9016'0000 (0x1'0000 bytes)
0.199: 2: 0x9017'0000 (0x1'0000 bytes)
0.199: Transaction 8: @ 0x9018'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9018'0000 (0x1'0000 bytes)
0.199: 1: 0x9019'0000 (0x1'0000 bytes)
0.199: 2: 0x901a'0000 (0x1'0000 bytes)
0.199: Transaction 9: @ 0x901b'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x901b'0000 (0x1'0000 bytes)
0.199: 1: 0x901c'0000 (0x1'0000 bytes)
0.199: 2: 0x901d'0000 (0x1'0000 bytes)
0.199: Transaction 10: @ 0x901e'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x901e'0000 (0x1'0000 bytes)
0.199: 1: 0x901f'0000 (0x1'0000 bytes)
0.199: 2: 0x9020'0000 (0x1'0000 bytes)
0.199: Transaction 11: @ 0x9021'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9021'0000 (0x1'0000 bytes)
0.199: 1: 0x9022'0000 (0x1'0000 bytes)
0.199: 2: 0x9023'0000 (0x1'0000 bytes)
0.199: Transaction 12: @ 0x9024'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9024'0000 (0x1'0000 bytes)
0.199: 1: 0x9025'0000 (0x1'0000 bytes)
0.199: 2: 0x9026'0000 (0x1'0000 bytes)
0.199: Transaction 13: @ 0x9027'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9027'0000 (0x1'0000 bytes)
0.199: 1: 0x9028'0000 (0x1'0000 bytes)
0.199: 2: 0x9029'0000 (0x1'0000 bytes)
0.199: Transaction 14: @ 0x902a'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x902a'0000 (0x1'0000 bytes)
0.199: 1: 0x902b'0000 (0x1'0000 bytes)
0.199: 2: 0x902c'0000 (0x1'0000 bytes)
0.199: Transaction 15: @ 0x902d'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x902d'0000 (0x1'0000 bytes)
0.199: 1: 0x902e'0000 (0x1'0000 bytes)
0.199: 2: 0x902f'0000 (0x1'0000 bytes)
0.199: Transaction 16: @ 0x9030'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9030'0000 (0x1'0000 bytes)
0.199: 1: 0x9031'0000 (0x1'0000 bytes)
0.199: 2: 0x9032'0000 (0x1'0000 bytes)
0.199: Transaction 17: @ 0x9033'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9033'0000 (0x1'0000 bytes)
0.199: 1: 0x9034'0000 (0x1'0000 bytes)
0.199: 2: 0x9035'0000 (0x1'0000 bytes)
0.199: Transaction 18: @ 0x9036'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9036'0000 (0x1'0000 bytes)
0.199: 1: 0x9037'0000 (0x1'0000 bytes)
0.199: 2: 0x9038'0000 (0x1'0000 bytes)
0.199: Transaction 19: @ 0x9039'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9039'0000 (0x1'0000 bytes)
0.199: 1: 0x903a'0000 (0x1'0000 bytes)
0.199: 2: 0x903b'0000 (0x1'0000 bytes)
0.199: Transaction 20: @ 0x903c'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x903c'0000 (0x1'0000 bytes)
0.199: 1: 0x903d'0000 (0x1'0000 bytes)
0.199: 2: 0x903e'0000 (0x1'0000 bytes)
0.199: Transaction 21: @ 0x903f'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x903f'0000 (0x1'0000 bytes)
0.199: 1: 0x9040'0000 (0x1'0000 bytes)
0.199: 2: 0x9041'0000 (0x1'0000 bytes)
0.199: Transaction 22: @ 0x9042'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9042'0000 (0x1'0000 bytes)
0.199: 1: 0x9043'0000 (0x1'0000 bytes)
0.199: 2: 0x9044'0000 (0x1'0000 bytes)
0.199: Transaction 23: @ 0x9045'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.199: Will erase 3 block(s):
0.199: 0: 0x9045'0000 (0x1'0000 bytes)
0.200: 1: 0x9046'0000 (0x1'0000 bytes)
0.200: 2: 0x9047'0000 (0x1'0000 bytes)
0.200: Transaction 24: @ 0x9048'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.200: Will erase 3 block(s):
0.200: 0: 0x9048'0000 (0x1'0000 bytes)
0.200: 1: 0x9049'0000 (0x1'0000 bytes)
0.200: 2: 0x904a'0000 (0x1'0000 bytes)
0.200: Transaction 25: @ 0x904b'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.200: Will erase 3 block(s):
0.200: 0: 0x904b'0000 (0x1'0000 bytes)
0.200: 1: 0x904c'0000 (0x1'0000 bytes)
0.200: 2: 0x904d'0000 (0x1'0000 bytes)
0.200: Transaction 26: @ 0x904e'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.200: Will erase 3 block(s):
0.200: 0: 0x904e'0000 (0x1'0000 bytes)
0.200: 1: 0x904f'0000 (0x1'0000 bytes)
0.200: 2: 0x9050'0000 (0x1'0000 bytes)
0.200: Transaction 27: @ 0x9051'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.200: Will erase 3 block(s):
0.200: 0: 0x9051'0000 (0x1'0000 bytes)
0.200: 1: 0x9052'0000 (0x1'0000 bytes)
0.200: 2: 0x9053'0000 (0x1'0000 bytes)
0.200: Transaction 28: @ 0x9054'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.200: Will erase 3 block(s):
0.200: 0: 0x9054'0000 (0x1'0000 bytes)
0.200: 1: 0x9055'0000 (0x1'0000 bytes)
0.200: 2: 0x9056'0000 (0x1'0000 bytes)
0.200: Transaction 29: @ 0x9057'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.200: Will erase 3 block(s):
0.200: 0: 0x9057'0000 (0x1'0000 bytes)
0.200: 1: 0x9058'0000 (0x1'0000 bytes)
0.200: 2: 0x9059'0000 (0x1'0000 bytes)
0.200: Transaction 30: @ 0x905a'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.200: Will erase 3 block(s):
0.200: 0: 0x905a'0000 (0x1'0000 bytes)
0.200: 1: 0x905b'0000 (0x1'0000 bytes)
0.200: 2: 0x905c'0000 (0x1'0000 bytes)
0.200: Transaction 31: @ 0x905d'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.200: Will erase 3 block(s):
0.200: 0: 0x905d'0000 (0x1'0000 bytes)
0.200: 1: 0x905e'0000 (0x1'0000 bytes)
0.200: 2: 0x905f'0000 (0x1'0000 bytes)
0.200: Transaction 32: @ 0x9060'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.200: Will erase 3 block(s):
0.200: 0: 0x9060'0000 (0x1'0000 bytes)
0.200: 1: 0x9061'0000 (0x1'0000 bytes)
0.200: 2: 0x9062'0000 (0x1'0000 bytes)
0.200: Transaction 33: @ 0x9063'0000 + 0x0 (0x3'0000=196608 bytes) 3 packet(s).
0.200: Will erase 3 block(s):
0.200: 0: 0x9063'0000 (0x1'0000 bytes)
0.200: 1: 0x9064'0000 (0x1'0000 bytes)
0.200: 2: 0x9065'0000 (0x1'0000 bytes)
0.200: Transaction 34: @ 0x9066'0000 + 0x0 (0x2'2200=139776 bytes) 3 packet(s).
0.200: Will erase 3 block(s):
0.200: 0: 0x9066'0000 (0x1'0000 bytes)
0.200: 1: 0x9067'0000 (0x1'0000 bytes)
0.200: 2: 0x9068'0000 (0x1'0000 bytes)
0.222: ->multi_erase: 3 blocks (0x18 bytes in buffer) [0 0 0]
0.223: Store TargetParams to 0x2400'2644
0.224: Setting PC to 0x2400'2604 (FlashEraseWriteEntry)
0.273: timing(erase): 0.0000 (CPU) 0.0410 (elapsed)
0.274: Load TargetParams from 0x2400'2644
0.274: ->write : @ 0x9000'0000 (0x3'0000 bytes, offset 0x0 into block @ 0x9000'0000) [0 0 0]
0.274: Writing 0x3'0000 bytes to FlashBuffer @ 0x2400'4800
1.793: Store TargetParams to 0x2400'2644
1.795: Setting PC to 0x2400'25fc (FlashWriteEntry)
1.842: timing(write): 0.0000 (CPU) 0.0370 (elapsed)
1.842: Load TargetParams from 0x2400'2644
1.845: Func returned 4 (0 means Ok) 630_d_90000000
1.873: Flash loading pass finished

GaetanGodart
Technical Moderator
December 5, 2024

Hello @Harsh_Gajjalwar ,

 

You have selected Tesla's answer as "best solution".
Where you able to fix your issue?

 

Regards,