cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the STM32H723-Nucleo project Nx_TCP_Echo_Server without using the DHCP?

GGree.1
Associate III
 
1 ACCEPTED SOLUTION

Accepted Solutions
GGree.1
Associate III

Finally found the reason for the hardfault. It was a call left over after removing the other associated calls for udp at line 365.

       /* get the client IP address and port */

       nx_udp_source_extract(data_packet, &source_ip_address, &source_port);

Without the other udp calls before it to enable udp this line would cause code to be executed, who knows where. The Fault analyzer was not helpful. I found it by putting printf statements after every line which forced me to read the line. After commenting it out, no more hardfault.

View solution in original post

4 REPLIES 4
GGree.1
Associate III

Sorry A little detail is needed. I got this project to work from the repo and was also able to create a copy of the project not in the repo that works. But I would like the IP of the server to be hard coded and not use DHCP. When I comment out the section that starts the DHCP (ret = nx_dhcp_start(&DHCPClient);) and use:

ret = nx_ip_address_set(&IpInstance, IP_ADDRESS(192, 168, 0, 9), 0xFFFFFF00UL);

instead, the server goes into listening state but nothing ever goes to the callback that was registered so no connections are made. I do get a response from the ip_address_change_notify_callback when the IP is set by the line above. I am creating the socket followed by the listen.

I have attached the code for app_netxduo.c

GGree.1
Associate III

One clearification, I did find a missing statement at the beginning of the attached file. It was missing:

nx_system_initialization().

However adding this call to the beginning of the UINT MX_NetXDuo_Init(VOID *memory_ptr) process did not change anything.

Also noticed that a printf statement was not showing the IP really being set. Obviously this has no bearing on the problem.

GGree.1
Associate III

Not sure what the real difference was but I was able to start from the example project in the pack for the TCP server as indicated in the title and setup as a standalone project from the repo. Of course it works without any faults.

Then I commented out the dhcp calls and replaced with a single nx_ip_address_change_notify call.

this works without anymore hardfaults.

I have attached the working file.

Just as a side note: I was able to use the copy - paste method for the project in the project explorer which automatically renamed the new project project_name2. Well really it gave me the choice. I then renamed the .ioc file before any other actions and that worked like a charm.

In that project I, removed the dhcp addon within the .ioc (opened CubeMxIDE) and regenerated the project. It is interesting to note that the regenerated project was now missing all of the Middleware include paths.

It first looked like this in the project it was copied from:

0693W00000JQ6tFQAT.pngthen it turned into this after the regeneration:

0693W00000JQ6tZQAT.pngTo fix it I had to go back through and manually add the paths back.

I used the method of right click on the folder of interest in the project tree and select "Add/Remove include path".

I double checked that making a copy of the project would copy the include paths correctly so it was definitely a fault of the regeneration after the Addons DHCP Client feature was unchecked in the Software Packs Component Selector.

GGree.1
Associate III

Finally found the reason for the hardfault. It was a call left over after removing the other associated calls for udp at line 365.

       /* get the client IP address and port */

       nx_udp_source_extract(data_packet, &source_ip_address, &source_port);

Without the other udp calls before it to enable udp this line would cause code to be executed, who knows where. The Fault analyzer was not helpful. I found it by putting printf statements after every line which forced me to read the line. After commenting it out, no more hardfault.