SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By mikediv
#83390
Hi guys I bought the AT45DB161D 16 Meg flash ram I have it connected to basic stamp but I do not know how to program a test code to see if this chip is working can anyone help I just need somehting simple to see if the chip it connected properly I also have a few PIC 16f676 and 16f877 and 16f684 if anyone has a test program for those that would work the flash ram is SPI thank you
By cpolley
#83624
1) Read the 45db16 datasheet and make sure your connections are what they should be

2) Read the datasheet for your PICs and make sure you know how to use the SPI interface (I've never used one so it's up to you)

3) Read the whole 45DB16 datasheet again

4) The simplest check to see that you can talk and listen to the chip is to ask it for its manufacturer code. AVR code would look something like this:
Code: Select all
int FlashOK(void)
{
	cbi(MEM_CS_PORT,MEM_CS);
	SPI_Write(0x9F);
	SPI_Write(0xBB);
	SPI_Write(0xBB);
	if(SPDR==0x26)
		return 1;
	else
		return 0;
}
Where 0x26 is the response you expect from an AT45DB16.

A more detailed explanation is in the datasheet. Look at the examples at the back and you can't go wrong.