Page 1 of 1

Serial Static Memory 23LCV1024

Posted: Wed Jan 13, 2016 1:23 pm
by MarkW
Hello,

Is there any example FC programs using the 23LCV1024 SPI memory chip?

@Ben, i did mention this chip before in another thread and you said it exists
on the EB006 ghost board, do you have any example code using this
device? I did look at the ghost board page but there is nothing
about any code to look at....

Thanx

Mark

Re: Serial Static Memory 23LCV1024

Posted: Wed Jan 13, 2016 5:55 pm
by Benj
Hi Mark,

Here is a simplified version of the code we use on the EB006 / EB091 boards. Hopefully this should be enough to help you create the Flowcode macros using an SPI component.

Code: Select all

void SRAM_Init(void)
{
	SPI_Initialise();
	mSPI_Mem_CS_En();					//Chip Select Enabled - Output 0
	SPI_1_SPI_Master_Byte(0x01);			//Write Mode Command
	SPI_1_SPI_Master_Byte(0x40);			//Sequential Mode
	mSPI_Mem_CS_Dis();					//Chip Select Disabled - Output 1
}

void SRAM_Write(unsigned long address, unsigned char data)
{
	mSPI_Mem_CS_En();							//Chip Select Enabled - Output 0
	SPI_1_SPI_Master_Byte(0x02);					//Write Data Command
	SPI_1_SPI_Master_Byte(address >> 16);			//24-bit Address
	SPI_1_SPI_Master_Byte(address >> 8);
	SPI_1_SPI_Master_Byte(address);
	SPI_1_SPI_Master_Byte(data);
	mSPI_Mem_CS_Dis();							//Chip Select Disabled - Output 1
}

unsigned char SRAM_Read(unsigned long address)
{
	unsigned char retval;
	mSPI_Mem_CS_En();							//Chip Select Enabled - Output 0
	SPI_1_SPI_Master_Byte(0x03);					//Read Data Command
	SPI_1_SPI_Master_Byte(address >> 16);			//24-bit Address
	SPI_1_SPI_Master_Byte(address >> 8);
	SPI_1_SPI_Master_Byte(address);
	retval = SPI_1_SPI_Master_Byte(0xFF);
	mSPI_Mem_CS_Dis();							//Chip Select Disabled - Output 1
	return (retval);
}
Once you have set up the Read or Write command you can keep reading or writing bytes to increase the data throughput. We read and write in bursts of 64 bytes.

Re: Serial Static Memory 23LCV1024

Posted: Thu Jan 14, 2016 1:09 pm
by MarkW
Thanx Ben,

Seems pretty straight forward enough :D