W5300 problem in sending TCP packets to PC - Page 1
Forum section: electronics / general

author: javad2040
author_rank: Contributor
timestamp: August 24, 2017, 09:15:29 am
content: Hi,I have a Custom made FPGA board for W5300, I have inited all the things and my basic hardware is working fine,I can get a ping from the board.The problem is that I can not send any TCP packets to PC but I can receive TCP packets, I have done every thing that the data sheet says, I will stock in this state thatMy Board will only send fixed numbers to the PC, I think I will stock in this stated that's mentioned in the Datasheet of W5300 in page 99Do you have any Idea what might be wrong? have you seen something similar?Regards

author: Whales
author_rank: Super Contributor
timestamp: August 24, 2017, 10:22:34 pm
content: To get TCP working there are so many complex layers that need to be working first. Don't try and solve everything at once, try and isolate out some features so you are testing less at one time.IP and netmasks on both devices? Have you run a wireshark capture on the computer, set to promiscuous mode?Can you get the board to output thingsotherthan TCP packets? UDP? ARP? ICMP (eg does it reply to pings)?

author: ejeffrey
author_rank: Super Contributor
timestamp: August 25, 2017, 06:23:16 am
content: QuoteIt isn't at all clear what you mean by this. TCP requires packets flowing in both directions for session establishment and for data transmission. So if you can establish a connection, it means you have packets moving in both directions. In this case, any problem you have is almost certainly that you are not sending the data to the W5300 chip properly (like you are writing to the wrong register). If you mean that you mean that you can't establish a connection because your SYN never gets ACKed, then check IP settings on the wiznet chip and firewall settings on your PC.Are you using the wiznet socket approximation library or rolling your own? I strongly recommend the provided library if your microcontroller supports it.

author: javad2040
author_rank: Contributor
timestamp: August 25, 2017, 07:17:54 pm
content: thank you for reply.Since i use FPGA, the library for w5300 doesn't exist and i forced to write VHDL code for w5300. I set all register values and addresses correctly ex: MAC,IP,Gateway and Subnet values are set and pinging work correctly.Also i can send Packets form PC to w5300 and FPGA, that they received correctly by FPGA, but the problem is that the PC can not receive the correct and same Packets that sent to FPGA.I debug the received Packet by FPGA that is true but the received Packets by PC is dummy value that often is fixed value(191 29 191 29 ...).I force to use TCP mode and other mode is not used in my project.I guess the problem is related to Chip, since i use "How_to_Test_Internal_TX_RX_Memory" document that the testing of TX-FIFO is fails.please help me to solve this problem.

author: nctnico
author_rank: Super Contributor
timestamp: August 25, 2017, 07:29:42 pm
content: The first step is to use Wireshark to see what is going on on the network. Then use a logic analyser or oscilloscope to verify you are sending the correct data to the W5300. Debugging is all about dividing your system in smaller pieces and checking if each of them works properly by examining the data flowing between the pieces.

author: ejeffrey
author_rank: Super Contributor
timestamp: August 26, 2017, 05:54:38 am
content: Quote from: javad2040 on August 25, 2017, 07:17:54 pmGood.QuoteJust to clear up a misconception: TCP is a byte stream protocol, not packet based. So IP packets are going back and forth in both directions to successfully transmit data in either direction, your problem seems to be with the higher level TCP data streams.QuoteI don't understand what this means. Are you not receiving data at all on the PC, or are you receiving incorrect data? If you are receiving incorrect or corrupt data, how does that work? Is it only when there should be real data, or do you get the dummy data even when the FPGA should be doing nothing? Are you checking the return code from recv()? Maybe the session has disconnected and the recv() call is failing. Are you using non-blocking IO?QuoteIt would still be good to write a test bitstream for the FPGA that sends UDP or RAW packets and see if you see them in wireshark and a simple receiver program on your PC. It would also be good to write a dummy application on a PC that emulates (even in a very crude way) what you expect your FPGA + wiznet chip to do. That will give you a way to test out your PC application separately from the implementation of networking on the FPGA.I guess the problem is related to Chip, since i use "How_to_Test_Internal_TX_RX_Memory" document that the testing of TX-FIFO is fails.please help me to solve this problem.

author: javad2040
author_rank: Contributor
timestamp: August 28, 2017, 06:32:58 pm
content: QuoteQuoteI use Visual Studio and C# for send(receive) data to(from) W5300 and FPGA. I use Network class and socket programming. also i use TCP protocol and byte array for sending and receiving data.QuoteQuoteI receive data but data is incorrect and is fixed value. I check the chip after Send command, the session is established. I use both blocking and non-blocking IO that the result is same(in both manner the received data is faulty).QuoteSince i forced to use TCP protocol for my project and also my time for deliver the project is limit ,implementation the other protocol is impossible and thank you for suggestion.I guess that the chip is corrupted and i decide to change it by another, probably my problem will solve.

author: javad2040
author_rank: Contributor
timestamp: September 05, 2017, 07:47:37 pm
content: hifortunately my problem is solved. The problem is related to MTYPER reg that it wasn't correct value, i set it correctly and the problem solved but new problem is appears:I send data to W5300 that it saved to FPGA and send it back to W5300 Correctly. But when read the data from W5300, the two first received data is zero or dummy value.can everybody help me to solve it?