Hi,
I try to write some data to EEPROM of BBB out of own (bare-metal) software. Reading data works fine and code for writing should be OK too, unfortunately data are sent to EEPROM but not written.
From schematic I found EEPROMs WP-input has to be pulled to Vss so I connected TP4 of BBB with ground (pins 1/2 of P9). Unfortunately this also did not help.
So...anything else that could be missing?
Thanks!
So...anything else that could be missing?
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
void writeEEPROM(unsigned int addr,unsigned int length,const unsigned char *data)
{
I2CPinMuxSetup(0);
SetupI2C();
I2CAINTCConfigure();
E2promWrite(addr,length,data);
}
static void SetupI2C(void)
{
I2C0ModuleClkConfig();
I2CMasterDisable(SOC_I2C_0_REGS);
I2CAutoIdleDisable(SOC_I2C_0_REGS);
I2CMasterInitExpClk(SOC_I2C_0_REGS, 48000000, 12000000, 100000);
I2CMasterSlaveAddrSet(SOC_I2C_0_REGS, I2C_SLAVE_ADDR);
I2CMasterEnable(SOC_I2C_0_REGS);
}
static void E2promWrite(unsigned int addr,unsigned int length,const unsigned char *data)
{
dataToSlave[0]=(unsigned char)(addr >> 8);
dataToSlave[1]=(unsigned char)(addr & 0xFF);
memcpy((void*)&dataToSlave[2],data,length);
tCount=0;
rCount=0;
SetupI2CTransmission(length);
}
static void SetupI2CTransmission(unsigned int dcount)
{
I2CSetDataCount(SOC_I2C_0_REGS,0x02+dcount);
numOfBytes=I2CDataCountGet(SOC_I2C_0_REGS); //Why not use dcount?
CleanUpInterrupts();
I2CMasterControl(SOC_I2C_0_REGS,I2C_CFG_MST_TX);
I2CMasterIntEnableEx(SOC_I2C_0_REGS,I2C_INT_TRANSMIT_READY);
I2CMasterStart(SOC_I2C_0_REGS);
while (I2CMasterBusBusy(SOC_I2C_0_REGS)==0);
while (tCount!=numOfBytes);
I2CMasterStop(SOC_I2C_0_REGS);
}OK, so that's my current code, based on StarterWare example, writeEEPROM() is called e.g. with addr=4 and length=4 plus some reasonable data:
voidwriteEEPROM(unsignedintaddr,unsignedintlength,constunsignedchar*data)
...
--
Make sure you remove the write protect that is on the EEPROM