<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521176#M4035</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by 00zigor on Fri Sep 12 13:26:44 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Will do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Specialy because this little bugger just stoped working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe things will get a little easier using LPCOpen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tanks again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:49:49 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:49:49Z</dc:date>
    <item>
      <title>LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521167#M4026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by 00zigor on Thu Sep 11 14:18:53 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, everyone.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've just started working on LPC1769 on an custom board and i'm having problems getting the CAN BUS to work using the drivers and software examples provided here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After some research here i've read that the drivers has a lot of bugs, and the links i've found pointing to new drivers always redirect to home in LPCware.com.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I can't find new drivers or examples more up to date.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using a simple MCP2551 transceiver to recieve a messagem from another device transmitting every 10ms.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I already used a similar driver on LPC1788 and it worked fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using a osciloscope i made sure that the signal is reaching the transceiver and is wired to the correct pins on the 1769.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to enable CAN RX interruption but when the data comes the interruption doesn't happen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the exmple code before anyone asks:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;

/*********************************************************************//**
 * @briefCAN_IRQ Handler, control receive message operation
 * param[in]none
 * @return none
 **********************************************************************/
void CAN_IRQHandler()
{
uint8_t IntStatus;

IntStatus = CAN_IntGetStatus(LPC_CAN1);

//check receive interrupt
if((IntStatus &amp;gt;&amp;gt; 0) &amp;amp; 0x01)
{
TOGGLE_RX_LED;

}
}

int main(void) {

&amp;nbsp; /* Pin configuration
&amp;nbsp;&amp;nbsp; * CAN1: select P0.21 as RD1. P0.22 as TD1 */
&amp;nbsp;&amp;nbsp;&amp;nbsp; PinCfg.Funcnum = 2;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PinCfg.OpenDrain = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PinCfg.Pinmode = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PinCfg.Pinnum = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PinCfg.Portnum = 21;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PINSEL_ConfigPin(&amp;amp;PinCfg);
&amp;nbsp;&amp;nbsp;&amp;nbsp; PinCfg.Pinnum = 22;
&amp;nbsp;&amp;nbsp;&amp;nbsp; PINSEL_ConfigPin(&amp;amp;PinCfg);

&amp;nbsp; //Initialize CAN1
&amp;nbsp;&amp;nbsp;&amp;nbsp; CAN_Init(LPC_CAN1, 125000);

&amp;nbsp; //Enable Interrupt
&amp;nbsp;&amp;nbsp;&amp;nbsp; CAN_IRQCmd(LPC_CAN1, CANINT_RIE, ENABLE);
&amp;nbsp;&amp;nbsp;&amp;nbsp; CAN_SetAFMode(LPC_CANAF,CAN_AccBP);

&amp;nbsp; //Enable CAN Interrupt
&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC_EnableIRQ(CAN_IRQn);

&amp;nbsp; // Force the counter to be placed into memory
&amp;nbsp;&amp;nbsp;&amp;nbsp; volatile static int i = 0 ;

&amp;nbsp; // Enter an infinite loop, just incrementing a counter
&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++ ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0 ;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521167#M4026</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521168#M4027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LabRat on Thu Sep 11 14:45:19 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: 00zigor&lt;/STRONG&gt;&lt;BR /&gt;I'm trying to enable CAN RX interruption but when the data comes the interruption doesn't happen.&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Isn't RD1/TD1 Function 3?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you able to transmit messages?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521168#M4027</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521169#M4028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by 00zigor on Thu Sep 11 15:07:37 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;You're right, it's function 3, didn't notice that function 2 is reserved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Changed that in the code but still nothing...&amp;nbsp; :(( &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And a can't transmit anything...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521169#M4028</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521170#M4029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LabRat on Thu Sep 11 15:30:06 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Try to transmit messages before you try to receive messages&amp;nbsp; :) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are not able to transmit, you should try to use 'Local Self Test' and scope TXD1...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521170#M4029</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521171#M4030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by 00zigor on Thu Sep 11 16:08:08 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I enabled Timer 0 whit 500ms to transmit a frame and put CAN_sendmsg() inside timer 0 interruption but when I tried to debug the transmitting function the compiler returned the message: No source available for "CAN_SendMsg() at 0x434"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So I tried putting a flag inside interruption handler and pooling the flag in the main loop but the debugger just jumps out of the "if" and dosen't even update the function flag &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the code with transmition in interrupt handler is bellow:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;

void CAN_IRQHandler()
{
uint8_t IntStatus;
IntStatus = CAN_IntGetStatus(LPC_CAN1);

//check receive interrupt
if((IntStatus &amp;gt;&amp;gt; 0) &amp;amp; 0x01)
{
CAN_ReceiveMsg(LPC_CAN1,&amp;amp;RXMsg);

}
}

//CAN 1 Initialization.
void INIT_CAN(void)
{
/* Pin configuration
 * CAN1: select P0.21 as RD1. P0.22 as TD1 */
PinCfg.Funcnum = 3;
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = 0;
PinCfg.Pinnum = 0;
PinCfg.Portnum = 21;
PINSEL_ConfigPin(&amp;amp;PinCfg);
PinCfg.Pinnum = 22;
PINSEL_ConfigPin(&amp;amp;PinCfg);

//Initialize CAN1
CAN_Init(LPC_CAN1, 125000);

//Configures CAN operation mode.
CAN_ModeConfig(LPC_CAN1, CAN_SELFTEST_MODE, ENABLE);

//Enable Interrupt
CAN_IRQCmd(LPC_CAN1, CANINT_RIE, ENABLE);
CAN_SetAFMode(LPC_CANAF,CAN_AccBP);

//Enable CAN Interrupt
NVIC_EnableIRQ(CAN_IRQn);

CAN_InitMessage();
}

//Timer 0 Initialization.
void INIT_Timer_0(void)
{
//timer init
TIM_TIMERCFG_Type TIM_ConfigStruct;
TIM_MATCHCFG_Type TIM_MatchConfigStruct ;

//PINSEL_CFG_Type PinCfg;
// Conifg P1.28 as MAT0.0
PinCfg.Funcnum = 2;
PinCfg.OpenDrain = 0;
PinCfg.Pinmode = 0;
PinCfg.Portnum = 3;
PinCfg.Pinnum = 25;
PINSEL_ConfigPin(&amp;amp;PinCfg);

// Initialize timer 0, prescale count time of 100uS
TIM_ConfigStruct.PrescaleOption = TIM_PRESCALE_USVAL;
TIM_ConfigStruct.PrescaleValue= 100;

// use channel 0, MR0
TIM_MatchConfigStruct.MatchChannel = 0;
// Enable interrupt when MR0 matches the value in TC register
TIM_MatchConfigStruct.IntOnMatch&amp;nbsp;&amp;nbsp; = TRUE;
//Enable reset on MR0: TIMER will reset if MR0 matches it
TIM_MatchConfigStruct.ResetOnMatch = TRUE;
//Stop on MR0 if MR0 matches it
TIM_MatchConfigStruct.StopOnMatch&amp;nbsp; = FALSE;
//Toggle MR0.0 pin if MR0 matches it
TIM_MatchConfigStruct.ExtMatchOutputType =TIM_EXTMATCH_TOGGLE;
// Set Match value, count value of 1000 (5000 * 100uS = 500000uS = 0,5S --&amp;gt; 2 Hz)
TIM_MatchConfigStruct.MatchValue&amp;nbsp;&amp;nbsp; = 5000;

// Set configuration for Tim_config and Tim_MatchConfig
TIM_Init(LPC_TIM0, TIM_TIMER_MODE,&amp;amp;TIM_ConfigStruct);
TIM_ConfigMatch(LPC_TIM0,&amp;amp;TIM_MatchConfigStruct);

/* preemption = 1, sub-priority = 1 */
NVIC_SetPriority(TIMER0_IRQn, ((0x01&amp;lt;&amp;lt;3)|0x01));
/* Enable interrupt for timer 0 */
NVIC_EnableIRQ(TIMER0_IRQn);
// To start timer 0
TIM_Cmd(LPC_TIM0,ENABLE);

}

void CAN_InitMessage(void)
{
TXMsg.format = EXT_ID_FORMAT;
TXMsg.id = 0x208;
TXMsg.len = 8;
TXMsg.type = DATA_FRAME;
TXMsg.dataA[0] = TXMsg.dataA[1] = TXMsg.dataA[2] = TXMsg.dataA[3] = 0x00000000;
TXMsg.dataB[0] = TXMsg.dataB[1] = TXMsg.dataB[2] = TXMsg.dataB[3] = 0x00000000;

RXMsg.format = 0x00;
RXMsg.id = 0x00;
RXMsg.len = 0x00;
RXMsg.type = 0x00;
RXMsg.dataA[0] = RXMsg.dataA[1] = RXMsg.dataA[2] = RXMsg.dataA[3] = 0x00000000;
RXMsg.dataB[0] = RXMsg.dataB[1] = RXMsg.dataB[2] = RXMsg.dataB[3] = 0x00000000;
}

int main(void) {

INIT_Timer_0();
INIT_CAN();

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Force the counter to be placed into memory
&amp;nbsp;&amp;nbsp;&amp;nbsp; volatile static int i = 0 ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enter an infinite loop, just incrementing a counter
&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++ ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0 ;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521171#M4030</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521172#M4031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LabRat on Thu Sep 11 16:45:25 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure which toolchain and library you are using...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it LPCXpresso and CMSIS2.0? Is there a sample from where you've started?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does your oscillosope show any activity at TD1?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521172#M4031</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521173#M4032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LabRat on Thu Sep 11 21:36:39 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
PinCfg.Pinnum = 0;
PinCfg.Portnum = 21;
PINSEL_ConfigPin(&amp;amp;PinCfg);
PinCfg.Pinnum = 22;
PINSEL_ConfigPin(&amp;amp;PinCfg);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; |( &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;P21[0] and P21[22]&amp;nbsp;&amp;nbsp; :quest:&amp;nbsp; You have a lot of Ports in your 1769...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521173#M4032</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521174#M4033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by 00zigor on Fri Sep 12 07:23:44 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Dear LabRat,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You have no idea of how ashamed I feel right now.&amp;nbsp;&amp;nbsp; :bigsmile: (That's me hiding the shame behind a smile)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As soon as I corrected this error my interruptions started working and i'm receiving the data correctely as well as transmitting them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tank you very much kind sir, and I'm sorry for my lack of attention.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I blame my dislexy actualy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS.: For a Rat you're a pretty nicce guy.&amp;nbsp; 8-) &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521174#M4033</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521175#M4034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LabRat on Fri Sep 12 07:39:26 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: 00zigor&lt;/STRONG&gt;&lt;BR /&gt;You have no idea of how ashamed I feel right now.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know that feeling..., good to hear that your board is working&amp;nbsp; :bigsmile: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me just add a note:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your code looks like a very old CMSIS sample. LPCOpen is also including a CAN sample&amp;nbsp; :) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This sample looks confusing, but after throwing out AF stuff and DEBUG messages it it a simple sample.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps you want to test it, too. Should work out of the box if you change CAN_CTRL_NO and add the correct PIN setup in board_sysinit.c of board library...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521175#M4034</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521176#M4035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by 00zigor on Fri Sep 12 13:26:44 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Will do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Specialy because this little bugger just stoped working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe things will get a little easier using LPCOpen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tanks again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521176#M4035</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521177#M4036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by 00zigor on Wed Sep 17 13:05:33 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;OK, so... I tried to use LPC open and... it got me even more confused than I already am.&amp;nbsp; :quest: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code has no comments at the functions declarations, using the exemples it's no use, so if you're like me, and just started working on 1769 you'll get nowhere.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the can_peripheral exemple the driver configures the AFLUT&amp;nbsp; and I think I managed to set bypass mode, but I can't find where it configures IOCON for the CAN Pins and there's nothing even related to that anywhere in the code, i tried to find some clue on other exemples but got nothing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Whoever wrote those drivers never thougth that someone would try to learn how the hardware works using them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Besides ,to change to another development platform now would take some time, and i'm kinda out of it now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm still trying to understand what went wrong whit my CMSIS driver for CAN, since it worked for about an hour before it just crashed and never worked again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using LPCXpresso 7.2.0, CMSIS2.0 and the driver and expemles provided &lt;/SPAN&gt;&lt;A href="http://http://www.lpcware.com/content/nxpfile/lpc175x6x-cmsis-compliant-standard-peripheral-firmware-driver-library-keil-iar-gnu" rel="nofollow noopener noreferrer" target="_blank"&gt;Here&lt;/A&gt;&lt;SPAN&gt; for CAN bypass mode.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm on an custom borad using LPC1769 and using as debugger a NXP LPC-Link.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Right now i'm trying to watch every single register while reading the UM10360 so maybe I can figure out what is wrong, but if someone laready been trough someting like that, Please help me out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's my code up until now:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;

#ifdef __USE_CMSIS
#include "LPC17xx.h"
#endif

#include &amp;lt;cr_section_macros.h&amp;gt;

#include "lpc17xx_timer.h"
#include "lpc17xx_libcfg_default.h"
#include "lpc17xx_pinsel.h"
#include "lpc17xx_gpio.h"
#include "lpc17xx_can.h"

/** PINSEL configuration definition for CAN**/
PINSEL_CFG_Type CAN_PinCfg; //Parameters for pin configuration.

/** PINSEL configuration definition for GPIO**/
PINSEL_CFG_Type GPIO_PinCfg; //Parameters for pin configuration.

/** CAN variable definition **/
CAN_MSG_Type TXMsg, RXMsg; // messages for test Bypass mode

//CAN messages initialization.
void CAN_InitMessage(void);

//CAN interruption Handler.
void CAN_IRQHandler(void);

//Timer 0 initialization.
void INIT_Timer_0(void);

//CAN initialization.
void INIT_CAN(void);

//Transmission flag updated in timer0 interrupt
uint8_t flag_tx = FALSE;

/*----------------- INTERRUPT SERVICE ROUTINES --------------------------*/
/*********************************************************************//**
 * @briefTIMER0 interrupt handler sub-routine
 * @param[in]None
 * @return None
 **********************************************************************/
void TIMER0_IRQHandler(void)
{
if (TIM_GetIntStatus(LPC_TIM0, TIM_MR0_INT)== SET)
{
flag_tx = TRUE;
}
TIM_ClearIntPending(LPC_TIM0, TIM_MR0_INT);
}

/*********************************************************************//**
 * @briefCAN_IRQ Handler, control receive message operation
 * param[in]none
 * @return none
 **********************************************************************/
void CAN_IRQHandler(void)
{
uint8_t IntStatus;
IntStatus = CAN_IntGetStatus(LPC_CAN1);

//check receive interrupt
if((IntStatus &amp;gt;&amp;gt; 0) &amp;amp; 0x01)
{
CAN_ReceiveMsg(LPC_CAN1,&amp;amp;RXMsg);

}
}

//Inicialização de Timer 0.
void INIT_Timer_0(void)
{
//timer init
TIM_TIMERCFG_Type TIM_ConfigStruct;
TIM_MATCHCFG_Type TIM_MatchConfigStruct ;

//PINSEL_CFG_Type PinCfg;
// Conifg P1.28 as MAT0.0
GPIO_PinCfg.Funcnum = 2;
GPIO_PinCfg.OpenDrain = 0;
GPIO_PinCfg.Pinmode = 0;
GPIO_PinCfg.Portnum = 3;
GPIO_PinCfg.Pinnum = 25;
PINSEL_ConfigPin(&amp;amp;GPIO_PinCfg);

// Initialize timer 0, prescale count time of 100uS
TIM_ConfigStruct.PrescaleOption = TIM_PRESCALE_USVAL;
TIM_ConfigStruct.PrescaleValue= 100;

// use channel 0, MR0
TIM_MatchConfigStruct.MatchChannel = 0;
// Enable interrupt when MR0 matches the value in TC register
TIM_MatchConfigStruct.IntOnMatch&amp;nbsp;&amp;nbsp; = TRUE;
//Enable reset on MR0: TIMER will reset if MR0 matches it
TIM_MatchConfigStruct.ResetOnMatch = TRUE;
//Stop on MR0 if MR0 matches it
TIM_MatchConfigStruct.StopOnMatch&amp;nbsp; = FALSE;
//Toggle MR0.0 pin if MR0 matches it
TIM_MatchConfigStruct.ExtMatchOutputType =TIM_EXTMATCH_TOGGLE;
// Set Match value, count value of 1000 (10000 * 100uS = 1000000uS = 1S --&amp;gt; 1 Hz)
TIM_MatchConfigStruct.MatchValue&amp;nbsp;&amp;nbsp; = 10000;

// Set configuration for Tim_config and Tim_MatchConfig
TIM_Init(LPC_TIM0, TIM_TIMER_MODE,&amp;amp;TIM_ConfigStruct);
TIM_ConfigMatch(LPC_TIM0,&amp;amp;TIM_MatchConfigStruct);

/* preemption = 1, sub-priority = 1 */
NVIC_SetPriority(TIMER0_IRQn, ((0x01&amp;lt;&amp;lt;3)|0x01));
/* Enable interrupt for timer 0 */
NVIC_EnableIRQ(TIMER0_IRQn);
// To start timer 0
TIM_Cmd(LPC_TIM0,ENABLE);

}

void INIT_CAN(void)
{
/* Pin configuration
 * CAN1: select P0.21 as RD1. P0.22 as TD1 */
CAN_PinCfg.Funcnum = 3;
CAN_PinCfg.OpenDrain = 0;
CAN_PinCfg.Pinmode = 0;
CAN_PinCfg.Portnum = 0;
CAN_PinCfg.Pinnum = 21;
PINSEL_ConfigPin(&amp;amp;CAN_PinCfg);
CAN_PinCfg.Pinnum = 22;
PINSEL_ConfigPin(&amp;amp;CAN_PinCfg);

//Initialize CAN1
CAN_Init(LPC_CAN1, 125000);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Configures CAN AF mode
CAN_SetAFMode(LPC_CANAF,CAN_AccBP);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Configures CAN mode.
CAN_ModeConfig(LPC_CAN1, CAN_SELFTEST_MODE, ENABLE);

//Enable Interrupt
CAN_IRQCmd(LPC_CAN1, CANINT_RIE, ENABLE);

//Enable CAN Interrupt
NVIC_EnableIRQ(CAN_IRQn);

//Intialize CAN TX and RX messages.
CAN_InitMessage();
}

/*********************************************************************//**
 * @briefInitialize transmit and receive message for Bypass operation
 * @param[in]none
 * @return none
 **********************************************************************/
void CAN_InitMessage(void)
{
TXMsg.format = EXT_ID_FORMAT;
TXMsg.id = 0x208;
TXMsg.len = 8;
TXMsg.type = DATA_FRAME;
TXMsg.dataA[0] = TXMsg.dataA[1] = TXMsg.dataA[2] = TXMsg.dataA[3] = 0x00000000;
TXMsg.dataB[0] = TXMsg.dataB[1] = TXMsg.dataB[2] = TXMsg.dataB[3] = 0x00000000;

RXMsg.format = 0x00;
RXMsg.id = 0x00;
RXMsg.len = 0x00;
RXMsg.type = 0x00;
RXMsg.dataA[0] = RXMsg.dataA[1] = RXMsg.dataA[2] = RXMsg.dataA[3] = 0x00000000;
RXMsg.dataB[0] = RXMsg.dataB[1] = RXMsg.dataB[2] = RXMsg.dataB[3] = 0x00000000;
}

//Main Function//
int main(void) {

&amp;nbsp;&amp;nbsp;&amp;nbsp; // TODO: insert code here
INIT_Timer_0();
INIT_CAN();

&amp;nbsp;&amp;nbsp;&amp;nbsp; // Enter an infinite loop, sending a can message every timer 0 interruption (1 second).
&amp;nbsp;&amp;nbsp;&amp;nbsp; while(1) {

&amp;nbsp;&amp;nbsp;&amp;nbsp; if(flag_tx)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; flag_tx = FALSE;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CAN_InitMessage();
&amp;nbsp;&amp;nbsp;&amp;nbsp; CAN_SendMsg(LPC_CAN1, &amp;amp;TXMsg);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0 ;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521177#M4036</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521178#M4037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LabRat on Wed Sep 17 14:41:46 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: 00zigor&lt;/STRONG&gt;&lt;BR /&gt;...but I can't find where it configures IOCON for the CAN Pins and there's nothing even related to that anywhere in the code, i tried to find some clue on other exemples but got nothing.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; :quest: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: LabRat&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;This sample looks confusing, but after throwing out AF stuff and DEBUG messages it it a simple sample.&lt;BR /&gt;&lt;BR /&gt;Perhaps you want to test it, too. Should work out of the box if you [color=#f00]change CAN_CTRL_NO and add the correct PIN setup in board_sysinit.c of board library..[/color].&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are not telling me that a simple pin setup got you&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course you can also setup pins in CAN_init.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sample:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;//init CAN, [color=#f00]Pin muxing is done in board_sysinit.c already !!![/color]
void CAN_init(void)
{
[color=#f00]//if no PIN setup is done, it's time now...
// Chip_IOCON_PinMux(LPC_IOCON,0,0,IOCON_MODE_INACT,IOCON_FUNC1);// P0.0 CAN-RD1
// Chip_IOCON_PinMux(LPC_IOCON,0,1,IOCON_MODE_INACT,IOCON_FUNC1);// P0.1 CAN-TD1[/color]
 Chip_CAN_Init(LPC_CAN, LPC_CANAF, LPC_CANAF_RAM);
 Chip_CAN_SetBitRate(LPC_CAN, 100000);
 Chip_CAN_EnableInt(LPC_CAN, CAN_IER_BITMASK);
 Chip_CAN_SetAFMode(LPC_CANAF, CAN_AF_BYBASS_MODE);
 NVIC_EnableIRQ(CAN_IRQn);
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521178#M4037</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521179#M4038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LabRat on Fri Sep 19 13:02:32 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: 00zigor&lt;/STRONG&gt;&lt;BR /&gt;Here's my code up until now...&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure what your library from 2011 is doing in detail, but a few things in your code are confusing me&amp;nbsp; &lt;SPAN class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why is your timer flag not volatile?&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
//Transmission flag updated in timer0 interrupt
uint8_t flag_tx = FALSE;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why are you using different setting for receive and transmit message?&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
void CAN_InitMessage(void)
{
TXMsg.format = [color=#f00]EXT_ID_FORMAT;[/color]
...
RXMsg.format =[color=#f00] 0x00;[/color]
...
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;Why are you using a timer match instead a simple Systick timer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why do you init your messages every time before sending a new message?&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
if(flag_tx)
{
 flag_tx = FALSE;
 [color=#f00]CAN_InitMessage();[/color]
 CAN_SendMsg(LPC_CAN1, &amp;amp;TXMsg);
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sample:&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
/*
===============================================================================
 Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : LPC17_CAN_Test.c
 Author&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : $(author)
 Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :
 Copyright&amp;nbsp;&amp;nbsp; : $(copyright)
 Description : main definition
===============================================================================
*/

#include "LPC17xx.h"
#include "lpc17xx_timer.h"
#include "lpc17xx_libcfg_default.h"
#include "lpc17xx_pinsel.h"
#include "lpc17xx_gpio.h"
#include "lpc17xx_can.h"
#include &amp;lt;string.h&amp;gt;

/** PINSEL configuration definition for CAN**/
PINSEL_CFG_Type CAN_PinCfg; //Parameters for pin configuration.

/** PINSEL configuration definition for GPIO**/
PINSEL_CFG_Type GPIO_PinCfg; //Parameters for pin configuration.

/** CAN variable definition **/
CAN_MSG_Type TXMsg, RXMsg; // messages for test Bypass mode
CAN_MSG_Type RspMsg;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Respond message

//CAN messages initialization.
void CAN_InitMessage(void);
//CAN interruption Handler.
void CAN_IRQHandler(void);
//CAN initialization.
void INIT_CAN(void);

volatile uint32_t timer;//systick timer
volatile uint8_t flag_tx = FALSE;//transmit flag

/*********************************************************************//**
 * @briefCAN_IRQ Handler, control receive message operation
 * param[in]none
 * @return none
 **********************************************************************/
void CAN_IRQHandler(void)
{
 uint8_t IntStatus;
 IntStatus = CAN_IntGetStatus(LPC_CAN1);

//check receive interrupt
 if((IntStatus &amp;gt;&amp;gt; 0) &amp;amp; 0x01)
 {
&amp;nbsp; CAN_ReceiveMsg(LPC_CAN1,&amp;amp;RXMsg);
&amp;nbsp; memcpy(&amp;amp;RspMsg,&amp;amp;RXMsg,sizeof(CAN_MSG_Type)); //copy respond message
&amp;nbsp; RspMsg.id += 0x100;//Respond ID = receive + 0x100
&amp;nbsp; CAN_SendMsg(LPC_CAN1, &amp;amp;RspMsg);//and send it...
 }
}

//SysTick_Handler
void SysTick_Handler(void)
{
 timer++;
 if(timer &amp;gt;= 100)//reached tx delay
 {
&amp;nbsp; timer =0;//reset timer
&amp;nbsp; flag_tx = TRUE;//set transmit flag
 }//end reached tx delay
}

void INIT_CAN(void)
{
 /* Pin configuration
&amp;nbsp; * CAN1: select P0.0 as RD1. P0.1 as TD1 */
 CAN_PinCfg.Funcnum = 1;
 CAN_PinCfg.OpenDrain = 0;
 CAN_PinCfg.Pinmode = 0;
 CAN_PinCfg.Portnum = 0;
 CAN_PinCfg.Pinnum = 0;
 PINSEL_ConfigPin(&amp;amp;CAN_PinCfg);
 CAN_PinCfg.Pinnum = 1;
 PINSEL_ConfigPin(&amp;amp;CAN_PinCfg);
//Initialize CAN1
 CAN_Init(LPC_CAN1, 125000);
//Configures CAN AF mode
 CAN_SetAFMode(LPC_CANAF,CAN_AccBP);
//Configures CAN mode.
 CAN_ModeConfig(LPC_CAN1, CAN_OPERATING_MODE, ENABLE);
//Enable Interrupt
 CAN_IRQCmd(LPC_CAN1, CANINT_RIE, ENABLE);
//Enable CAN Interrupt
 NVIC_EnableIRQ(CAN_IRQn);
//Intialize CAN TX and RX messages.
 CAN_InitMessage();
}

/*********************************************************************//**
 * @briefInitialize transmit and receive message for Bypass operation
 * @param[in]none
 * @return none
 **********************************************************************/
void CAN_InitMessage(void)
{
 TXMsg.format = STD_ID_FORMAT;
 TXMsg.id = 0x208;
 TXMsg.len = 8;
 TXMsg.type = DATA_FRAME;
 TXMsg.dataA[0] = TXMsg.dataA[1] = TXMsg.dataA[2] = TXMsg.dataA[3] = 0x00000000;
 TXMsg.dataB[0] = TXMsg.dataB[1] = TXMsg.dataB[2] = TXMsg.dataB[3] = 0x00000000;

 RXMsg.format = STD_ID_FORMAT;
 RXMsg.id = 0x00;
 RXMsg.len = 0x00;
 RXMsg.type = 0x00;
 RXMsg.dataA[0] = RXMsg.dataA[1] = RXMsg.dataA[2] = RXMsg.dataA[3] = 0x00000000;
 RXMsg.dataB[0] = RXMsg.dataB[1] = RXMsg.dataB[2] = RXMsg.dataB[3] = 0x00000000;
}

//Main Function//
int main(void)
{
 INIT_CAN();
 SysTick_Config(SystemCoreClock / 1000); //1ms timer
 while(1)//loop
 {
&amp;nbsp; if(flag_tx)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; flag_tx = FALSE;
&amp;nbsp;&amp;nbsp; TXMsg.dataA[1]++;//change message
&amp;nbsp;&amp;nbsp; CAN_SendMsg(LPC_CAN1, &amp;amp;TXMsg);
&amp;nbsp; }
 }
 return 0 ;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521179#M4038</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521180#M4039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by 00zigor on Fri Sep 26 13:48:36 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hey LabRat,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry for the delayed answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Finaly got my code working on both CMSIS and LPCOpen.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, on question 1: &lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Why is your timer flag not volatile?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It didn't need to be anything else at that moment, that flag was just so I wouldn't call another function in timer0 interruption, memory alocation was not a concern at the moment and a global variable as the fastest choice.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Question 2: &lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Why are you using different setting for receive and transmit message?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was just testing how to receive a message from another device using the exemples that i had, that part was not really necessary now that I think of it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Question 3:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Why are you using a timer match instead a simple Systick timer?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because this way I can know whether my harware stoped working or not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a LED at MAT0.0 pin blinking whitout software interference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Question 4:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Why do you init your messages every time before sending a new message?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was just desperate...&amp;nbsp; :bigsmile: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, turns out I had a major cold soldering at my board witch was causing bus error in many registers including ICR whitch made me think that i was receiving a message whitout the correct data, once i undertood that things really started to improve.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I'm moving on to the next stage with this project.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CMSIS is working fine and LPCOpen worked wonderfully.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you so much.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:49:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1769-CAN-DRIVER-INTERRUPT-NOT-HAPPENIG/m-p/521180#M4039</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:49:52Z</dc:date>
    </item>
  </channel>
</rss>

