Serial Static Memory 23LCV1024

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

Serial Static Memory 23LCV1024

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Serial Static Memory 23LCV1024

Post 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.

MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

Re: Serial Static Memory 23LCV1024

Post by MarkW »

Thanx Ben,

Seems pretty straight forward enough :D

Post Reply