daniel
(Daniel kirubakaran)
March 21, 2019, 5:12am
1
I would like to start a drone project. I have analysed some sample arduino uno based drone projects , they have used EEPROM.h library and Wire.h lib as well. Since Westerndigital has provided i2c library,i am ok with that. Now,is there any alternative solution for this EEPROM library ? Which is not available for Hifive1.
Thank you.
laanwj
(Wladimir van der Laan)
March 21, 2019, 1:02pm
2
On the HiFive1 it’s possible to write to the SPI flash from the device itself. This is more or less equivalent to an EEPROM, I think? I don’t know of any example code for this, though.
daniel
(Daniel kirubakaran)
March 22, 2019, 4:21am
3
I will search for it.
Thank you.
laanwj
(Wladimir van der Laan)
March 22, 2019, 6:35am
4
@mhamrick mentions having done it here:
i actually did this for a customer. (code that runs in RAM and writes FLASH.) Megan describes the fespi driver in this post from way back when:
i was also able to run TINY BASIC on the HiFive1, but still trying to figure out how to modify it to allow me to do GPIO twiddling.
Don’t know if there’s source available, but that thread might give some more information.
daniel
(Daniel kirubakaran)
April 10, 2019, 5:51am
5
I just bought a 24LC512 chip and tried with SlowSoftWire library.
It worked !!
code:
#include <SlowSoftWire.h>
SlowSoftWire Wire = SlowSoftWire(2, 3);
#define EEPROM_I2C_ADDRESS 0x50
void setup()
{
Serial.begin(57600);
Wire.begin();
Wire.setClock(400000L);
delay(250);
int address1 = 0;
byte val = 110;
int address2 = 1;
byte val2 = 25;
writeAddress(address1, val);
byte readVal = readAddress(address1);
writeAddress(address2, val2);
byte readVal2 = readAddress(address2);
Serial.print("The returned value1 is ");
Serial.println(readVal);
Serial.println("The returned value2 is ");
Serial.println(readVal2);
}
void loop()
{
}
void writeAddress(int address, byte val)
{
Wire.beginTransmission(EEPROM_I2C_ADDRESS);
Wire.write((int)(address >> 8)); // MSB
Wire.write((int)(address & 0xFF)); // LSB
Wire.write(val);
Wire.endTransmission();
delay(5);
}
byte readAddress(int address)
{
byte rData = 0xFF;
Wire.beginTransmission(EEPROM_I2C_ADDRESS);
Wire.write((int)(address >> 8)); // MSB
Wire.write((int)(address & 0xFF)); // LSB
Wire.endTransmission();
Wire.requestFrom(EEPROM_I2C_ADDRESS, 1);
rData = Wire.read();
return rData;
}
Thank you.