<?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: UART ISR doesn't run even when Interrupt is generated in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/UART-ISR-doesn-t-run-even-when-Interrupt-is-generated/m-p/559136#M15756</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would suggest you look at your 'extern "C"'. given that it works when compiled with C, implies that your IRQ handler is being name-mangled. You can confirm by looking in the linker map.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Aug 2016 11:13:22 GMT</pubDate>
    <dc:creator>avt</dc:creator>
    <dc:date>2016-08-26T11:13:22Z</dc:date>
    <item>
      <title>UART ISR doesn't run even when Interrupt is generated</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/UART-ISR-doesn-t-run-even-when-Interrupt-is-generated/m-p/559135#M15755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wanted to try Embedded C++, so for starters I wanted to use UART. The code I wrote generates the Interrupt but the code never jumps to the ISR that i wrote. I rewrote the code removing all class declarations and all except that i saved and compiled my code as main.cpp. The code still doesn't work, but when i re-compiled it as main.c the code works. I don't know what to do to make it work in c++. Does anyone as any idea what to do &amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#include &amp;lt;lpc17xx.h&amp;gt;&lt;/P&gt;&lt;P&gt;static const uint8_t IER_RBR=0x01;&lt;BR /&gt;static const uint8_t IER_THRE=0x02;&lt;BR /&gt;static const uint8_t IER_RLS=0x04;&lt;/P&gt;&lt;P&gt;static const uint8_t IIR_PEND=0x01;&lt;BR /&gt;static const uint8_t IIR_RLS=0x03;&lt;BR /&gt;static const uint8_t IIR_RDA=0x02;&lt;BR /&gt;static const uint8_t IIR_CTI=0x06l;&lt;BR /&gt;static const uint8_t IIR_THRE=0x01;&lt;/P&gt;&lt;P&gt;static const uint8_t LSR_RDR=0x01;&lt;BR /&gt;static const uint8_t LSR_OE=0x02;&lt;BR /&gt;static const uint8_t LSR_PE=0x04;&lt;BR /&gt;static const uint8_t LSR_FE=0x08;&lt;BR /&gt;static const uint8_t LSR_BI=0x10;&lt;BR /&gt;static const uint8_t LSR_THRE=0x20;&lt;BR /&gt;static const uint8_t LSR_TEMT=0x40;&lt;BR /&gt;static const uint8_t LSR_RXFE=0x80;&lt;/P&gt;&lt;P&gt;char ch;&lt;BR /&gt;int UART0Status, UART1Status;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#ifdef __cplusplus&lt;BR /&gt;extern "C"{&lt;BR /&gt; #endif&lt;BR /&gt; &lt;BR /&gt;void UART_IRQHandler(void)&lt;BR /&gt;{&lt;BR /&gt; &lt;BR /&gt; uint8_t IIRValue, LSRValue;&lt;BR /&gt; uint8_t Dummy = Dummy;&lt;BR /&gt; &lt;BR /&gt; IIRValue = LPC_UART1-&amp;gt;IIR;&lt;BR /&gt; &lt;BR /&gt; IIRValue &amp;gt;&amp;gt;= 1; /* skip pending bit in IIR */&lt;BR /&gt; IIRValue &amp;amp;= 0x07; /* check bit 1~3, interrupt identification */&lt;BR /&gt; if ( IIRValue == IIR_RLS ) /* Receive Line Status */&lt;BR /&gt; {&lt;BR /&gt; LSRValue = LPC_UART1-&amp;gt;LSR;&lt;BR /&gt; /* Receive Line Status */&lt;BR /&gt; if ( LSRValue &amp;amp; (LSR_OE|LSR_PE|LSR_FE|LSR_RXFE|LSR_BI) )&lt;BR /&gt; {&lt;BR /&gt; /* There are errors or break interrupt */&lt;BR /&gt; /* Read LSR will clear the interrupt */&lt;BR /&gt; UART1Status = LSRValue;&lt;BR /&gt; Dummy = LPC_UART1-&amp;gt;RBR; /* Dummy read on RX to clear &lt;BR /&gt; interrupt, then bail out */&lt;BR /&gt; return;&lt;BR /&gt; }&lt;BR /&gt; if ( LSRValue &amp;amp; LSR_RDR ) /* Receive Data Ready */ &lt;BR /&gt; {&lt;BR /&gt; /* If no error on RLS, normal ready, save into the data buffer. */&lt;BR /&gt; /* Note: read RBR will clear the interrupt */&lt;BR /&gt; while(!(LPC_UART1-&amp;gt;LSR &amp;amp; (1&amp;lt;&amp;lt;0)));&lt;BR /&gt; ch=LPC_UART1-&amp;gt;RBR;&lt;BR /&gt; while(!(LPC_UART1-&amp;gt;LSR &amp;amp; (1&amp;lt;&amp;lt;5)));&lt;BR /&gt; LPC_UART1-&amp;gt;THR=ch;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; else if ( IIRValue == IIR_RDA ) /* Receive Data Available */&lt;BR /&gt; {&lt;BR /&gt; /* Receive Data Available */&lt;BR /&gt; while(!(LPC_UART1-&amp;gt;LSR &amp;amp; (1&amp;lt;&amp;lt;0)));&lt;BR /&gt; ch=LPC_UART1-&amp;gt;RBR;&lt;BR /&gt; while(!(LPC_UART1-&amp;gt;LSR &amp;amp; (1&amp;lt;&amp;lt;5)));&lt;BR /&gt; LPC_UART1-&amp;gt;THR=ch;&lt;BR /&gt; }&lt;BR /&gt; else if ( IIRValue == IIR_CTI ) /* Character timeout indicator */&lt;BR /&gt; {&lt;BR /&gt; /* Character Time-out indicator */&lt;BR /&gt; UART1Status |= 0x100; /* Bit 9 as the CTI error */&lt;BR /&gt; }&lt;BR /&gt; else if ( IIRValue == IIR_THRE ) /* THRE, transmit holding register empty */&lt;BR /&gt; {&lt;BR /&gt; /* THRE interrupt */&lt;BR /&gt; LSRValue = LPC_UART1-&amp;gt;LSR; /* Check status in the LSR to see if&lt;BR /&gt; valid data in U0THR or not */&lt;BR /&gt; if ( LSRValue &amp;amp; LSR_THRE )&lt;BR /&gt; {&lt;BR /&gt; //UART1TxEmpty = 1;&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; {&lt;BR /&gt; // UART1TxEmpty = 0;&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;#ifdef __cplusplus&lt;BR /&gt;}&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; int pclk,Fdiv;&lt;BR /&gt; int baudrate=9600;&lt;BR /&gt; char ch;&lt;BR /&gt; &lt;BR /&gt; //POWERING UP UART1&lt;BR /&gt; LPC_SC-&amp;gt;PCONP |=(1&amp;lt;&amp;lt;4); &lt;BR /&gt; &lt;BR /&gt; //PHERIPHERAL CLOCK SELECTION&lt;BR /&gt; LPC_SC-&amp;gt;PCLKSEL0 &amp;amp;= ~(3&amp;lt;&amp;lt;8); //MASKING&lt;BR /&gt; LPC_SC-&amp;gt;PCLKSEL0 |= (0&amp;lt;&amp;lt;8); //PCLK = CCLK/4&lt;BR /&gt; pclk = SystemCoreClock / 4;&lt;BR /&gt; &lt;BR /&gt; //Set P2.0 as TXD1 and set P2.1 as RXD1&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL4 &amp;amp;= ~(0x3); //MASKING&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL4 |= (2&amp;lt;&amp;lt;0); //TXD1&lt;BR /&gt; &lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL4 &amp;amp;= ~(0xC); //MASKING&lt;BR /&gt; LPC_PINCON-&amp;gt;PINSEL4 |= (2&amp;lt;&amp;lt;2); //RXD1&lt;BR /&gt; &lt;BR /&gt; //INITIALIZATION &lt;BR /&gt; LPC_UART1-&amp;gt;LCR = 0x83; //8N1, DLAB=1&lt;BR /&gt; Fdiv = (pclk/16) / baudrate;&lt;BR /&gt; LPC_UART1-&amp;gt;DLM = Fdiv / 256;&lt;BR /&gt; LPC_UART1-&amp;gt;DLL = Fdiv % 256;&lt;BR /&gt; LPC_UART1-&amp;gt;LCR = 0x03; //8N1, DLAB=0&lt;BR /&gt; LPC_UART1-&amp;gt;FCR |= 0x07;//(1 &amp;lt;&amp;lt; 0) | (1 &amp;lt;&amp;lt; 1) | (1 &amp;lt;&amp;lt; 2); //FIFO EN, RX/TX FIFO RESET&lt;BR /&gt; &lt;BR /&gt; //ENABLE INTERRUPT&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; LPC_UART1-&amp;gt;IER = IER_RBR | IER_THRE | IER_RLS; //Enable UART1 Interrupt RBR,THRE,RLS&lt;BR /&gt; NVIC_SetPriority(UART1_IRQn, 6);&lt;BR /&gt; NVIC_EnableIRQ(UART1_IRQn);&lt;BR /&gt; &lt;BR /&gt; while(1)&lt;BR /&gt; {&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2016 01:40:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/UART-ISR-doesn-t-run-even-when-Interrupt-is-generated/m-p/559135#M15755</guid>
      <dc:creator>ditishmaharjan</dc:creator>
      <dc:date>2016-08-26T01:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: UART ISR doesn't run even when Interrupt is generated</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/UART-ISR-doesn-t-run-even-when-Interrupt-is-generated/m-p/559136#M15756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would suggest you look at your 'extern "C"'. given that it works when compiled with C, implies that your IRQ handler is being name-mangled. You can confirm by looking in the linker map.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2016 11:13:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/UART-ISR-doesn-t-run-even-when-Interrupt-is-generated/m-p/559136#M15756</guid>
      <dc:creator>avt</dc:creator>
      <dc:date>2016-08-26T11:13:22Z</dc:date>
    </item>
  </channel>
</rss>

