crc32 calculation

hey! i am using spartan 3E board to transmit UDP packets to my pc. I have implemented most of it, i have interfaced the PHY but there seems to be one problem, the data leaves the FPGA bt the packet is dropped at the pc's end, how i know it is that i can see the light blink bt nothing gets through to ethereal. I am assuming that my crc32 is not correct as i have double checked my other headers, the way i am sending them i.e. lower nibble first followed by higher nibble of each byte starting from Preamble -> SFD and so on. IP checksum is also correct as i have implemented it in the same manner as was said on different forums i.e. add all 16bit ip headers and then take their one's complement. This final value is our checksum.

i need to know that how should i send data to crc32 generator? i took the code from [outputlogic.com]. I am sending one byte at a time to the generator and i am calculating crc32 on the fly. I read it on some forums that you have to invert or reverse or do what to the bits and then invert or complement the final result again before transmitting . And also can you tell me how to transmit the final crc32 value i.e. lowest nibble first or what.

Thanks!

--------------------------------------- Posted through

formatting link

Reply to
salimbaba
Loading thread data ...

ne

d,

o

Ethereal should be able to show you that you have a packet even if it has an invalid CRC.

First, put ethereal in promiscuous mode. Second, make sure that you use a simple ethernet card -- one with no onboard calculation of CRCs.

Ethereal will tell you if the PC is doing CRC calculations or if the card is doing them by indicating that it sees them as valid. They won't be valid if they are not completed at the time Ethereal gets them, that is by the PC's stack. If other traffic has a valid CRC and Ethereal tells you that the ones from your board don't, you'll have confirmed that the problem is indeed CRC related. If not, ethereal should indicate another problem.

Steve

Reply to
steve_schefter

My ethernet card has an on board crc calculator. And one more thing, i am broadcasting the packets just to make sure they are received at the other end.

And i read it somewhere that ethereal drops the packets with invalid crc. And if a packet is received , dont you think that the network light of incoming traffic should blink? ,it isnt blinking either.

--------------------------------------- Posted through

formatting link

Reply to
salimbaba

That will stop packets with bad CRCs from getting through then. You are likely correct that it is a CRC problem, but if you want to be sure, you'll have to get another card or test against another PC.

I don't have a specific reference to indicate the contrary, but intuitively that doesn't seem correct. Why would ethereal indicate for each packet that the CRC was valid if it only captured packets with valid CRCs? At least the newer Wireshark does that, and ISTR that ethereal does too.

I'm not following that. In your original post you indicated, "i can see the light blink bt nothing gets through to ethereal." But to answer your question, it would depend on who causes the LED to blink

-- the card's interrupt routine or packet processor.

Steve

Reply to
steve_schefter

hmmm, well i'll see if i can get my hands on another card for testing purposes.

you do have a point there. I didnt think of it that way actually :p

And yeah it sounds confusing as i read it now. To make it clear, let me elaborate it a little bit. When i transmit a packet from FPGA, the light at the back of cpu i.e. network card's LED blinks indicating that it has received some data. But the blinking is not displayed in system tray, network connectivity's icon. i think it's clear now :)

Do you have any idea how should i feed the bytes to the CRC32 generator ?

--------------------------------------- Posted through

formatting link

Reply to
salimbaba

In my experience, the LED blink is caused by circuitry in the PHY.

--
Grant Edwards               grant.b.edwards        Yow! Are we THERE yet?
                                  at               
                              gmail.com
Reply to
Grant Edwards

=A0 =A0 =A0 =A0

I realize that that was your original question and my hoping to show how to confirm that it really was a CRC issue didn't address that. I'm afraid that it has been quite a long time since I have done any CRC in code. At the time, I took a sample short packet from a trace similar to ethereal, then ran the numbers through my algorithm to see if I can up with the same CRC as the trace showed.

Steve

Reply to
steve_schefter

Am Thu, 01 Apr 2010 08:53:58 -0700 schrieb steve_schefter:

If your problem is your ethernet card dropping the packets, why don't you give your localhost interface a go?

/Christof

Reply to
Christof Klaiber

How do you send packets from an external, single-board computer to a PC's localhost interface?

--
Grant Edwards               grant.b.edwards        Yow! Civilization is fun!
                                  at               Anyway, it keeps me busy!!
                              gmail.com
Reply to
Grant Edwards

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.