<?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>LPC MicrocontrollersのトピックRe: ROM API Param structure</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/ROM-API-Param-structure/m-p/565847#M17181</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;bump&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 19 Jun 2016 01:03:34 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-19T01:03:34Z</dc:date>
    <item>
      <title>ROM API Param structure</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/ROM-API-Param-structure/m-p/565846#M17180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by fmiku on Wed Mar 02 04:38:42 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a question about the XXX_PARAM_T structures.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I using a interrupt driven functions like "LPC_UARTD_API-&amp;gt;uart_get_line(HostUartHandle, &amp;amp;param)"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the param structure's data must be keep until the "Done" callback functions are called ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;or the ROM functions makes a own copy of these data into the "xxxHandleMEM[];"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so my problem is the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I using the following function to start a UART transmission.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;static void host_start_tx (uint8_t *buff, uint16_t size)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART_PARAM_T param;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; param.buffer = buff;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; param.size = Txsz = size;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Interrupt mode, do not append CR/LF to sent data */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; param.transfer_mode = TX_MODE_BUF_EMPTY;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; param.driver_mode = DRIVER_MODE_INTERRUPT;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Setup the transmit callback, this will get called when the&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; transfer is complete */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; param.callback_func_pt = (UART_CALLBK_T) HostTxCB;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Transmit the data using interrupt mode, the function will&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET_FLAG(F1, F1_HOST_TX_PEND);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (LPC_UARTD_API-&amp;gt;uart_put_line(HostUartHandle, &amp;amp;param)) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET_FLAG(Err1, E1_HOST_USART);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLR_FLAG(F1, F1_HOST_TX_PEND);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// deinit here ??&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Most of time works fine but somtime the transmitted data become corrupted.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I Traced a little in the debugger, some of the params's parameters (CB fns, etc) are&amp;nbsp; seems to be copied to the UARTHandleMEM[] by the ROM API calls but some like data pointer is not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so in this case the UART_PARAM_T must be allocated in the global RAM space ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case after calling the ROM api the param structure's data may become "unknow/corrupted" because the variable is created on the stack when the function was called, and released when the controll leaves the function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have similatr problem with the I2C ROM api too :)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:04:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/ROM-API-Param-structure/m-p/565846#M17180</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: ROM API Param structure</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/ROM-API-Param-structure/m-p/565847#M17181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;bump&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Jun 2016 01:03:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/ROM-API-Param-structure/m-p/565847#M17181</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-19T01:03:34Z</dc:date>
    </item>
  </channel>
</rss>

