We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.
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