Problem with W25qxx_WriteSector. For 4096 about 100 fail bytes
WojtekPoland opened this issue · comments
Hi,
I have problem with W25qxx_WriteSector. Below you can read my unit test with this function. Very often during writing all sector (4096 bytes) I have about 100-120 mistakes.
void W25qxx_Unit_Test2 (void)
{
int i,j;
bool match;
uint8_t u8rbuf[4096];
uint8_t u8wbuf[4096] = {0xff,};
for(i=0; i<sizeof(u8wbuf); i++) u8wbuf[i] = 0xaa;
printf("\r\nW25qxx_Unit_Test2");
W25qxx_Init();
for (i=0; i<2; i++)
{
printf("\r\nW25qxx_EraseSector:%d",i);
W25qxx_EraseSector(i);
}
printf("\r\nTEST 1 TEST 1 TEST 1");
printf("\r\nW25qxx_Write_Sector: %d", 0);
W25qxx_WriteSector(u8wbuf, 0, 0, sizeof(u8wbuf));
W25qxx_ReadSector(u8rbuf, 0, 0, sizeof(u8rbuf));
match = true;
j = 0;
for (i=0; i<sizeof(u8rbuf); i++)
{
if (u8rbuf[i] != 0xaa)
{
match = false;
j++;
//break;
}
}
if (match) printf("\r\nData1 match");
else printf("\r\nData1 does not match!!! %d",j);
printf("\r\nW25qxx_Unit_Test2 Done... Get back to work");
}
I am using W25Q128 made by Winbond. In function W25qxx_Init i hade to add code:
while (id!=0xEF7018) id = W25qxx_ReadID();
Summary: my flash doesn`t work stable. Have any idea why?