- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Sirs and Madams,
We analyzed the writing time of the sample software.
The processing has the following tree :
/****************************************/
main()
Cy_Em_EEPROM_Write()
WriteExtendedMode()
WriteRow()
Cy_Flash_WriteRow()
/****************************************/
So I have some questions :
(1)
The system call "CPUSS_SYSREQ = CY_FLASH_CPUSS_REQ_START | CY_FLASH_API_OPCODE_WRITE_ROW;" executed in the critical section of Cy_Flash_WriteRow() takes about 15ms.
Is this part correct in recognizing blocking code?
(2)
Is there any document that explains the specific behavior of "CY_FLASH_API_OPCODE_WRITE_ROW"?
The first thing I want to know is whether the erase → write operation is performed every time.
In particular, what we want to know is, do you perform the write process after erasing each time? .
If you write after erasing every time, is there a problem in eliminating the erasing process and writing directly every time?
Could the user decompose the processing into TROWERASE (16ms) and TROWPROGRAM (4ms)?
Regards,
Solved! Go to Solution.
- Labels:
-
PSoC 4 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
The only way to get a binary 0 into FLASH is with an Erase sequence.
There are only 2 possible Erase sequences to choose from: Erase ALL, and WRITE ROW. Since you don't want to erase the entire FLASH memory, the WRITE ROW is the sequence used.
In fact, WRITE ROW will first program all 1's into the row, next it will ERASE the row making it all 0's, then WRITE ROW will program the data you intended. This method is called Pre-program/Erase/Program (PEP).
If on the other hand you know ahead of time that the data to be written will only change a 0-bit into a 1-bit, you do not have to use WRITE ROW, instead use PROGRAM ROW. This will skip the ERASE ROW sequence and save some time. PROGRAM ROW can also be used if it's known that the FLASH had been erased previously.
So in majority of cases, yes, erase--> write is the sequence used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is detailed description of the flash write process in an article by Alan Hawse:
https://iotexpert.com/psoc-4-flash-write/
The timing that you are getting is consistent with the chip specification.
---- Dennis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dennis-san,
Thank you for providing detailed information about Flash write.
However there was no explanation about CY_FLASH_API_OPCODE_WRITE_ROW in the materials you sent. Do you have a document with detailed information about this API?
Is it generally necessary to write to the flash after erasing it?
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
The only way to get a binary 0 into FLASH is with an Erase sequence.
There are only 2 possible Erase sequences to choose from: Erase ALL, and WRITE ROW. Since you don't want to erase the entire FLASH memory, the WRITE ROW is the sequence used.
In fact, WRITE ROW will first program all 1's into the row, next it will ERASE the row making it all 0's, then WRITE ROW will program the data you intended. This method is called Pre-program/Erase/Program (PEP).
If on the other hand you know ahead of time that the data to be written will only change a 0-bit into a 1-bit, you do not have to use WRITE ROW, instead use PROGRAM ROW. This will skip the ERASE ROW sequence and save some time. PROGRAM ROW can also be used if it's known that the FLASH had been erased previously.
So in majority of cases, yes, erase--> write is the sequence used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BiBi-san,
Until now, I had a vague understanding that it was common to write to flash after erasing, but the detailed explanation deepened my understanding.
It was understood that writing after erasing is easier to use than managing the necessity of erasing.
Thank you.