This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

several Interrupts at the same time

Hi,

working with the LPC1758 controller, I've some problems with the interrupts. I use the interfaces I2C1 and SPI. Both interfaces are configurated using interrupts.

After the initalization I start an SPI write request of several bytes and after that I start also an I2C read request (to read some bytes from an external eeprom). Unfortunately I'm not able to get the bytes from the I2C eeprom due to some problems with the interrupt; receiving 8 bytes by eeprom, I will get 8 interrupt request, but the first interrupt reads the third byte instead of the first byte. Maybe the i2c data register will be overwritten twice.

BTW: if I wait until the spi write request completes, I'm able to receive the 8 bytes by the eeprom as expected. Of course the received byte values are correct.

In a second test, I create a SPI irq handler which will always send a byte to SPI. In this situation the i2c irq will be called only once (for the start byte). Very strange to me.

void SPI_IRQHandler(void)
{
        unsigned int state = LPC_SPI->SPSR;
        unsigned int dummy;
        LPC_SPI->SPINT |= SPIINT_SPIF;

        dummy = LPC_SPI->SPDR;
        LPC_SPI->SPDR = 0x12;
 }
void I2C1_IRQHandler(void)
{
   unsigned int state = LPC_I2C1->I2STAT;
   switch(state)
   {
     //state machine (start condition, repeated start condition and so on
   }

   LPC_I2C1->I2CONCLR |= I2CONCLR_SIC;
}

Is this behaviour correct?

best regards
Lars