xcore / sc_ethernet

10/100 MII Ethernet MAC for XMOS microcontrollers
http://xcore.github.com/sc_ethernet/index.html
Other
37 stars 29 forks source link

app_demo_code does not like my ping #22

Closed interactive-matter closed 12 years ago

interactive-matter commented 12 years ago

Hi,

I am a bit desparied: I copied over the code of app_ethernet_demo to my led tile app. Works fine. But I cannot ping my device. I wanted to test the app_ethernet_demo on my XC-2 to verify that I got the same problem there. But it just crahses with an exception: xrun: Program received signal ET_ECALL, Application exception. [Switching to stdcore[2] hwthread 0] I just used the binary build by using the module. I think XDE has simbly build the whole module.

I have debugged (as in inspecting the network packages) everything and my conclusion is: a) the ICMP handler never finds the neccessary 0x01 at frame position 23 (which is the icmp check). Even with debugging I am not really able to find a ping package b) I see that my ping packages al have a invalid header checksum (0) from my computer. Is there something in the ethernet stack which drops those kind of bad packages? I assume not, but nevertheless I am completely puzzled that I do not see my ping packages in the XDE debugger (ok, ethernet speed and XDE debugger speed do not really fit well together)

Thanks

Marcus

ajwlucas commented 12 years ago

Hi Marcus,

Are you saying that the app_ethernet_demo (unchanged) crashes on your XC-2?

Can you provide the line number in the code that the exception occurs?

interactive-matter commented 12 years ago

a) yes it is unchanged b) unfortunately not (really). The error message above is everything I see.

I use the sc_ethernet unchanged (this is not true. I have my own fork which may be 2 or 3 weeks old and changed the getm_mac headers as describe in issue #10).

I have cleaned and built sc_ethernet with the same result.

I suspect that my Mac has nothing to do with it (strange ftdi driver problems, anything else strange in the XMOS communication, unhealthy packages in the network?)

ajwlucas commented 12 years ago

We recently added a few bug fixes for some crashes, can you merge the head of the repo into your fork and retry to verify whether those bugs were the problem?

interactive-matter commented 12 years ago

ok, doing so.

getting it back to compile is a pain in the … as described in #20 - I get the mac as char from otp but the ethernet server wants 6 ints?!

But the tests with app_demo are successfull: it does not crash and it likes my pings, thanks. So the problem must be in my interpretation of the code

interactive-matter commented 12 years ago

ok, I have to correct myself it is the 2 int mac format. Is it possible to write the size of the array for arrays with a defined size (e.g. mac adress) into the header file? I had to look down to the implementation of compare_mac to find out that it was the 2 int format

interactive-matter commented 12 years ago

OK,

I give up. I cannot understand why my code doe not reply to ping packets. It is effectivley the same code as app_ethernet_demo, which works fine on XC-2. On XC-3 I do not get any reply.

Must I handle filters differently on XC-3?

Perhaps you got time to take a glance at https://github.com/xcore/sw_led_tile_controller/blob/master/app_ledtile/src/ethernet/switch/ethSwitch.xc

The implementations of icmp/arp package handling is from app_ethernet_demo and unchanged to my eys:

https://github.com/xcore/sw_led_tile_controller/blob/master/app_ledtile/src/ethernet/helpers/arp.xc https://github.com/xcore/sw_led_tile_controller/blob/master/app_ledtile/src/ethernet/helpers/icmp.xc

ARP seems to work fine, but somehow I do not get any ICPMP packages.

Thanks

interactive-matter commented 12 years ago

added in my fork of sc_ethernet a app_ethernet_demo for the two port variant of XC-3. You may want to cheryy-pick my commit fe544b35b0d23a1d4b0f04f16af2554e2f5c69f7 It works and my stuff still does not work - so it is in my interpretation of the programming, closing the issue again. (still would be happy about any hint)

interactive-matter commented 12 years ago

problem solved: I initialized the ethernet server with the wrong mac address format:

It needed to be initialized with a 6 byte macc adddress stored in a two int array - not to be confused with a two byte int array holding 3 bytes of the mac address each! (which was what I did - since I saw 2 ints)