<?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>LPCXpresso IDEのトピックRe: main returns with 0</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/main-returns-with-0/m-p/557408#M14557</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wellsk on Mon Jan 06 10:12:31 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like that example was written to only reads 16 bytes in interrupt context and then drops out&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;
/* A (inefficient) ring buffer can be emulated in interrupt
&amp;nbsp;&amp;nbsp; mode using the uart_get_line() with a buffer size of 1. Read
&amp;nbsp;&amp;nbsp; 16 bytes into the ring buffer and then exit.*/
indexIn = 0;
while (indexIn &amp;lt; 16) {
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Normally, when a simple LPCOpen example exits main(), it goes into sysexit() which is a dead loop. It sounds like the UART is still operating once it enters sysexit() and crashes on receive?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It sounds like we should disable the UART interrupt and shutdown the UART correctly for this example prior to return.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would say this is considered and error. Maybe something like this fix might work?&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;
/* Transmit the message for byte/character part of the example */
putLineUART("\r\nData in ring buffer: ");
putLineUART(recv_buf);

/* Need to delay a bit here to allow UART to finish sending current bytes */
SomeTypeOfDelayHere();

NVIC_DisableIRQ(UART0_IRQn); /* Disable UART interrupt */
Chip_UART_DeInit(LPC_USART0); /* Shutdown UART and clocking */
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 02:09:10 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T02:09:10Z</dc:date>
    <item>
      <title>main returns with 0</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/main-returns-with-0/m-p/557407#M14556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ppx on Mon Jan 06 05:21:27 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have downloaded from LPCopen an example for interrupt driven routines using the built in ROM functions for LPC812. It is called "nxp_lpcxpresso_812_periph_uart_rom_int"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I was very surprised to see that the main ends with a return 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this an error or is the program designed to run once and than crash?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:09:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/main-returns-with-0/m-p/557407#M14556</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: main returns with 0</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/main-returns-with-0/m-p/557408#M14557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wellsk on Mon Jan 06 10:12:31 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like that example was written to only reads 16 bytes in interrupt context and then drops out&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;
/* A (inefficient) ring buffer can be emulated in interrupt
&amp;nbsp;&amp;nbsp; mode using the uart_get_line() with a buffer size of 1. Read
&amp;nbsp;&amp;nbsp; 16 bytes into the ring buffer and then exit.*/
indexIn = 0;
while (indexIn &amp;lt; 16) {
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Normally, when a simple LPCOpen example exits main(), it goes into sysexit() which is a dead loop. It sounds like the UART is still operating once it enters sysexit() and crashes on receive?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It sounds like we should disable the UART interrupt and shutdown the UART correctly for this example prior to return.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would say this is considered and error. Maybe something like this fix might work?&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;
/* Transmit the message for byte/character part of the example */
putLineUART("\r\nData in ring buffer: ");
putLineUART(recv_buf);

/* Need to delay a bit here to allow UART to finish sending current bytes */
SomeTypeOfDelayHere();

NVIC_DisableIRQ(UART0_IRQn); /* Disable UART interrupt */
Chip_UART_DeInit(LPC_USART0); /* Shutdown UART and clocking */
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 02:09:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/main-returns-with-0/m-p/557408#M14557</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T02:09:10Z</dc:date>
    </item>
  </channel>
</rss>

