- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello :
now my mcu is stm32f407 use s29gl512T as external storage, and reference datasheet
my code is
NOR_Status FSMC_NOR_ProgramBuffer(uint16_t* pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite)
{
uint32_t lastloadedaddress = 0x00;
uint32_t currentaddress = 0x00;
uint32_t endaddress = 0x00;
/* Initialize variables */
currentaddress = WriteAddr;
endaddress = WriteAddr + NumHalfwordToWrite - 1;
lastloadedaddress = WriteAddr;
/* Issue unlock command sequence */
NOR_WRITE(ADDR_SHIFT(0x00555), 0x00AA);
NOR_WRITE(ADDR_SHIFT(0x02AA), 0x0055);
/* Write Write Buffer Load Command */
NOR_WRITE(ADDR_SHIFT(WriteAddr), 0x0025);
NOR_WRITE(ADDR_SHIFT(WriteAddr), (NumHalfwordToWrite - 1));
/* Load Data into NOR Buffer */
while(currentaddress <= endaddress)
{
/* Store last loaded address & data value (for polling) */
lastloadedaddress = currentaddress;
NOR_WRITE(ADDR_SHIFT(currentaddress), *pBuffer++);
currentaddress += 2;
}
NOR_WRITE(ADDR_SHIFT(lastloadedaddress), 0x29);
return(FSMC_NOR_GetStatus(Program_Timeout));
}
but then I read flash it is all 0x0000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Li Xuhui,
Thank you for contacting Cypress Semiconductor.
I would like to ask you a few questions -
- Have you been able to read the flash successfully? You can read a fresh sector of flash where you have not performed any program operation previously and confirm if the data being read is 0xFF so we can rule the possibility that read operation is faulty.
- Can you confirm that you are performing the write operation on an erased sector? If the sector is not erased before programming and the data in the sector is 0x00 you will not be able to program a different data pattern to the flash.
A few suggestions from our side are -
- As a sample for ProgramBuffer implementation, you can go through our Low Level Driver for Parallel NOR Flash. You can download the driver from here - https://www.cypress.com/documentation/software-and-drivers/low-level-driver-nor-flash?source=search&...
- While calculating the endaddress = WriteAddr + NumHalfwordToWrite - 1; instead of considering half words to write (i.e. number of bytes) could you please change it to number of words to write and let us know what happens? In our LLD, the word count has been implemented as the number of words to be programmed.
Best Regards,
Apurva