XC-2 demo application won't run

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.

Post by leon_heller »

I'd rather not do that, unless there is no alternative. I'll see what XMOS says about it first.


User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

Leon - Have you a link to the code are you running?

I'll try to verify this behaviour on my XC-2.
User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.

Post by leon_heller »

Thanks, Andy.

It's in the TC/PIP Stack here:

https://www.xmos.com/applications

app_xc2_firmware.1v3 is the application that I'm trying to get working. Corin at XMOS told me that it is the same as the code already in the XC-2. That does work, of course.

I get the same errors with App_Simple_Webserver 1v3, also included with the TC/PIP Stack.
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

No problems on my side. Works fine when running the pre-compiled binary and when compiling from scratch.

Do you see the same behaviour when running the pre-compiled binary using xrun --io xc2_firmware.xe?
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

leon_heller wrote:Has anyone managed to get the XC-2 demo application to work? The application supplied with the board runs from flash memory without any problems, but when I build the code with the 10.4.2 tools and run it from RAM I get the following run-time error after the flashing LEDs:

Atmel:1F440100INFO: Ethernet Rx Server init..

INFO: Ethernet Rx Server started..
Using Dynamic IP config
Using dynamic ip
dhcp_init
if down
link up
uIP log message: ip: invalid version or header length.
uIP log message: ip: invalid version or header length.
ipv4ll: 169.254.42.23
if up: 169.254.42.23
I take it you can't access the webpage at 169.254.42.23?

The error "invalid version or header length" comes from uip.c line 890. It seems the following check is failing:

Code: Select all

  /* Check validity of the IP header. */
  if(BUF->vhl != 0x45)  { /* IP version and header length. */
It might be useful if you could print out BUF->vhl .
User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.

Post by leon_heller »

Thanks very much, Andy! Accessing the XC-2 with 169.254.42.23 got it working. I was using http://local.xc2 (169.254.112.16), as with the original application in flash. Do you know what the text equivalent of 169.254.42.23 is?

I still get these run-time errors from the XDE before I access the webserver:

Atmel:1F440100INFO: Ethernet Rx Server init..

INFO: Ethernet Rx Server started..
Using Dynamic IP config
Using dynamic ip
dhcp_init
if down
link up
uIP log message: ip: invalid version or header length.
uIP log message: ip: invalid version or header length.
ipv4ll: 169.254.42.23
if up: 169.254.42.23

Do you get them?
User avatar
russf
XCore Addict
Posts: 146
Joined: Thu Dec 10, 2009 10:17 pm

Post by russf »

leon_heller wrote:Do you know what the text equivalent of 169.254.42.23 is?
You can make one via an A record in any dns server that your machine can reach.
leon_heller wrote: uIP log message: ip: invalid version or header length.
uIP log message: ip: invalid version or header length.
ipv4ll: 169.254.42.23
if up: 169.254.42.23

Do you get them?
I think these are informational. The 'version or header length' might be comments on incoming packets, which would depend on your own network.

You might try running wireshark (formerly ethereal) to trace network traffic.
User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.

Post by leon_heller »

Thanks, Russ.

The strange thing is that the README states that the IP address to use is xc2.local. Perhaps it was changed from the original firmware, and the README wasn't updated.

I've looked through what should be the relevant files but I can't find where the IP address 169.254.42.23 is coded; I'd like to change it back to xc2.local.
User avatar
russf
XCore Addict
Posts: 146
Joined: Thu Dec 10, 2009 10:17 pm

Post by russf »

leon_heller wrote:Thanks, Russ.

The strange thing is that the README states that the IP address to use is xc2.local. Perhaps it was changed from the original firmware, and the README wasn't updated.

I've looked through what should be the relevant files but I can't find where the IP address 169.254.42.23 is coded; I'd like to change it back to xc2.local.
I think xc2.local ought to work, but it probably has some dependency on your OS version, since it expects your client to do link local DNS, which is not ubiquitous.

From here: http://en.wikipedia.org/wiki/Private_network ...
Another type of private networking uses the link-local address range codified in RFC 5735 and RFC 3927. The utility of these addresses is in self-autoconfiguration by network devices when Dynamic Host Configuration Protocol (DHCP) services are not available and manual configuration by a network administrator is not desirable.
In IPv4, the block 169.254/16 is reserved for this purpose, with the exception of the first and the last /24 subnet in the range. If a host on an IEEE 802 (ethernet) network cannot obtain a network address via DHCP, an address from 169.254.1.0 to 169.254.254.255 may be assigned pseudorandomly. The standard prescribes that address collisions must be handled gracefully.
The IPv6 addressing architecture sets aside the block fe80::/10 for IP address autoconfiguration.
I would not sweat it too much. If xc2.local is not working for you today, it probably won't until you get a smarter OS version. (Funny. I think I smell windows. Or was that the cat? ;) )

Otherwise, just go for the ip address that you are given on startup. It may change from session to session depending on how mdns is implemented. (I think)

If you have arp command accessible via your dos prompt (if earlier assumption right) you can use something like ARP -an or whatever, to see the arp cache, which after startup of your board will contain its the IP address, until it is aged out - could be 10 to 60 secs, depends.
User avatar
russf
XCore Addict
Posts: 146
Joined: Thu Dec 10, 2009 10:17 pm

Post by russf »

Finally, you can fix an IP address (don't forget the mask) in xc2_firmware_config.xc (search for '192'). You need to address the device for the same network that your test host is on.