Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erasing sector in dual flash mode #11

Open
1saeed opened this issue Jan 6, 2023 · 0 comments
Open

Erasing sector in dual flash mode #11

1saeed opened this issue Jan 6, 2023 · 0 comments

Comments

@1saeed
Copy link

1saeed commented Jan 6, 2023

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) {}
		 }
	 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant