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.

MCU-PLUS-SDK-AM263PX: enet lwip socket example DHCP not working SDK 10.0

Part Number: MCU-PLUS-SDK-AM263PX
Other Parts Discussed in Thread: TMDSCNCD263P

Tool/software:

Using SDK 10.0.0.35 with ccs 12.8.0.00012 and TMDSCNCD263P trying to run enet_cpsw_socket_am263px-cc_r5fss0-0_freertos_ti-arm-clang.

Created a very simple network like the example suggests TI<>Router<> PC(Ubuntu).  No other network connections.

IPs 192.168.50.61<>192.168.50.1<>192.168.50.142

Router DHCP working fine because running enet_lwip_cpsw_am263px-cc_r5fss0-0_freertos_ti-arm-clang example works fine and TI got 192.168.50.61 when using DHCP.

With the socket example, DHCP did not request for IP. and the example is just stuck at "Waiting for network UP"

==========================
CPSW LWIP SIMPLE SOCKET
==========================
EnetAppUtils_reduceCoreMacAllocation: Reduced Mac Address Allocation for CoreId:0 From 4 To 2
Link Status Changed. PHY: 0x0, state: up
Open MAC port 2
EnetPhy_bindDriver:1842
PHY 0 is alive
Starting lwIP, local interface IP is dhcp-enabled
[LWIPIF_LWIP] NETIF INIT SUCCESS
Host MAC address-0 : 70:ff:76:1f:61:88
Enet IF UP Event. Local interface IP:0.0.0.0
[LWIPIF_LWIP] Enet has been started successfully
Waiting for network UP ...
Waiting for network UP ...
Cpsw_handleLinkUp:1626
MAC Port 2: link up
Network Link UP Event
Waiting for network UP ...
Waiting for network UP ...
Waiting for network UP ...
Waiting for network UP ...

TI never send DHCP Request packet.

Tried changing to static IP using instructions:

Started ncat on Ubuntuncat -e /bin/cat -kv -l 8888
Ncat: Version 7.94SVN ( https://nmap.org/ncan )
Ncat: listening on [::]:8888
Ncat: Listening on 0.0.0.0:8888

TI is still unable to connect.

==========================
CPSW LWIP SIMPLE SOCKET
==========================
EnetAppUtils_reduceCoreMacAllocation: Reduced Mac Address Allocation for CoreId:0 From 4 To 2
Link Status Changed. PHY: 0x0, state: up
Open MAC port 2
EnetPhy_bindDriver:1842
PHY 0 is alive
Starting lwIP, local interface IP is dhcp-enabled
[LWIPIF_LWIP] NETIF INIT SUCCESS
Host MAC address-0 : 70:ff:76:1f:61:88
Enet IF UP Event. Local interface IP:192.168.50.61
[LWIPIF_LWIP] Enet has been started successfully
Waiting for network UP ...
Waiting for network UP ...
Cpsw_handleLinkUp:1626
MAC Port 2: link up
Network Link UP Event
Network is UP ...
UDP socket Menu:
Enter server IPv4 address:(example: 192.168.101.100)
192.168.50.142
<<< Iteration 1 >>>>
Connecting to: 192.168.50.142:8888
93.514s : CPU load = 0.66 %
98.515s : CPU load = 1.12 %
ERR: unable to connect
<<< Iteration 2 >>>>
Connecting to: 192.168.50.142:8888
103.516s : CPU load = 1.29 %
108.517s : CPU load = 1.12 %
ERR: unable to connect
<<< Iteration 3 >>>>
Connecting to: 192.168.50.142:8888
113.518s : CPU load = 1.28 %
118.519s : CPU load = 1.14 %
123.520s : CPU load = 1.12 %
ERR: unable to connect
<<< Iteration 4 >>>>
Connecting to: 192.168.50.142:8888
128.521s : CPU load = 1.29 %
133.522s : CPU load = 1.12 %
ERR: unable to connect
<<< Iteration 5 >>>>

Would you be able to give some suggestions as what may be done incorrectly here?  Thanks. 

BTW.  There seems to be conflicting instructions to set static IP.  The above mentioned instructions and also reference to Ethernet LwIP TCP/IP Static IP.  Can you clarify which one to use?

  • Hi Huey Duong,

    Can you please share the boot mode details for your AM263Px? Also what image is flashed to the device? SBL Null or some other application image as well? I will try to reproduce the same on my end as well.c

    For the static IP configuration, please follow: https://software-dl.ti.com/mcu-plus-sdk/esd/AM263PX/latest/exports/docs/api_guide_am263px/NETWORKING_LWIP_STATIC_IP.html

    It does seem that the document has some confusing steps, I will get it updated by the next release.

    Regards,
    Shaunak

  • HI, 

    I assume the AM263Px is an E2 revision board. On this, can you please check the SW14, SW15, SW16 switch configuration? The expected configuration is 0, 0, 0 respectively and my suspicion is that the Switch configuration might be incorrect which is causing your ethernet to not receive packets properly. Please check the highlighted switches in the below image and make sure the SW14, SW15 ,SW16 are in OFF (0) position.

    I tried to run the Same example, with the same SDK version and CCS as you, it worked for me.

    Regards,
    Shaunak

  • hi Shaunak, thanks for the response and taking the time to try it out.  the SW14-16 switches are all in off. The bootmode is in OSPI 8S mode. SB_NULL is flashed using UART boot mode.

    I managed to get the example working simply by using a cheap router.   For others who may have trouble the router I used that didn't work: ASUS RT-AX58U ($200).  The one that worked for all examples D-Link AC1200 R12 ($30).   

    I disabled all the features that seemed reasonable on the ASUS especially firewall and filters, but TI would still not get DHCP address.

    I can only see Discovery packet sent to router.  I'm not sure if Offer packet is sent back, I'll need to find some way of sniffing that packet.

    But the observations did not make sense when using the ASUS:

    1. enet_lwip_cpsw example works and TI gets DHCP address.  Goes through DORA packets.
    2. enet_cpsw_socket, tcp, udp examples all does not get DHCP address.  Only D packet.  (maybe O)
      1.  All #2 examples use similar network setup code.  #1 is different
    3. laptops on network get all DHCP DORA packets
    4. cheap router works in all cases, expensive one does not.

    Something in the #2 examples combined with advanced feature in the router does not cooperate well.   

     

    I'm ok with closing this ticket, but please address the static IP question below first.

  •  https://software-dl.ti.com/mcu-plus-sdk/esd/AM263PX/latest/exports/docs/api_guide_am263px/NETWORKING_LWIP_STATIC_IP.html

    Suggests we modify App_allocateIPAddress() so dhcp_start() would use the the static IP/netmask from g_pNetif[]

    But App_allocateIPAddress() is called after App_setupNetif().  

    App_setupNetIF() would still be setting g_pNetif to DHCP and using it as parameter to call to call netif_set_status_callback / link_callback / _up.

    Would this cause confusion between the netif module and dhcp module?

  • Hi,

    • App_setupNetIF() function opens the NetIF and populates it with null/zero IP address, gateway and netmask.. These are not Static IP or DCHP acquired IP values.
    • The App_setupNetIF() function uses different data structures to store the IP address, gateway and Netmask. The App_allocateIPAddress(), in case of static IP uses globally declared IP address, netmask and gateway. Since both the functions use different data structures, there shouldn't be a confusion between the function calls.

    From top-level it might look confusing to the end user. But the actual static/DHCP IP configuration is done by the App_allocateIPAddress() function only. The App_setupNetIF() just opens and populates zero values to the NetIFs.

    Reading the definition of both the functions might help you clear off the confusion.

    Regards,
    Shaunak