This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: TMDS273GPEVM
We just need to highlight that we used connection between the ECU and the PC.
Does anyone know how to configure the IP statically without using DHCP server? and if yes, could you please refer us to the exact location in the code to configure the IP statically?
The code below is error,because the first patameter in the function “LwipifEnetApp_netifOpen” and “LwipifEnetApp_getNetifFromId” is a handle.
Hi cl xu,
Sharing the steps below to assign static IP:
The only precautions you need to take are:
1. Not assigning the same IP address to multiple NetIFs for obvious reasons,
2. Making sure you don't call App_allocateIPAddress() function
static void App_setupNetif() { ip4_addr_t ipaddr[2], netmask[2], gw[2]; ip4_addr_set_zero(&gw[0]); ip4_addr_set_zero(&ipaddr[0]); ip4_addr_set_zero(&netmask[0]); ip4_addr_set_zero(&gw[1]); ip4_addr_set_zero(&ipaddr[1]); ip4_addr_set_zero(&netmask[1]); gw[0].addr = ((uint32_t)0x0100A8C0UL); // 192.168.0.1 ipaddr[0].addr = ((uint32_t)0x0a00A8C0); // 192.168.0.10 netmask[0].addr = ((uint32_t)0x00FFFFFF);// 255.255.255.0 gw[1].addr = ((uint32_t)0x0100A8C0UL); // 192.168.0.1 ipaddr[1].addr = ((uint32_t)0x0300A8C0); // 192.168.0.3 netmask[1].addr = ((uint32_t)0x00FFFFFF);// 255.255.255.0 DebugP_log("Starting lwIP, local interface IP is dhcp-enabled\r\n"); hlwipIfApp = LwipifEnetApp_getHandle(); for (uint32_t netifIdx = 0U; netifIdx < ENET_SYSCFG_NETIF_COUNT; netifIdx++) { /* Open the netif and get it populated*/ g_pNetif[netifIdx] = LwipifEnetApp_netifOpen(hlwipIfApp, NETIF_INST_ID0 + netifIdx, &ipaddr[netifIdx], &netmask[netifIdx], &gw[netifIdx]); netif_set_status_callback(g_pNetif[netifIdx], App_netifStatusChangeCb); netif_set_link_callback(g_pNetif[netifIdx], App_netifLinkChangeCb); netif_set_up(g_pNetif[NETIF_INST_ID0 + netifIdx]); } LwipifEnetApp_startSchedule(hlwipIfApp, g_pNetif[ENET_SYSCFG_DEFAULT_NETIF_IDX]); }
Hi Cl Xu,
I see incorrect IP getting assigned in the application (192.168.0.10) instead of your desired IP (192.168.60.10). Just to confirm, did you rebuild the application before testing it again? The Ping failed as the incorrect IP got assigned.
Can you please recheck and let me know if it works, because I tested the same workaround locally and Ping worked.
Thanks and Regards,
Shaunak
Hi CL XU,
I'll re-iterate over it once again with some other IP address just to avoid any confusion,
Let's take it as follows:
IP address: 192.168.1.3 (0x0301A8C0)
Gateway: 192.168.1.1 (0x0101A8C0)
Netmask: 255.255.255.0 (0x00FFFFFF)
After making these changes, please rebuild your application and now load the newly built binary, the IP assigned in the application should now be 192.168.1.3. Test it by running the Ping command from a PC with IP 192.168.1.xx
Regards,
Shaunak
The UDP Client Example could not communication successfully, in the "examples/networking/lwip/enet_cpsw_udpclient" folder.
The TCP Client Example is OK, in the "examples/networking/lwip/enet_cpsw_tcpclient" folder.
Please test the “UDP Client Example”, and let me know if it works.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
There are two questions,as follows:
(1)、In the TCP Client Example, the "DebugP_log("xxxx")" could not be shown in the concose window.
(2)、The sources in the example project could not be imported locally, while import the "TCP Client Example".The icons is shown as the image.
Please let me know how to solve the issues
Hi CL XU,
I tested both the TCP Client and the UDP Client applications with static IP assignment (following the same steps and IP address I shared in my last response) Attaching the console outputs of both the applications as a reference:
TCP Client:
========================== CPSW LWIP TCP CLIENT ========================== EnetPhy_bindDriver:1717 PHY 0 is alive Starting lwIP, local interface IP is dhcp-enabled [LWIPIF_LWIP] LwIP Checksum offload support disabled [LWIPIF_LWIP] NETIF INIT SUCCESS Host MAC address-0 : 70:ff:76:1d:ec:f2 Enet IF UP Event. Local interface IP:192.168.1.3 [LWIPIF_LWIP] Enet has been started successfully Waiting for network UP ... Waiting for network UP ... Cpsw_handleLinkUp:1323 MAC Port 1: link up Network Link UP Event Network is UP ... TCP Client Menu: Enter TCP server IPv4 address:(example: 192.168.101.100) 192.168.1.2 Enter TCP server IPv4 address:(example: 192.168.101.100) 192.168.1.2 IP eneterd is: 192.168.1.2 <<<< ITERATION 1 >>>> Connecting to: 192.168.1.2:8888 Connection with the server is established "Hello over TCP 1" was sent to the Server Successfully received the packet 1 "Hello over TCP 2" was sent to the Server Successfully received the packet 2 "Hello over TCP 3" was sent to the Server Successfully received the packet 3 "Hello over TCP 4" was sent to the Server Successfully received the packet 4 "Hello over TCP 5" was sent to the Server Successfully received the packet 5 Connection closed <<<< ITERATION 2 >>>> Connecting to: 192.168.1.2:8888 Connection with the server is established "Hello over TCP 1" was sent to the Server Successfully received the packet 1 "Hello over TCP 2" was sent to the Server Successfully received the packet 2 "Hello over TCP 3" was sent to the Server Successfully received the packet 3 "Hello over TCP 4" was sent to the Server Successfully received the packet 4 "Hello over TCP 5" was sent to the Server Successfully received the packet 5 Connection closed
UDP Client:
========================== CPSW LWIP SIMPLE SOCKET ========================== EnetPhy_bindDriver:1717 PHY 0 is alive Starting lwIP, local interface IP is dhcp-enabled [LWIPIF_LWIP] LwIP Checksum offload support disabled [LWIPIF_LWIP] NETIF INIT SUCCESS Host MAC address-0 : 70:ff:76:1d:ec:f2 Enet IF UP Event. Local interface IP:192.168.1.3 [LWIPIF_LWIP] Enet has been started successfully Waiting for network UP ... Waiting for network UP ... Cpsw_handleLinkUp:1323 MAC Port 1: link up Network Link UP Event Network is UP ... UDP socket Menu: Enter server IPv4 address:(example: 192.168.101.100) 192.168.1.2 <<< Iteration 1 >>>> Connecting to: 192.168.1.2:8888 Message to host: Hello over UDP 0 Message from host: Hello over UDP 0 Message to host: Hello over UDP 1 Message from host: Hello over UDP 1 Message to host: Hello over UDP 2 Message from host: Hello over UDP 2 Message to host: Hello over UDP 3 Message from host: Hello over UDP 3 Message to host: Hello over UDP 4 Message from host: Hello over UDP 4 Closed Socket connection\
To run the server, use the command in your linux terminal, enter the IP of the Server when the applcation prompts
TCP Server: ncat -e /bin/cat -kv -l 8888
UDP Server: ncat -e /bin/cat -ukv -l 8888
The default Out of the Box application is configured to transfer certain number of packets and close the connection.
Note:
The socket connection will remain open only for a short duration during which some TCP (or UDP) packets will be transferred. If you try to Ping the EVM in this duration, it works, Once the transfer of Packets is complete, the Socket Connection will be closed, and the Ping command would be unresponsive (Destination Host Unreachable).
In case you want to keep the connection open, you will have to comment the following lines of code so the connection stays alive.
ret = lwip_close(sock);
1). The DebugP_logs were visible in both the examples when the correct COM port was selected in my case. In your case, do you observe none of the logs or some specific logs?
2) Can you please provide some further elaboration for the same, did you add some more files in the example which are not visible when you import the project?
Regards,
Shaunak
Thanks for your reply.
We could make a communication between the ECU and the PC
Does anyone know how to configure the PORT??
Hi CL XU,
If the IP assignment issue has been resolved please close the thread and open a new one for port configuration, the respective expert will be assigned accordingly.
Regards,
Shaunak