lpcware

LPC2132

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by mrdjoni on Mon Sep 28 07:01:35 MST 2015
Hi,

I have strange problem with this chip - LPC2132.
I can copy whole EPROM to another by using I2C.
Problem is I can do that only one time!!!
I work with interrupt routines. After first full succesful  copy of 32KB data next time it can't enter STA interrupt. Like someone is holding communication busy.
I measure signal on sck and all is ok so everything is ready for new data transfer but... it stuck.

In first data copy, STA is activated after every 128B of data so very much...
Why it stucks when I want to do that second time I don't know.
Can someone help me?

Thank you.

Here is code last executed by MCU, after that it stops:

unsigned char I2C0Transfer(unsigned char eAddr, unsigned short pAddr, unsigned char *buff, unsigned int length)
{
unsigned char functStatus=FAIL;

data_counter=0;
address_16_sent=0;
VICVectAddr=0;

I2C0CONCLR=I2C_RESET;  // Clear I2C - included if User forgot to "StopI2C()" else this function would hang., already done in IRQ and init
I2C0CONSET=I2C_EN;     // Active Master Mode on I2C bus
comm_started=1;
data_bytes=buff;
if(length>128)
{
i2c0_state=I2C_FAIL;
functStatus=FAIL;
}
data_length=length;
pAddr_Eprom_High=(unsigned char)highByte(pAddr);
pAddr_Eprom_Low=(unsigned char)pAddr;
eAddr_Eprom=eAddr;

I2C0CONSET = I2C_STA;// set STA dont allow acknowledges
i2c0_state=I2C_IN_PROGRESS;
functStatus=SUCCESS;

return functStatus;
}

Outcomes