<?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: Data transfer on ethernet in MCUXpresso IDE</title>
    <link>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970392#M4891</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Felipe Garcia&lt;/P&gt;&lt;P&gt;I am using a FRDM K64-F development board.&lt;/P&gt;&lt;P&gt;Once again I am explaining my problem. I know it is difficult to understand to you but still I am trying to explain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to develop a communication like Ethernet to serial and serial to Ethernet. I am using a lwip tcpecho example. I am successful in Ethernet to serial communication (transferring from TCP and receiving at serial ).&lt;/P&gt;&lt;P&gt;In tcpecho example the data transfer tcpecho_raw_send(tcp,es) function is called in the tcpecho_recv function , here I commented all the tcpecho_raw_send() functions whhich is called inside tcp_raw_recv() function. Now I want to send my own data by using tcpecho_raw_send() but I am confused where to call this function in tcpecho_raw.c file , if I called tcpecho_raw_send function outside the tcpecho_raw_file , I am confuse how to pass the parameters&amp;nbsp; &amp;nbsp;tcp and es , if I declare this parameters separately in main function then invalid PCB error is generating. On error invalid PCB I understood that , while making a new connection one pcb is generated and the PCB which I am using is not that PCB which is previously created , so again I created a connection like following but again it showing a error the connection is already done for this IP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void echo_tx_tcp()&lt;BR /&gt;{&amp;nbsp;&lt;/P&gt;&lt;P&gt;struct tcp_pcb *l_tcp_pcb;&lt;BR /&gt; l_tcp_pcb = tcp_new();&lt;/P&gt;&lt;P&gt;&amp;nbsp;wr_err = tcp_bind(l_tcp_pcb, IP_ANY_TYPE, 7);&lt;BR /&gt; tcpecho_raw_pcb = tcp_listen(l_tcp_pcb);&lt;BR /&gt; wr_err = tcp_connect(l_tcp_pcb, IP_ANY_TYPE, 7, tcp_accept);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, 1024, PBUF_RAM);&lt;BR /&gt; unsigned char buffer_send[1024] = "My Name Is TCP";&lt;BR /&gt; p-&amp;gt;payload = buffer_send;&lt;BR /&gt; p-&amp;gt;len = 1024;&lt;BR /&gt; p-&amp;gt;tot_len = 1024;&lt;/P&gt;&lt;P&gt;wr_err = tcp_write(tcpecho_raw_pcb , p-&amp;gt;payload, p-&amp;gt;len, 1);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The main thing is I want to a separate transfer function where I can put my data received from the serial.&lt;/P&gt;&lt;P&gt;I am using&amp;nbsp;&lt;/P&gt;&lt;P&gt;IDE = MCUXpresso&lt;/P&gt;&lt;P&gt;board = FRDM K64-F&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Kapil Patil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Aug 2019 04:29:45 GMT</pubDate>
    <dc:creator>kapil_p</dc:creator>
    <dc:date>2019-08-28T04:29:45Z</dc:date>
    <item>
      <title>Data transfer on ethernet</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970390#M4889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am trying to build a communication from serial to ethernet and ethernet to serial.&lt;/P&gt;&lt;P&gt;By using the tcp_echo example i am trying to build the above communication . The ethernet to serial is working (transferred a data using packet sender and data is received in tcpecho.c file and same data is given to uart ).&lt;/P&gt;&lt;P&gt;Now to build the serial to ethernet communication , not understanding where to put&amp;nbsp; data which is received from the serial.&lt;/P&gt;&lt;P&gt;I given the data received from the serial&amp;nbsp; to tcp_write( ) in tcpecho_raw.c file but it is not working.&lt;/P&gt;&lt;P&gt;Not understanding how tcpecho_raw.c is working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Kapil Patil.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Aug 2019 11:02:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970390#M4889</guid>
      <dc:creator>kapil_p</dc:creator>
      <dc:date>2019-08-26T11:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Data transfer on ethernet</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970391#M4890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kapil,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please specify which MCU are you working on? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Felipe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2019 14:35:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970391#M4890</guid>
      <dc:creator>FelipeGarcia</dc:creator>
      <dc:date>2019-08-27T14:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Data transfer on ethernet</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970392#M4891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Felipe Garcia&lt;/P&gt;&lt;P&gt;I am using a FRDM K64-F development board.&lt;/P&gt;&lt;P&gt;Once again I am explaining my problem. I know it is difficult to understand to you but still I am trying to explain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to develop a communication like Ethernet to serial and serial to Ethernet. I am using a lwip tcpecho example. I am successful in Ethernet to serial communication (transferring from TCP and receiving at serial ).&lt;/P&gt;&lt;P&gt;In tcpecho example the data transfer tcpecho_raw_send(tcp,es) function is called in the tcpecho_recv function , here I commented all the tcpecho_raw_send() functions whhich is called inside tcp_raw_recv() function. Now I want to send my own data by using tcpecho_raw_send() but I am confused where to call this function in tcpecho_raw.c file , if I called tcpecho_raw_send function outside the tcpecho_raw_file , I am confuse how to pass the parameters&amp;nbsp; &amp;nbsp;tcp and es , if I declare this parameters separately in main function then invalid PCB error is generating. On error invalid PCB I understood that , while making a new connection one pcb is generated and the PCB which I am using is not that PCB which is previously created , so again I created a connection like following but again it showing a error the connection is already done for this IP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void echo_tx_tcp()&lt;BR /&gt;{&amp;nbsp;&lt;/P&gt;&lt;P&gt;struct tcp_pcb *l_tcp_pcb;&lt;BR /&gt; l_tcp_pcb = tcp_new();&lt;/P&gt;&lt;P&gt;&amp;nbsp;wr_err = tcp_bind(l_tcp_pcb, IP_ANY_TYPE, 7);&lt;BR /&gt; tcpecho_raw_pcb = tcp_listen(l_tcp_pcb);&lt;BR /&gt; wr_err = tcp_connect(l_tcp_pcb, IP_ANY_TYPE, 7, tcp_accept);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, 1024, PBUF_RAM);&lt;BR /&gt; unsigned char buffer_send[1024] = "My Name Is TCP";&lt;BR /&gt; p-&amp;gt;payload = buffer_send;&lt;BR /&gt; p-&amp;gt;len = 1024;&lt;BR /&gt; p-&amp;gt;tot_len = 1024;&lt;/P&gt;&lt;P&gt;wr_err = tcp_write(tcpecho_raw_pcb , p-&amp;gt;payload, p-&amp;gt;len, 1);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The main thing is I want to a separate transfer function where I can put my data received from the serial.&lt;/P&gt;&lt;P&gt;I am using&amp;nbsp;&lt;/P&gt;&lt;P&gt;IDE = MCUXpresso&lt;/P&gt;&lt;P&gt;board = FRDM K64-F&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Kapil Patil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2019 04:29:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970392#M4891</guid>
      <dc:creator>kapil_p</dc:creator>
      <dc:date>2019-08-28T04:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: Data transfer on ethernet</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970393#M4892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kapil,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you check tcp_write() function, the second argument is a pointer to the data to be enqueued for sending. How about you change this argument and put your own data instead?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From tcpecho_raw_send()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;nbsp; struct pbuf *ptr;&lt;/P&gt;&lt;P&gt;&amp;nbsp; err_t wr_err = ERR_OK;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; while ((wr_err == ERR_OK) &amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (es-&amp;gt;p != NULL) &amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (es-&amp;gt;p-&amp;gt;len &amp;lt;= tcp_sndbuf(tpcb))) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptr = es-&amp;gt;p;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* enqueue data for transmission */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wr_err = tcp_write(tpcb, &lt;STRONG&gt;ptr-&amp;gt;payload&lt;/STRONG&gt;, ptr-&amp;gt;len, 1);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know of this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Felipe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2019 22:31:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970393#M4892</guid>
      <dc:creator>FelipeGarcia</dc:creator>
      <dc:date>2019-08-28T22:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Data transfer on ethernet</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970394#M4893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&amp;nbsp;&lt;A _jive_internal="true" data-avatarid="26872" data-externalid="" data-online="false" data-presence="null" data-userid="319750" data-username="nxf46115" href="https://community.nxp.com/people/nxf46115" style="color: inherit; background-color: #ffffff; border: 0px; font-weight: bold; text-decoration: none; font-size: 14px;"&gt;Felipe García&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thank you for the reply.&lt;/P&gt;&lt;P&gt;The problem is not changing the argument . In tcpecho_raw_send function I given my own data and it is working fine only when I call the function tcpecho_raw_send()&amp;nbsp; in tcpecho_raw_recv().&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;I want to call tcpecho_raw_send() in main file ,&amp;nbsp; but I am not understanding how to pass a arguments.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;My transmit function should not depend on the receive function , I want to call this when my serial data is arrive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem with the parameters like &lt;STRONG&gt;struct tcp_pcb *tpcb&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;tcpecho_raw_send(struct tcp_pcb *tpcb, struct tcpecho_raw_state *es)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void&lt;BR /&gt;tcpecho_raw_send(struct tcp_pcb *tpcb, struct tcpecho_raw_state *es)&lt;BR /&gt;{&lt;BR /&gt; struct pbuf *ptr;&lt;BR /&gt; err_t wr_err = ERR_OK;&lt;BR /&gt; char mydata[1024] = "Hello everyone\n";&lt;/P&gt;&lt;P&gt;// tcpecho_raw_init();&lt;BR /&gt; while ((wr_err == ERR_OK) &amp;amp;&amp;amp;&lt;BR /&gt; (es-&amp;gt;p != NULL) &amp;amp;&amp;amp;&lt;BR /&gt; (es-&amp;gt;p-&amp;gt;len &amp;lt;= tcp_sndbuf(tpcb))) {&lt;BR /&gt; ptr = es-&amp;gt;p;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;wr_err = tcp_write(tpcb, "FRDM K64-F",10, 1);&amp;nbsp; // This is working fine&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; if (wr_err == ERR_OK) {&lt;BR /&gt; u16_t plen;&lt;/P&gt;&lt;P&gt;plen = ptr-&amp;gt;len;&lt;BR /&gt; /* continue with next pbuf in chain (if any) */&lt;BR /&gt; es-&amp;gt;p = ptr-&amp;gt;next;&lt;BR /&gt; if(es-&amp;gt;p != NULL) {&lt;BR /&gt; /* new reference! */&lt;BR /&gt; pbuf_ref(es-&amp;gt;p);&lt;BR /&gt; }&lt;BR /&gt; /* chop first pbuf from chain */&lt;BR /&gt; pbuf_free(ptr);&lt;BR /&gt; /* we can read more data now */&lt;BR /&gt; tcp_recved(tpcb, plen);&lt;BR /&gt; } else if(wr_err == ERR_MEM) {&lt;BR /&gt; /* we are low on memory, try later / harder, defer to poll */&lt;BR /&gt; es-&amp;gt;p = ptr;&lt;BR /&gt; } else {&lt;BR /&gt; /* other problem ?? */&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;I tried above function like this but invalid pcb error is generated.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;static void&lt;BR /&gt;tcpecho_raw_send()&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;struct tcp_pcb *new_tpcb;&lt;/SPAN&gt;&lt;BR /&gt;struct pbuf *ptr;&lt;BR /&gt;err_t wr_err = ERR_OK;&lt;BR /&gt;char mydata[1024] = "Hello everyone\n";&lt;/P&gt;&lt;P&gt;// tcpecho_raw_init();&lt;BR /&gt;while ((wr_err == ERR_OK) &amp;amp;&amp;amp;&lt;BR /&gt;(es-&amp;gt;p != NULL) &amp;amp;&amp;amp;&lt;BR /&gt;(es-&amp;gt;p-&amp;gt;len &amp;lt;= tcp_sndbuf(tpcb))) {&lt;BR /&gt;ptr = es-&amp;gt;p;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;wr_err = tcp_write(new_tpcb, "FRDM K64-F",10, 1);&amp;nbsp; // This is working fine&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if (wr_err == ERR_OK) {&lt;BR /&gt;u16_t plen;&lt;/P&gt;&lt;P&gt;plen = ptr-&amp;gt;len;&lt;BR /&gt;/* continue with next pbuf in chain (if any) */&lt;BR /&gt;es-&amp;gt;p = ptr-&amp;gt;next;&lt;BR /&gt;if(es-&amp;gt;p != NULL) {&lt;BR /&gt;/* new reference! */&lt;BR /&gt;pbuf_ref(es-&amp;gt;p);&lt;BR /&gt;}&lt;BR /&gt;/* chop first pbuf from chain */&lt;BR /&gt;pbuf_free(ptr);&lt;BR /&gt;/* we can read more data now */&lt;BR /&gt;tcp_recved(tpcb, plen);&lt;BR /&gt;} else if(wr_err == ERR_MEM) {&lt;BR /&gt;/* we are low on memory, try later / harder, defer to poll */&lt;BR /&gt;es-&amp;gt;p = ptr;&lt;BR /&gt;} else {&lt;BR /&gt;/* other problem ?? */&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Kapil Patil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2019 05:20:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970394#M4893</guid>
      <dc:creator>kapil_p</dc:creator>
      <dc:date>2019-08-29T05:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Data transfer on ethernet</title>
      <link>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970395#M4894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kapil,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please show me errors you mentioned? Even better if you can share your code with the modifications stated in your previous reply so I can replicate this on my side.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Felipe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Sep 2019 21:05:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-IDE/Data-transfer-on-ethernet/m-p/970395#M4894</guid>
      <dc:creator>FelipeGarcia</dc:creator>
      <dc:date>2019-09-02T21:05:42Z</dc:date>
    </item>
  </channel>
</rss>

