Go Down

Topic: make Arduino act as EEPROM (Read 1 time) previous topic - next topic

aureliusss

hi everyone,
i'm trying to power a gopro hero3 through the bus connector, so i need Arduino to act as a simple eeprom.
In this case i need to write value 9 to address 0 of eeprom so that the camera recognises arduino as a valid accessory.

http://www.benthicscience.com/beta/products/custom-builds/gopro-hero3-bus-access

how can i make Arduino act as an eeprom so that each time the gopro reads the bus Arduino returns the requested value?

thank a lot

Erdin

A single byte addressable EEPROM is possible.
But since the Arduino uses a software library, it sometimes stretches the clock. If the Master is not capable to do that, the Arduino will not work.

http://arduino.cc/en/Tutorial/MasterReader
http://arduino.cc/en/Tutorial/MasterWriter

The Arduino should use the onRequest and onReceive handlers. The onRequest for EEPROM data, the onReceive to receive the address byte.

The Arduino as I2C Slave does not know how many bytes are read by the Master with onRequest. So you do not know how much the address byte should be incrementend. That is not implemented in the library.

aureliusss

So what do you think is wrong with this code
Code: [Select]
#include <Wire.h>
#include <EEPROM.h>
void setup() {
  // put your setup code here, to run once:
  EEPROM.write(0,9); //Write 0x09 at address 0 of the eeprom
  Wire.begin(0);     //Join I2C bus with address 0
  Wire.onRequest(requestEvent); // register Event
}

void loop() {
  // put your main code here, to run repeatedly:
 
}
void requestEvent()
{

  Wire.write(EEPROM.read(0));
}

Erdin

The I2C address is the address of the I2C device.
The EEPROM register address selecting is the address inside the EEPROM. It is written to the EEPROM before data is read.

I2C address '0' is reserved. You have to find the I2C address of the original EEPROM, and use that for Wire.begin.

You sketch also needs the onReive, to receive the single byte register address.

aureliusss

what do you mean for ''address of the original EEPROM"?

Go Up