<?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: Request for Baremetal TCP Client Example Using LwIP Stack on MIMXRT1180-EVK in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1975647#M32213</link>
    <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/241885"&gt;@PavanKumarS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, i forgot it.&lt;/P&gt;
&lt;P&gt;ethernetif_input(&amp;amp;netif) is responsible for processing incoming packets. Without this function being called, your application doesn’t receive Ethernet frames from the network interface.&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;If you remove the loop, network events like incoming packets or timeouts won’t be handled, so the connection won’t be properly maintained.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;If you want to avoid relying on this polling loop, you can use LwIP with an operating system (like FreeRTOS) to handle network events asynchronously through interrupts and tasks. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;BR&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;Hang&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Oct 2024 02:54:26 GMT</pubDate>
    <dc:creator>Harry_Zhang</dc:creator>
    <dc:date>2024-10-17T02:54:26Z</dc:date>
    <item>
      <title>Request for Baremetal TCP Client Example Using LwIP Stack on MIMXRT1180-EVK</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1972718#M32168</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am working with the MIMXRT1180-EVK board and would like to implement a baremetal TCP client using the LwIP stack. Could you kindly provide an example or point me toward resources that would help me achieve this?&lt;/P&gt;&lt;P&gt;I am looking for a basic setup that includes Ethernet initialization and a simple TCP client communication implementation.&lt;/P&gt;&lt;P&gt;Any assistance would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2024 10:23:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1972718#M32168</guid>
      <dc:creator>PavanKumarS</dc:creator>
      <dc:date>2024-10-13T10:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Request for Baremetal TCP Client Example Using LwIP Stack on MIMXRT1180-EVK</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1973278#M32173</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/241885"&gt;@PavanKumarS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can download the&amp;nbsp;MIMXRT1180-EVK SDK.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://kex-stage.nxp.com/en/select" target="_blank"&gt;Select Board | MCUXpresso SDK Builder (nxp.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;And you can refer to lwip examples.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HangZhang_0-1728901501274.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/304535iDF979DB90AF782BE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HangZhang_0-1728901501274.png" alt="HangZhang_0-1728901501274.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Hang&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 10:25:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1973278#M32173</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2024-10-14T10:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: Request for Baremetal TCP Client Example Using LwIP Stack on MIMXRT1180-EVK</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1973284#M32174</link>
      <description>Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/229957"&gt;@Harry_Zhang&lt;/a&gt;,&lt;BR /&gt;I have checked the SDK, but I was not able to find the bare metal TCP client example. Could you kindly provide an example or point me towards the resources that could help.&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Oct 2024 10:36:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1973284#M32174</guid>
      <dc:creator>PavanKumarS</dc:creator>
      <dc:date>2024-10-14T10:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Request for Baremetal TCP Client Example Using LwIP Stack on MIMXRT1180-EVK</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1974199#M32190</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/241885"&gt;@PavanKumarS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;To implement a baremetal TCP client on the MIMXRT1180-EVK using the LwIP stack,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Import the lwip_ping_bm_cm33 example.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;This examples include the necessary Ethernet initialization, which you can adapt to create a TCP client.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Then you will add client codes.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Here’s a basic example for creating a TCP client. You need to set up a connection and manage sending and receiving data using callbacks.&lt;BR /&gt;#include "lwip/tcp.h"&lt;BR /&gt;static struct tcp_pcb *tcp_client_pcb;&lt;BR /&gt;// Callback when data is received&lt;BR /&gt;err_t tcp_client_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) {&lt;BR /&gt;if (p == NULL) {&lt;BR /&gt;// Connection closed&lt;BR /&gt;tcp_close(tpcb);&lt;BR /&gt;return ERR_OK;&lt;BR /&gt;}&lt;BR /&gt;// Process received data&lt;BR /&gt;tcp_recved(tpcb, p-&amp;gt;len);&lt;BR /&gt;pbuf_free(p);&lt;BR /&gt;return ERR_OK;&lt;BR /&gt;}&lt;BR /&gt;// Callback when a TCP connection is established&lt;BR /&gt;err_t tcp_client_connected(void *arg, struct tcp_pcb *tpcb, err_t err) {&lt;BR /&gt;if (err == ERR_OK) {&lt;BR /&gt;// Connection successful&lt;BR /&gt;// Set the receive callback&lt;BR /&gt;tcp_recv(tpcb, tcp_client_recv);&lt;BR /&gt;// Send some data&lt;BR /&gt;const char *data = "Hello, Server!";&lt;BR /&gt;tcp_write(tpcb, data, strlen(data), TCP_WRITE_FLAG_COPY);&lt;BR /&gt;} else {&lt;BR /&gt;// Handle connection error&lt;BR /&gt;tcp_close(tpcb);&lt;BR /&gt;}&lt;BR /&gt;return err;&lt;BR /&gt;}&lt;BR /&gt;// Initiate the TCP connection&lt;BR /&gt;void tcp_client_connect(void) {&lt;BR /&gt;ip_addr_t server_ip;&lt;BR /&gt;IP4_ADDR(&amp;amp;server_ip, 192, 168, 1, 100); // Set the server's IP address&lt;BR /&gt;// Create a new TCP control block&lt;BR /&gt;tcp_client_pcb = tcp_new();&lt;BR /&gt;// Connect to the server on port 80 (you can change this to your desired port)&lt;BR /&gt;tcp_connect(tcp_client_pcb, &amp;amp;server_ip, 80, tcp_client_connected);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Integrate everything in the main() function of your application.&lt;BR /&gt;int main(void) {&lt;BR /&gt;// Board initialization (clocks, Ethernet, etc.)&lt;BR /&gt;BOARD_InitBootPins();&lt;BR /&gt;BOARD_InitBootClocks();&lt;BR /&gt;BOARD_InitBootPeripherals();&lt;BR /&gt;BOARD_InitDebugConsole();&lt;BR /&gt;// Initialize the LwIP stack and network interface&lt;BR /&gt;lwip_init_function();&lt;BR /&gt;// Start the TCP client&lt;BR /&gt;tcp_client_connect();&lt;BR /&gt;while (1) {&lt;BR /&gt;// LwIP needs to be continuously polled to handle network events&lt;BR /&gt;sys_check_timeouts();&lt;BR /&gt;}&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;BR&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;Hang&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 10:38:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1974199#M32190</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2024-10-15T10:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Request for Baremetal TCP Client Example Using LwIP Stack on MIMXRT1180-EVK</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1974832#M32203</link>
      <description>Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/229957"&gt;@Harry_Zhang&lt;/a&gt;,&lt;BR /&gt;I followed the steps provided and implemented the TCP client as described, but I encountered an issue where the connection wasn't being established with the server. However, when I added the line ethernetif_input(&amp;amp;netif); in the main while loop, the connection worked.&lt;BR /&gt;the loop:&lt;BR /&gt;while (1) {&lt;BR /&gt;ethernetif_input(&amp;amp;netif);&lt;BR /&gt;// LwIP needs to be continuously polled to handle network events&lt;BR /&gt;sys_check_timeouts();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I’m trying to understand why this loop is necessary. Is there a way to isolate the connection functionality so that it doesn't rely on the loop? How can I make the connection part independent of this polling mechanism?</description>
      <pubDate>Wed, 16 Oct 2024 05:55:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1974832#M32203</guid>
      <dc:creator>PavanKumarS</dc:creator>
      <dc:date>2024-10-16T05:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Request for Baremetal TCP Client Example Using LwIP Stack on MIMXRT1180-EVK</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1975647#M32213</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/241885"&gt;@PavanKumarS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, i forgot it.&lt;/P&gt;
&lt;P&gt;ethernetif_input(&amp;amp;netif) is responsible for processing incoming packets. Without this function being called, your application doesn’t receive Ethernet frames from the network interface.&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;If you remove the loop, network events like incoming packets or timeouts won’t be handled, so the connection won’t be properly maintained.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;If you want to avoid relying on this polling loop, you can use LwIP with an operating system (like FreeRTOS) to handle network events asynchronously through interrupts and tasks. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;BR&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-teams="true"&gt;&lt;SPAN class="ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;Hang&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2024 02:54:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Request-for-Baremetal-TCP-Client-Example-Using-LwIP-Stack-on/m-p/1975647#M32213</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2024-10-17T02:54:26Z</dc:date>
    </item>
  </channel>
</rss>

