Forums

I2C problems when UART1 interrupt enabled

Started by "Mau...@yahoo.com.br [lpc2000]" August 18, 2015
Hi guys,I'm having some problems using I2C whit UART1 interrupt. I have the I2C0 working fine on a NXP LPC2378 and use it to read a serial EEPROM from Microchip (24LC512) and my system answers to MODBUS commands over UART1. To improve better communication, I'm intended to use interrupts for the UART1. When I enable the interrupts, the system works fine until I make the first request over UART1. After this, It seems that the SI bit of I20CONSET (I2C interrupt bit) isn't set anymore or is cleared over the UART1 read process and I stay in a loop waiting this bit to be set to get a new status of the I2C bus.Have anyone had this problem one time?My UART1 init routine contais:void init_UART1(void){      PINSEL4 |= 0x0000000A;             //enable TXD1 and RXD1 (on P2.0 and P2.1)
      PCONP   |= (1<<4);                     //power up UART1
      U1FCR    = 0x07;                       //enable FIFOs and reset
      U1FDR    = 0x00;                      //fractional part of baurate
      U1LCR    = 0x83;                      //length, stop bits an parity config
      U1DLL    = 0x75;                      //low baud rate
      U1DLM    = 0x00;                      //high baud rate
      U1LCR    = 0x03
      U1IER    = 0x01;                        //enable to generate a interrupt
}
and the routine I'm having problems on I2c is to check the I2c status:uint8 MA_CheckStatus_I2C0 (void)
{
     uint8 Status;

     //wait status change
     while ((I20CONSET & 0x08)==0);

     Status = I20STAT;                            //read the status code

     return Status;
}

Can anyone give me guideline over what is happening?
Best Regards.

An Engineer's Guide to the LPC2100 Series

Why didn't you post the UART interrupt code if that's the bit you suspect of mangling the I2C interrupt?
Could it be that you are mishandling the VIC?
You could zip up the entire (relevant) code and post it in the Files folder if it is too long for a message.