cancel
Showing results for 
Search instead for 
Did you mean: 

NetxDuo not working with a static IP addresss

CharterWim
Associate II

 

Hello everyone,
 
 
I'm getting my feet wet with ThreadX and NetxDuo.
I'm using a NUCLEO-H563ZI board.
I started by building and flashing the Nx_UDP_Echo_Server example project to the board using the STM32CubeIDE.
This worked right away. The board got address 192.168.1.164 assigned, green led was flashing, responded to a ping, and echoed whatever I sent over UDP port 6000.
 
My goal however, is to get this working with a static IP address. To accomplish this, I made the following changes in CubeMX:
- Middleware and Software packs -> NETXDUO -> Addons (Top pane)
Changed DHCP from "Client" to "Disable"
- Middleware and Software packs -> NETXDUO -> Configuration (Bottom pane) -> NetxDuo Protocols
NetxDuo Ethernet IP Address: From "192.168.1.1" to "192.168.1.164"
 
After that I needed to make the following code changes to get the software to compile again:
app_netxduo.h:
- removed the include for nxd_dhcp_client.h
app_netxduo.c:
- removed:
          nx_dhcp_stop(&DHCPClient);
          nx_dhcp_start(&DHCPClient);
- changed the last argument of the tx_thread_create call for the AppUDPThread from "TX_DONT_START" to "TX_AUTO_START"
 
Now, strangely enough, when I run this code with the CubeIDE debugger attached, it works just as expected.
But when I stop the debugger and reset the device:
- Green led does flash (so AppUDPThread must be running)
- Board does not respond to a ping
- No messages sent to the board are echoed back
- RJ45 port:
Green led is on
Orange led flashes
 
Log from serial port:
Nx_UDP_Echo_Server application started..
UDP Server listening on PORT 6000.. 
The network cable is not connected.
The network cable is connected again.
UDP Echo Server is available again.
 
Does anyone have any idea what could cause this, and how I get an UDP connection running with a static IP?
 
Thanks in advance.
Wim!
 
Board: NUCLEO-H563ZI
BSP: STM32Cube_FW_H5_V1.2.0
CubeIDE: 1.15.1
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @CharterWim 

I'm just starting to learn ThreadX + NetXDuo, so I may have made a mistake that I'm still not aware of.

However, it seems I managed to run the Nx_UDP_Echo_Server without the debugger connected to my NUCLEO-H563ZI.

What I did was:

1. Disabled DHCP client exactly as you did.

2. When creating the UDP thread, I still used the TX_DONT_START so it will not run until asked to.

3. I changed the code in App_Link_Thread_Entry (app_netxduo.c) that verifies whether the cable is connected. Basically, I am calling nx_ip_driver_direct_command independent of the status returned by nx_ip_interface_status_check. I'm also using tx_thread_resume(&AppUDPThread)  and tx_thread_suspend(&AppUDPThread) when the link is on or off. See my file attached. Seems to work.

Please let me know if I made any mistake, or if this works for you also!

BR

Fabio

View solution in original post

5 REPLIES 5
STea
ST Employee

Hello @CharterWim ,

if you are regenerating with cubeMX and disabling DHCP addons it should compile and the includes should eliminated automatically.

You will find attached the file app_netxduo.c used to implement UDP Server with static IP.

BR

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi @STea,

Thank you for your swift response.
The "nxd_dhcp_client.h" include is not removed automatically by CubeMx when disabeling the DHCP client.
I think this is because it is inside a USER CODE section in the demo application code.

CharterWim_0-1715759024961.png

But this is not a big problem for me. I just wanted to be very detailed in describing what I did- and didn't do.

Unfortunately your app_netxduo.c yields the same results as my code.
It works when the debugger is attached.
It doesn't work when running without a debugger attached.

Yesterday I tried the same demo application from an older version of the MCU package, STM32Cube_FW_H5_V1.1.1 instead of STM32Cube_FW_H5_V1.2.0.
In the older package, the demo app does work with a static IP address without the debugger attached.

I got the idea after reading this thread about a problem simular to the one I'm facing.
There appears to be something wrong with the STM32Cube_FW_H5_V1.2.0 package I think.

Unfortunately it is hard to use STM32Cube_FW_H5_V1.1.1 with CubeMX.
Even after I removed the STM32Cube_FW_H5_V1.2.0 package, it does not want to generate code with version V1.1.1.
It keeps downloading V1.2.0

Is there a way to work around this?
Or (better even) do you have an ETA on when the problem in the MCU package will be solved? (Internal ticket number: 179408)

Regards, Wim!

 

Hello @CharterWim ,

the ticket is still in progress indeed your problem is related to the same issue. you will get some updates soon as our experts are analyzing the root cause.

BR 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi @CharterWim 

I'm just starting to learn ThreadX + NetXDuo, so I may have made a mistake that I'm still not aware of.

However, it seems I managed to run the Nx_UDP_Echo_Server without the debugger connected to my NUCLEO-H563ZI.

What I did was:

1. Disabled DHCP client exactly as you did.

2. When creating the UDP thread, I still used the TX_DONT_START so it will not run until asked to.

3. I changed the code in App_Link_Thread_Entry (app_netxduo.c) that verifies whether the cable is connected. Basically, I am calling nx_ip_driver_direct_command independent of the status returned by nx_ip_interface_status_check. I'm also using tx_thread_resume(&AppUDPThread)  and tx_thread_suspend(&AppUDPThread) when the link is on or off. See my file attached. Seems to work.

Please let me know if I made any mistake, or if this works for you also!

BR

Fabio

Hi @FabioFly 

I can happily confirm this works!

Great solution. Thank you!

 

Regards,

Wim!