cancel
Showing results for 
Search instead for 
Did you mean: 

netXDuo TCP Server problem

Giovanni1
Associate

Hello all.

I'm writing an application with the NUCLEO-H563ZI board (with the intention to use later the STM32H563 into a custom board).

My application will communicate with a master PC via the embedded Ethernet, exchanging process data and commands.

The protocol will be, most probably, Modbus/TCP.

I've been able to configure the board (I/O), run the ThreadX OS, setup and run netXDuo middleware.

I set up a TCP socket server connection on the STM32, with a C# test application as a client.

I can open the socket from the C# client, send ad receive TCP packets almost correctly.

The TCP server on the STM32 receives a packet from the client, extract the payload (data) from it, creates a new packet, copy the payload to the new packet and then echoes back the new packet to the client.

This will change in the future, of course, but for the first tests it seemed nice to get back the same data.

Here I have a problem.

Everything works fine if the packet payload is less than 516 bytes long; over such a threshold, the packet is broken, with 4 nul characters placed at position from 516 to 519.

I tried to send different length of data, up to 1500 characters (split into two packets, since the maximum packet size on my network adapter is 1460 bytes); all of them, if longer than 516 characters, are broken.

I sniffed the communcation with WireShark, the sent packet from the PC is correct (no nul characters), while the receiver echo is broken.

You can see an example in the two files attached, Send.txtx (sent from the PC client) and Receive.txt (Received from the STM32 board).

I can't find any error in my code, it seems that all the memory pools are correctly allocated.

I attach here my project files.

I'm afraid there's something wrong with the netXDuo library.

Can you check?

 

1 REPLY 1
Giovanni1
Associate

nevermind.

Just after i posted this I found the error in my code...