Hi, i'm writing a library to handle the SST25VF016B data flash unit for the land tiger LPC1768. Datasheet for the chip
So far I've written this code:
Then in order to test it I wrote a function to read the memory (0x80 bytes) and display it on the LCD; also I mapped erase and write a byte to the land tiger keys... Nothing special I just call the library functions.
My porblem is that this code work only sometimes. Like for example if it manages to write data to the LCD if I write a byte sometimes it works and sometimes if just freeze on the status register busy check as the SPI_Transfer(0xFF) to read the status register returns 0xFF (this happens also with other functions).
Now after trying to write a byte the device won't pass DF_ChipUnlock() as on DF_Init(false) it passes the first loop to check for 0x1C (block protection on startup) but after that when it enter the method DF_ChipUnlock() it freezes there, as DF_EnableWriteStatusRegister(); DF_WriteStatusRegister(0x0); won't work (the status register always reads 0x1C (all sectors protected)).
Am I missing something?
Thanks for your time.
In case you have this problem, I've solved it by setting the PINMODE like it follows:
LPC_PINCON->PINMODE1 |= (3<<2) | (3<<4);