cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get simple Ethernet working - NUCLEO-H563ZI - NetXDuo

sparqy
Visitor

Hello,

I have been trying to setup Ethernet on a NUCLEO-H563ZI to no avail. As recommended I am using the NETXDUO middleware. When setting up my project with CubeMX I enable DHCP but the MCU never seems to send any DHCP packets (Checking through wireshark). This is with completely unmodified code provided by the NX Core Init which generates the nx_app_thread_entry. After some further debugging it seems like the program hangs while waiting for the DHCP Semaphore which says that an IP Address is ready. Specifically this line:

tx_semaphore_get(&DHCPSemaphore, TX_WAIT_FOREVER) != TX_SUCCESS

 

Memory is not an issue in this case as those have been previous issues. I now assign well over 20kb for tx_app and nx_app.This sample program was also tested on a fresh board out of the box.

 

I also have another script that seems to work halfway with messages for DHCPDiscover and DHCPOffer.
Bellow is the main code for that program. In this case I don't use the pre-generated nx_app_thread. 

void Cu_main(ULONG thread_input){

    tx_thread_sleep(300);


    nx_system_initialize();

    status = nx_packet_pool_create(&packet_pool, "Packet Pool", 1536, packet_pool_memory, NX_PACKET_POOL_SIZE);
    printf("Packet pool: %u\n", status);

    status = nx_ip_create(&ip_instance, "NetX IP", 0, 0, &packet_pool, nx_stm32_eth_driver, ip_thread_stack, NX_IP_STACK_SIZE, 10);
    printf("IP create: %u\n", status);
    
    status = nx_arp_enable(&ip_instance, ARP_cache_memory, NX_ARP_CACHE_SIZE);
    printf("ARP enable: %u\n", status);

    status = nx_icmp_enable(&ip_instance);
    printf("ICMP enable: %u\n", status);

    status = nx_dhcp_create(&dhcp_client, &ip_instance, "DHCP Client");
    printf("DHCP create: %u\n", status);

    status = nx_dhcp_start(&dhcp_client);
    printf("DHCP start: %u\n", status);


    ULONG ip_addr, netmask;

    while (1){
        status = nx_ip_address_get(&ip_instance, &ip_addr, &netmask);
        printf("S: %u Got IP: %lu.%lu.%lu.%lu\n",
            status,
            (ip_addr >> 24) & 0xFF,
            (ip_addr >> 16) & 0xFF,
            (ip_addr >> 8) & 0xFF,
            ip_addr & 0xFF);

        if(ip_addr != 0){
            BSP_LED_Toggle(LED2);
        }
        BSP_LED_Toggle(LED1);
        tx_thread_sleep(100); 
    }
}

I have 0 idea why this is not working.

I will add both IOC files to this post.

Any help would be appreciated as I am losing hair over this haha.

 

1 REPLY 1
MGogr.1
Associate III

why dont you try with static ip address? see if it works properly and then move to dhcp.