Skip to content

Erasing sector in dual flash mode #11

Open
@1saeed

Description

I faced an issue while I worked through the erasing cycle on STM32H745I-DISCO with dual MT25QL512ABB8ESF-0SIT QSPI flash. When the QSPI is in dual flash mode, the CSP_QSPI_EraseSector() method will erase the next or the previous sector as well (based on the destination sector) i.e:

#define MEMORY_SECTOR_SIZE 0x10000

  • If you erase sector 0 then sector 1 will be erased too ( CSP_QSPI_EraseSector(0 * MEMORY_SECTOR_SIZE, (0 + 1) * MEMORY_SECTOR_SIZE - 1) )
  • If you erase sector 1 then sector 0 will be erased too! ( CSP_QSPI_EraseSector(1 * MEMORY_SECTOR_SIZE, (1 + 1) * MEMORY_SECTOR_SIZE - 1) )
  • If you erase sector 2 then sector 3 will be erased too ( CSP_QSPI_EraseSector(2 * MEMORY_SECTOR_SIZE, (2 + 1) * MEMORY_SECTOR_SIZE - 1) )
  • If you erase sector 3 then sector 2 will be erased too! ( CSP_QSPI_EraseSector(3 * MEMORY_SECTOR_SIZE, (3 + 1) * MEMORY_SECTOR_SIZE - 1) )

and so on.

I didn't find any workaround to fix this issue so right now for the demo code to work I had to erase the sectors first and then run writing loop:

	 for (var = 0; var < SECTORS_COUNT; var++)
	 {
		 if (CSP_QSPI_EraseSector(var * MEMORY_SECTOR_SIZE, (var + 1) * MEMORY_SECTOR_SIZE - 1) != HAL_OK)
		 {
			 while (1) {}
		 }
	 }

	 for (var = 0; var < SECTORS_COUNT; var++)
	 {
		 if (CSP_QSPI_WriteMemory(buffer_test, var * MEMORY_SECTOR_SIZE, MEMORY_SECTOR_SIZE) != HAL_OK)
		 {
			 while (1) {}
		 }
	 }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions