Arduino Uno with SPI (23lc1024 sram) returns always 255. First post

I have been having problems with saving data on an spi chip, 4x the 23lc1024, and was hoping if someone could help me out. ( I am using Arduino Uno)

This is the circuit and arduino connections for a SPI.
I have 4 SPI’s which share all the arduino pins but all need a unique SS pin (Digital pin 10 ->7)

This is the code:

#include <SPI.h>
 
//SRAM opcodes
#define RDSR        5
#define WRSR        1
#define READ        3
#define WRITE       2
  
//Byte transfer functions
uint8_t Spi23LC1024Read8(uint32_t address) {
  uint8_t read_byte;
 
  PORTB &= ~(1<<PORTB2);        //set SPI_SS low
  SPI.transfer(READ);
  SPI.transfer((uint8_t)(address >> 16) & 0xff);
  SPI.transfer((uint8_t)(address >> 8) & 0xff);
  SPI.transfer((uint8_t)address);
  read_byte = SPI.transfer(0x00);
  PORTB |= (1<<PORTB2);         //set SPI_SS high
  
  Serial.print("READ. ");
  Serial.print("address: ");
  Serial.print(address);
  Serial.print(", value: ");

  
  return read_byte;
}
  
void Spi23LC1024Write8(uint32_t address, uint8_t data_byte) {
  PORTB &= ~(1<<PORTB2);        //set SPI_SS low
  SPI.transfer(WRITE);
  SPI.transfer((uint8_t)(address >> 16) & 0xff);
  SPI.transfer((uint8_t)(address >> 8) & 0xff);
  SPI.transfer((uint8_t)address);
  SPI.transfer(data_byte);
  PORTB |= (1<<PORTB2);         //set SPI_SS high
  
  Serial.print("WRITE. ");
  Serial.print("address= ");
  Serial.print(address);
  Serial.print(", data byte= ");
  Serial.println(data_byte);
}
  
void setup(void) {
  uint32_t i;
  uint8_t value;
 
  Serial.begin(9600);
  SPI.begin();
 
 
  for (i=0; i<32; i++) {
    Spi23LC1024Write8(i, (uint8_t)i);
  }
    
  for (i=0; i<32; i++) {
    value = Spi23LC1024Read8(i);
    Serial.println((uint16_t)value);
  }
}
 
void loop() {
}

This is what the serial monitor returns:

WRITE. address= 0, data byte= 0
WRITE. address= 1, data byte= 1
WRITE. address= 2, data byte= 2
WRITE. address= 3, data byte= 3
WRITE. address= 4, data byte= 4
WRITE. address= 5, data byte= 5
WRITE. address= 6, data byte= 6
WRITE. address= 7, data byte= 7
WRITE. address= 8, data byte= 8
WRITE. address= 9, data byte= 9
WRITE. address= 10, data byte= 10
WRITE. address= 11, data byte= 11
WRITE. address= 12, data byte= 12
WRITE. address= 13, data byte= 13
WRITE. address= 14, data byte= 14
WRITE. address= 15, data byte= 15
WRITE. address= 16, data byte= 16
WRITE. address= 17, data byte= 17
WRITE. address= 18, data byte= 18
WRITE. address= 19, data byte= 19
WRITE. address= 20, data byte= 20
WRITE. address= 21, data byte= 21
WRITE. address= 22, data byte= 22
WRITE. address= 23, data byte= 23
WRITE. address= 24, data byte= 24
WRITE. address= 25, data byte= 25
WRITE. address= 26, data byte= 26
WRITE. address= 27, data byte= 27
WRITE. address= 28, data byte= 28
WRITE. address= 29, data byte= 29
WRITE. address= 30, data byte= 30
WRITE. address= 31, data byte= 31
READ. address: 0, value: 195
READ. address: 1, value: 191
READ. address: 2, value: 0
READ. address: 3, value: 253
READ. address: 4, value: 0
READ. address: 5, value: 0
READ. address: 6, value: 0
READ. address: 7, value: 145
READ. address: 8, value: 255
READ. address: 9, value: 255
READ. address: 10, value: 255
READ. address: 11, value: 255
READ. address: 12, value: 255
READ. address: 13, value: 255
READ. address: 14, value: 255
READ. address: 15, value: 247
READ. address: 16, value: 255
READ. address: 17, value: 255
READ. address: 18, value: 255
READ. address: 19, value: 255
READ. address: 20, value: 255
READ. address: 21, value: 255
READ. address: 22, value: 255
READ. address: 23, value: 255
READ. address: 24, value: 255
READ. address: 25, value: 255
READ. address: 26, value: 255
READ. address: 27, value: 255
READ. address: 28, value: 255
READ. address: 29, value: 255
READ. address: 30, value: 255
READ. address: 31, value: 253

The read values I get are always the same , So I guess the problem lays with the writing to the chip.
I hope someone can help me out here, many thanks

  1. Add some 0.1uF caps from Vcc pins to Gnd on each memory chip.

  2. Add some Serial.prints to see what address bytes you are actually getting. SPI.transfer((uint8_t)(address >> 16) & 0xff); SPI.transfer((uint8_t)(address >> 8 ) & 0xff); SPI.transfer((uint8_t)address);

I'm not sure these are creating the correct things.

CrossRoads: 1. Add some 0.1uF caps from Vcc pins to Gnd on each memory chip.

  1. Add some Serial.prints to see what address bytes you are actually getting. SPI.transfer((uint8_t)(address >> 16) & 0xff); SPI.transfer((uint8_t)(address >> 8 ) & 0xff); SPI.transfer((uint8_t)address);

I'm not sure these are creating the correct things.

Thanks for the reply. I edited the post with some more serial prints, the read-values I get are always the same , even if I change the write value to the chip.

I do not have these capacitors right now

JordyR:
I have been having problems with saving data on an spi chip, 4x the 23lc1024, and was hoping if someone could help me out. ( I am using Arduino Uno)

This is the circuit and arduino connections for a SPI.
I have 4 SPI’s which share all the arduino pins but all need a unique SS pin (Digital pin 10 ->7)

You need to initially set the SS pins to HIGH. By Default the PORTn values are Zero (LOW). Just setting them to output mode selects all chips at the same time. Each is trying to drive MISO.

You probably want to set the chips to Sequential mode also, By configuring the MODE register (opCode 0x01).

My reading of the DataSheet shows this chip requires SPIMODE1,MSBfirst,and can run faster than the Arduino Uno.

so:

#include <SPI.h>
#define SS0 10
#define SS1 9 // whatever pin you actual have connected
#define SS2 8
#define SS3 7


void initRAM( uint8_t csPin){
SPI.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE1));
digitalWrite(csPin,LOW); // select SPI Ram
SPI.transfer(0x01); // write to Mode Register
SPI.transfer(0x40); // set sequential mode
digitalWrite(csPin,HIGH); // DeSelect SPI ram chip
SPI.endTransaction();
}

void writeSPIByte(uint8_t csPin, unsigned long adr, uint8_t dataByte){
SPI.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE1));
digitalWrite(csPin,LOW); // select SPI Ram
SPI.transfer(0x02); // write command
SPI.transfer((uint8_t)((adr>>16)&0xFF));
SPI.transfer((uint8_t)((adr>>8)&0xFF));
SPI.transfer((uint8_t)(adr&0xFF));
SPI.transfer(dataByte);
digitalWrite(csPin,HIGH); // DeSelect SPI ram chip
SPI.endTransaction();
}

void writeSPIWord(uint8_t csPin, unsigned long adr, uint16_t dataWord){
SPI.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE1));
digitalWrite(csPin,LOW); // select SPI Ram
SPI.transfer(0x02); // write command
SPI.transfer((uint8_t)((adr>>16)&0xFF));
SPI.transfer((uint8_t)((adr>>8)&0xFF));
SPI.transfer((uint8_t)(adr&0xFF));
SPI.transfer16(dataWord);
digitalWrite(csPin,HIGH); // DeSelect SPI ram chip
SPI.endTransaction();
}

uint8_t readSPIByte(uint8_t csPin, unsigned long adr){
SPI.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE1));
digitalWrite(csPin,LOW); // select SPI Ram
SPI.transfer(0x03); // READ command
SPI.transfer((uint8_t)((adr>>16)&0xFF));
SPI.transfer((uint8_t)((adr>>8)&0xFF));
SPI.transfer((uint8_t)(adr&0xFF));
uint8_t result = SPI.transfer(0);
digitalWrite(csPin,HIGH); // DeSelect SPI ram chip
SPI.endTransaction();
return result;
}

uint16_t readSPIWord(uint8_t csPin, unsigned long adr){
SPI.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE1));
digitalWrite(csPin,LOW); // select SPI Ram
SPI.transfer(0x03); // READ command
SPI.transfer((uint8_t)((adr>>16)&0xFF));
SPI.transfer((uint8_t)((adr>>8)&0xFF));
SPI.transfer((uint8_t)(adr&0xFF));
uint16_t result = SPI.transfer16(0);
digitalWrite(csPin,HIGH); // DeSelect SPI ram chip
SPI.endTransaction();
return result;
}

void setup(){
  Serial.begin(9600);
  Serial.print("Abracadabra!");

// turn all CS pin off (high)

  digitalWrite(SS0,HIGH);
  digitalWrite(SS1,HIGH);
  digitalWrite(SS2,HIGH);
  digitalWrite(SS3,HIGH);

// Drive CS pins
  pinMode(SS0,OUTPUT);
  pinMode(SS1,OUTPUT);
  pinMode(SS2,OUTPUT);
  pinMode(SS3,OUTPUT);

// init SPI hardware
  SPI.begin();
  initRAM(SS0);
  initRAM(SS1);
  initRAM(SS2);
  initRAM(SS3);


unsigned long adr;
Serial.println("Write out as Bytes:");
for(adr=0;adr<32;adr++){
  writeSPIByte(SS0,adr,(uint8_t)adr);
  }

Serial.println("Read out as Words:");
for(adr=0;adr<32;adr++){
  uint16_t a = readSPIWord(SS0,adr);
  char buf[50];
  sprintf(buf,"0x%04X : 0x%04X",(uint16_t)adr,a);
  Serial.println(buf);

  }
}

void loop(){}

Try this see if it works?

Chuck.

Try this see if it works?

Chuck.

Thanks for the reply Chuck , I added some serial prints to your code and this is the output I get:

Write out as Bytes:
WRITE. adress: 0, dataByte: 0
WRITE. adress: 1, dataByte: 1
WRITE. adress: 2, dataByte: 2
WRITE. adress: 3, dataByte: 3
WRITE. adress: 4, dataByte: 4
WRITE. adress: 5, dataByte: 5
WRITE. adress: 6, dataByte: 6
WRITE. adress: 7, dataByte: 7
WRITE. adress: 8, dataByte: 8
WRITE. adress: 9, dataByte: 9
WRITE. adress: 10, dataByte: 10
WRITE. adress: 11, dataByte: 11
WRITE. adress: 12, dataByte: 12
WRITE. adress: 13, dataByte: 13
WRITE. adress: 14, dataByte: 14
WRITE. adress: 15, dataByte: 15
WRITE. adress: 16, dataByte: 16
WRITE. adress: 17, dataByte: 17
WRITE. adress: 18, dataByte: 18
WRITE. adress: 19, dataByte: 19
WRITE. adress: 20, dataByte: 20
WRITE. adress: 21, dataByte: 21
WRITE. adress: 22, dataByte: 22
WRITE. adress: 23, dataByte: 23
WRITE. adress: 24, dataByte: 24
WRITE. adress: 25, dataByte: 25
WRITE. adress: 26, dataByte: 26
WRITE. adress: 27, dataByte: 27
WRITE. adress: 28, dataByte: 28
WRITE. adress: 29, dataByte: 29
WRITE. adress: 30, dataByte: 30
WRITE. adress: 31, dataByte: 31


Read out as Bytes:
READ_BYTE. adress: 0, result: 255
READ_BYTE. adress: 1, result: 255
READ_BYTE. adress: 2, result: 255
READ_BYTE. adress: 3, result: 255
READ_BYTE. adress: 4, result: 255
READ_BYTE. adress: 5, result: 255
READ_BYTE. adress: 6, result: 255
READ_BYTE. adress: 7, result: 255
READ_BYTE. adress: 8, result: 255
READ_BYTE. adress: 9, result: 255
READ_BYTE. adress: 10, result: 255
READ_BYTE. adress: 11, result: 255
READ_BYTE. adress: 12, result: 255
READ_BYTE. adress: 13, result: 255
READ_BYTE. adress: 14, result: 255
READ_BYTE. adress: 15, result: 255
READ_BYTE. adress: 16, result: 255
READ_BYTE. adress: 17, result: 255
READ_BYTE. adress: 18, result: 255
READ_BYTE. adress: 19, result: 255
READ_BYTE. adress: 20, result: 255
READ_BYTE. adress: 21, result: 255
READ_BYTE. adress: 22, result: 255
READ_BYTE. adress: 23, result: 255
READ_BYTE. adress: 24, result: 255
READ_BYTE. adress: 25, result: 255
READ_BYTE. adress: 26, result: 255
READ_BYTE. adress: 27, result: 255
READ_BYTE. adress: 28, result: 255
READ_BYTE. adress: 29, result: 255
READ_BYTE. adress: 30, result: 255
READ_BYTE. adress: 31, result: 255


Read out as Words:
READ_WORD. adress: 0, result: 65535 ,      buf[50]: (0x0000 : 0xFFFF)
READ_WORD. adress: 1, result: 65535 ,      buf[50]: (0x0001 : 0xFFFF)
READ_WORD. adress: 2, result: 65535 ,      buf[50]: (0x0002 : 0xFFFF)
READ_WORD. adress: 3, result: 65535 ,      buf[50]: (0x0003 : 0xFFFF)
READ_WORD. adress: 4, result: 65535 ,      buf[50]: (0x0004 : 0xFFFF)
READ_WORD. adress: 5, result: 65535 ,      buf[50]: (0x0005 : 0xFFFF)
READ_WORD. adress: 6, result: 65535 ,      buf[50]: (0x0006 : 0xFFFF)
READ_WORD. adress: 7, result: 65535 ,      buf[50]: (0x0007 : 0xFFFF)
READ_WORD. adress: 8, result: 65535 ,      buf[50]: (0x0008 : 0xFFFF)
READ_WORD. adress: 9, result: 65535 ,      buf[50]: (0x0009 : 0xFFFF)
READ_WORD. adress: 10, result: 65535 ,      buf[50]: (0x000A : 0xFFFF)
READ_WORD. adress: 11, result: 65535 ,      buf[50]: (0x000B : 0xFFFF)
READ_WORD. adress: 12, result: 65535 ,      buf[50]: (0x000C : 0xFFFF)
READ_WORD. adress: 13, result: 65535 ,      buf[50]: (0x000D : 0xFFFF)
READ_WORD. adress: 14, result: 65535 ,      buf[50]: (0x000E : 0xFFFF)
READ_WORD. adress: 15, result: 65535 ,      buf[50]: (0x000F : 0xFFFF)
READ_WORD. adress: 16, result: 65535 ,      buf[50]: (0x0010 : 0xFFFF)
READ_WORD. adress: 17, result: 65535 ,      buf[50]: (0x0011 : 0xFFFF)
READ_WORD. adress: 18, result: 65535 ,      buf[50]: (0x0012 : 0xFFFF)
READ_WORD. adress: 19, result: 65535 ,      buf[50]: (0x0013 : 0xFFFF)
READ_WORD. adress: 20, result: 65535 ,      buf[50]: (0x0014 : 0xFFFF)
READ_WORD. adress: 21, result: 65535 ,      buf[50]: (0x0015 : 0xFFFF)
READ_WORD. adress: 22, result: 65535 ,      buf[50]: (0x0016 : 0xFFFF)
READ_WORD. adress: 23, result: 65535 ,      buf[50]: (0x0017 : 0xFFFF)
READ_WORD. adress: 24, result: 65535 ,      buf[50]: (0x0018 : 0xFFFF)
READ_WORD. adress: 25, result: 65535 ,      buf[50]: (0x0019 : 0xFFFF)
READ_WORD. adress: 26, result: 65535 ,      buf[50]: (0x001A : 0xFFFF)
READ_WORD. adress: 27, result: 65535 ,      buf[50]: (0x001B : 0xFFFF)
READ_WORD. adress: 28, result: 65535 ,      buf[50]: (0x001C : 0xFFFF)
READ_WORD. adress: 29, result: 65535 ,      buf[50]: (0x001D : 0xFFFF)
READ_WORD. adress: 30, result: 65535 ,      buf[50]: (0x001E : 0xFFFF)
READ_WORD. adress: 31, result: 65535 ,      buf[50]: (0x001F : 0xFFFF)

JordyR:
Thanks for the reply Chuck , I added some serial prints to your code and this is the output I get:

Jordy,

I have a 23LC512 connected to a Mega2560, I tried my code, It failed with different data values (0x00) instead of your 0xFF.

I had the SPI_MODE wrong. Attached is working code for a 23LC512.

Chuck.

p.s. here is my circuit.

spiRam.ino (3.38 KB)

spiRam.txt (1.18 KB)

SCH 23LC512.jpg

chucktodd: Jordy,

I have a 23LC512 connected to a Mega2560, I tried my code, It failed with different data values (0x00) instead of your 0xFF.

I had the SPI_MODE wrong. Attached is working code for a 23LC512.

Chuck.

p.s. here is my circuit.

Thanks Chuck ! at first it didn't seem to work and I got all 255's as return value. But then I tried to send the data to just one SPI with all connections solely to that one and it worked!

Hower I can't find a solution to how to use 4 spi's , since sharing pin 13-11 (sck,miso,mosi) between the spi's causes errors.

JordyR:
Thanks Chuck ! at first it didn’t seem to work and I got all 255’s as return value.
But then I tried to send the data to just one SPI with all connections solely to that one and it worked!

Hower I can’t find a solution to how to use 4 spi’s , since sharing pin 13-11 (sck,miso,mosi) between the spi’s causes errors.

Jordy,

Maybe one of them is bad. Connect them one at a time. See if they individually work.

Change the sketch so that you can individually select each RAM, use an Arduino pin as a switch that you can ground to select each RAM individually. Verify that all of the other RAM’s CS pins are HIGH, Only the selected one should be low.

My Mega2560 board has a 23LC512, SDcard, ADS1118 (ADC), W25Q64FV (8MB flash) all sharing the SPI interface. I use a TX0104 as a voltage level shifter between the 5V Arduino and the 3.3V SDcard, Flash.

It all works just fine.

Unless you have a pullup on the MISO line(which you should not), The MISO line should be floating. All of the Devices on the SPI bus should triState their output unless they are selected. Verify your CS voltages and the MISO line voltage.

Attach is my working complete SPI schematic, except for the ADS1118.

Chuck.

chucktodd: Jordy,

Maybe one of them is bad. Connect them one at a time. See if they individually work.

Change the sketch so that you can individually select each RAM, use an Arduino pin as a switch that you can ground to select each RAM individually. Verify that all of the other RAM's CS pins are HIGH, Only the selected one should be low.

My Mega2560 board has a 23LC512, SDcard, ADS1118 (ADC), W25Q64FV (8MB flash) all sharing the SPI interface. I use a TX0104 as a voltage level shifter between the 5V Arduino and the 3.3V SDcard, Flash.

It all works just fine.

Unless you have a pullup on the MISO line(which you should not), The MISO line should be floating. All of the Devices on the SPI bus should triState their output unless they are selected. Verify your CS voltages and the MISO line voltage.

Attach is my working complete SPI schematic, except for the ADS1118.

Chuck.

Got it to work ! The problem was in some of the cabling I added another ground from the arduino solely for the SPI's and it worked . Thanks for the help !

Another little question about the baud rate, I want to sample the output of an micrphone with preamplifier circuit on A0 of th arduino (with adc prescaler set 64) so there are now 19,231 samples / seconds (=19kHz).

What I need is to sample at exactly 16kHz. Is this possible by changing the baud rate to 16000 ?

JordyR: Got it to work ! The problem was in some of the cabling I added another ground from the arduino solely for the SPI's and it worked . Thanks for the help !

Another little question about the baud rate, I want to sample the output of an micrphone with preamplifier circuit on A0 of th arduino (with adc prescaler set 64) so there are now 19,231 samples / seconds (=19kHz).

What I need is to sample at exactly 16kHz. Is this possible by changing the baud rate to 16000 ?

no, the SPI baudrate is network length and capacitance dependent. I would set the SPISettings baud to either 4000000L or to your slowest SPI hardware.

If you want exactly 16khz sample rate, you will have to reprogram one to the timers to generate your 16khz interval, attach some code to the timer interrupt that initiates a ADC sample, attach code to the ADC complete interrupt to save the data. Your foreground task will need to process/save your samples before your ADC sample buffer overflows.

The standard Arduino analogRead() fuction is a blocking call. It stalls the processor waiting for the ADC to complete its acquisition. You will have to directly control the AVR hardware instead of relying on the Arduino environment. Read the Atmel Mega328p datasheet

You are going to have to understand the ADC hardware, and Timers.

Chuck.

I have a bunch of the 24LC1024 chips.
I have been hooking them up to my Mini Pro Arduinos.

But, I am having reliability problems also with the 23LC1024.

Sometimes I can get them to work - but still get random errors.
Other times. I get nothing at all, just all 0’s or all 255’s.

Are there any known problems ?

  • I have tried direct connects from +V to p7-HOLD and p3, also 10k resistor tie-ups.
    Also a 10k tie up to p1-CS.
  • The Arduinos are powered with +5V.
  • I have tried a few of the SpiRam & SpiRamExtended Libs including the one on the Arduino Playground page.

Ex:

//  Microchip 23LC512

#include <SPI.h>
 
//SRAM opcodes
#define RDSR        5
#define WRSR        1
#define READ        3
#define WRITE       2
  
//Byte transfer functions
uint8_t Spi23LC1024Read8(uint32_t address) 
{
  uint8_t read_byte;
 
  PORTB &= ~(1<<PORTB2);        //set SPI_SS low
    SPI.transfer(READ);
    SPI.transfer((uint8_t)(address >> 16) & 0xff);
    SPI.transfer((uint8_t)(address >> 8) & 0xff);
    SPI.transfer((uint8_t)address);
      read_byte = SPI.transfer(0x00);
  PORTB |= (1<<PORTB2);         //set SPI_SS high
return read_byte;
}
  
void Spi23LC1024Write8(uint32_t address, uint8_t data_byte) 
{
  PORTB &= ~(1<<PORTB2);        //set SPI_SS low
    SPI.transfer(WRITE);
    SPI.transfer((uint8_t)(address >> 16) & 0xff);
    SPI.transfer((uint8_t)(address >> 8) & 0xff);
    SPI.transfer((uint8_t)address);
      SPI.transfer(data_byte);
  PORTB |= (1<<PORTB2);         //set SPI_SS high
}
  
void setup(void) 
{
  Serial.begin(9600);
  SPI.begin();
}
 
void loop() 
{
  uint32_t i;
  uint8_t value;

  for (i=0; i<32; i++) 
  {
    Spi23LC1024Write8(i, (uint8_t)i);
    value = Spi23LC1024Read8(i);
    Serial.println((uint16_t)value);
  }
}

jlsilicon:
I have a bunch of the 24LC1024 chips.
I have been hooking them up to my Mini Pro Arduinos.

But, I am having reliability problems also with the 23LC1024.

Sometimes I can get them to work - but still get random errors.
Other times. I get nothing at all, just all 0’s or all 255’s.

Are there any known problems ?

  • I have tried direct connects from +V to p7-HOLD and p3, also 10k resistor tie-ups.
    Also a 10k tie up to p1-CS.
  • The Arduinos are powered with +5V.
  • I have tried a few of the SpiRam & SpiRamExtended Libs including the one on the Arduino Playground page.

Ex:

//  Microchip 23LC512

#include <SPI.h>

//SRAM opcodes
#define RDSR        5
#define WRSR        1
#define READ        3
#define WRITE      2
 
//Byte transfer functions
uint8_t Spi23LC1024Read8(uint32_t address)
{
  uint8_t read_byte;

PORTB &= ~(1<<PORTB2);        //set SPI_SS low
    SPI.transfer(READ);
    SPI.transfer((uint8_t)(address >> 16) & 0xff);
    SPI.transfer((uint8_t)(address >> 8) & 0xff);
    SPI.transfer((uint8_t)address);
      read_byte = SPI.transfer(0x00);
  PORTB |= (1<<PORTB2);        //set SPI_SS high
return read_byte;
}
 
void Spi23LC1024Write8(uint32_t address, uint8_t data_byte)
{
  PORTB &= ~(1<<PORTB2);        //set SPI_SS low
    SPI.transfer(WRITE);
    SPI.transfer((uint8_t)(address >> 16) & 0xff);
    SPI.transfer((uint8_t)(address >> 8) & 0xff);
    SPI.transfer((uint8_t)address);
      SPI.transfer(data_byte);
  PORTB |= (1<<PORTB2);        //set SPI_SS high
}
 
void setup(void)
{
  Serial.begin(9600);
  SPI.begin();
}

void loop()
{
  uint32_t i;
  uint8_t value;

for (i=0; i<32; i++)
  {
    Spi23LC1024Write8(i, (uint8_t)i);
    value = Spi23LC1024Read8(i);
    Serial.println((uint16_t)value);
  }
}

I would check your circuit, do you have at least one 0.1uf cap for each 23LC512 (between VCC and Gnd).

Make sure your set the Mode opCode 0x01, to sequential.

Chuck.

I debugged the problem.

The Breadboards were not reliable enough.

I removed the SPI RAM chip from the Breadboard and connected it directly to the Arduino via Jumpers - and it worked fine.