Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

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,

0 Likes
1 Solution
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

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.

 

View solution in original post

4 Replies
DennisS_46
Employee
Employee
100 sign-ins 50 likes received 50 solutions authored

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

MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

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,

0 Likes
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

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.

 

MiNe_85951
Level 7
Level 7
Distributor - TED (Japan)
50 likes received 500 replies posted 50 solutions authored

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.

0 Likes