Zdravim,mam pamet 25P10AV , DS M25P10AV, nejak my nefunguje zapis do pameti,at tam zapisu cokoliv prectu jen nuly,
divny je ze zapis do status registru funguje , nastaveni bitu WEL,BP0/1 a nasledny precteni v pohode,
po smazani sektoru jsou nastaveny 0xff, po zapisu jaky koliv hodnoty jsou tam nuly , nekdo nejaky napad ? kde je chyba …
Write Protect a Hold pripojeny na VCC, BP0/1 =0,SRWD=0
[code]void SpiFlash_PP(unsigned int32 StartAddr, unsigned int8 LengthOfData)
{
unsigned int8 i;
while((SpiFlash_RDSR())!=0);
//while((SpiFlash_RDSR()&0xfd)!=0);
delay_cycles(2);
SpiFlash_WREN();
delay_cycles(2);
OUTPUT_LOW(CS_M25);
delay_cycles(2);
SPI_WRITE(PP);
delay_cycles(2);
SPI_WRITE((unsigned char)(StartAddr>>16));// [23..16]
delay_cycles(2);
SPI_WRITE((unsigned char)(StartAddr>>8));// [15..8]
delay_cycles(2);
SPI_WRITE((unsigned char)StartAddr);// [7..0]
delay_cycles(2);
for (i =0 ; i<LengthOfData; i++) //send data from [0]
{
SPI_WRITE(SpiFlash_buffer*);
//printf("%2X,",SpiFlash_buffer*);
}
delay_cycles(2);
OUTPUT_HIGH(CS_M25);
delay_cycles(2);
}[/code]**
25p10.zip (54.2 KB)