Arduino Uno and ATMEL memory chip using SPI

I'm a little troubled by this:

void loop ()
  {
    
  eraseEEPROM (address);
  sensorValue = analogRead (analogInPin);
  writeEEPROM (address, (byte *) &sensorValue, sizeof sensorValue);
  
  readEEPROM (address, &reading, sizeof reading);  
  Serial.println (reading);
  
  address += sizeof sensorValue;
  }  // end of loop

Your main loop is going to take a reading and write it to the EEPROM, very rapidly. These chips are not designed for billions of writes. I would have expected you to place a delay (eg. a second) before writing another reading. That way your chip is written to much more slowly. I can't see on their spec sheet how many writes or erases it can tolerate, but it wouldn't be infinite.

The second issue is this line:

  eraseEEPROM (address);

According to the comments in my code:

// erase a 4Kb block of bytes which contains addr
void eraseEEPROM (const unsigned long addr)
{
  writeEnable ();

  notBusy ();  // wait until ready
  digitalWrite (CHIP_SELECT, LOW);
  sendCommandAndAddress (BlockErase4Kb, addr);
  digitalWrite (CHIP_SELECT, HIGH);  
  
}  // end of eraseEEPROM

That erase 4Kb every time (in other words, through your main loop you erase all 4 Kb of the initial memory, every time you take a reading. I take it this is unintentional?

The flash chips are designed so that you have to erase "pages" of data back to 0xFF, and then you write to them, which changes some 1s to 0s. You can't erase individual bytes.

So you really need to design in such a way that, when you change to a new 4Kb block, you erase it first. And then don't do it again until you move onto another 4Kb block.

This also relates to the issue of writing very quickly. Without some pause, you will have written to all the chip, erased, the data, and written over it, probably every minute or so.

You may also want to consider keeping track of the current position (to write to). Another recent post had the poster writing his current position to addresses 0/1, so he read that in at setup, to find where to write his next reading to. You might want to do something like that.