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

I2C and CAN protocols not working

I2C and CAN not working in LPC1768
I am using two nos. LPC1768 header boards from different manufacturers. And if I try to communicate using I2C and CAN through both controllers, nothing is transmitting. But if I try to use UART on each controller and its working wonderful. Also whatever the I2C and CAN code written is working with other controllers which are of same manufacturers. I am not getting whats the wrong with these controllers and any hardware configuration to be changed. Also I want to know how to debug I2C protocol in this scenario and I don't have any oscilloscope or analyzer.

Parents
  • Hi Andrew Neil,

    I have connected external pull-up resistors (i.e. 4.7K-Ohm) in both SDA and SCL lines of I2C using board 3.3V supply. And now the I2C interface is working fine between two microcontrollers also. It seems to be I2C LCD driver might have included inbuilt pull-up resistors and that's the reason I2C LCD worked fine without any problem. Anyway thanks for your guidance and support.

Reply
  • Hi Andrew Neil,

    I have connected external pull-up resistors (i.e. 4.7K-Ohm) in both SDA and SCL lines of I2C using board 3.3V supply. And now the I2C interface is working fine between two microcontrollers also. It seems to be I2C LCD driver might have included inbuilt pull-up resistors and that's the reason I2C LCD worked fine without any problem. Anyway thanks for your guidance and support.

Children
  • Yes, that would seem the obvious conclusion from what you posted on 6-Nov-2018 18:04 GMT.

  • Hi Andrew Neil,

    I am trying to use external interrupt with the following code using LPC1768 micro controller. I have connected P2.10 and P2.11 to switches and GPIO0 used to connect the LED's. When I press the switches no LED is going on Port 0. But after pressing reset the LEDs are glowing twice because of only reset button. And the code is shown below for your suggestion. I have posted in another thread but no one is helping and requesting to see this problem.

       #include<LPC17xx.h>
    
            #define EXTMODE0        0
            #define EXTMODE1        1
    
            #define EXTPOLAR0       0
            #define EXTPOLAR1       1
    
            #define EINT0_PIN       20
            #define EINT1_PIN       22
    
            void delay(unsigned int value)
            {
                    unsigned int i, j;
                    for(i = 0; i < value; i++)
                    for(j = 0; j < 2500; j++);
            }
    
            void EINT0_IRQHandler()
            {
                    LPC_SC->EXTINT = (1<<0);  //clearing interrupt bit
                    LPC_GPIO0->FIOSET = 0xffffffff;
                    delay(1000);
                    LPC_GPIO0->FIOCLR = 0xffffffff;
                    delay(1000);
            }
    
            void EINT1_IRQHandler()
            {
                    LPC_SC->EXTINT = (1<<1); //clearing interrupt bit
                    LPC_GPIO0->FIOSET = 0xffffffff;
                    delay(1000);
                    LPC_GPIO0->FIOCLR = 0xffffffff;
                    delay(1000);
            }
    
            int main()
            {
                    LPC_SC->EXTMODE = (0<<EXTMODE0)|(0<<EXTMODE1);  //level-sensitive mode
                    LPC_SC->EXTPOLAR = (0<<EXTPOLAR0)|(0<<EXTPOLAR1); //low active state
                    LPC_PINCON->PINSEL4 = (1<<EINT0_PIN)|(1<<EINT1_PIN);  //switches connected to P2.10 and P2.11
    
                    LPC_GPIO0->FIODIR = 0xffffffff;
    
                    NVIC_EnableIRQ(EINT0_IRQn);
                    NVIC_EnableIRQ(EINT1_IRQn);
    
                    while(1);
            } </prep