xCORE-200 Explorer kit Gigabit TCP ??

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
Post Reply
PhilKoh
New User
Posts: 2
Joined: Sun Jul 17, 2016 6:24 am

xCORE-200 Explorer kit Gigabit TCP ??

Post by PhilKoh »

I've gone through the Gigabit Ethernet example for Explorer kit, which was very nice, and it responds to pings. However, how do I go the next step to do something useful other than answer pings, i.e. send data?
I found another older AppNote 121 that is a UDP demo, and tried to figure out how to cut and paste the xtcp functionality onto the Explorer kit gigabit ethernet, but couldn't get it working. There must be some sample code somewhere out there that uses the Explorer kit's gigabit ethernet to do something practical using TCP/IP or UDP? I have never dove deeper than just sending UDP messages, so the lower-layer distinctions between MII's and MAC's are lost on me. Anything that shows how to successfully wire the xtcp functionality onto the explorer kit and use it would be so nice.


Many thanks in advance.


peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

Hi PhilKoh,

I've done a port of AN00121 to the xCORE-200 Explorer board. It is available on the AN00121 branch of my fork of lib_xtcp. Note that you'll need to change the target in the Makefile to:

Code: Select all

#TARGET = SLICEKIT-L16
TARGET = XCORE-200-EXPLORER
#TARGET = MIC-ARRAY-1V0
and the #defines in main.xc to:

Code: Select all

#define EXPLORER_KIT    1
#define SLICEKIT_L16    0
#define MIC_ARRAY       0
If you want to run this at gigabit rates then you need to change line 142 to be:

Code: Select all

  smi_configure(smi, phy_address, LINK_1000_MBPS_FULL_DUPLEX, SMI_ENABLE_AUTONEG);
//  smi_configure(smi, phy_address, LINK_100_MBPS_FULL_DUPLEX, SMI_ENABLE_AUTONEG);
Note that the test is set up to have a fixed IP address (172.16.0.2) defined at line 92. It can use DHCP if the empty config at line 86 is used instead.

Despite the name, I've tweaked my version to listen for TCP connections (line 207) instead of XTCP_PROTOCOL_UDP.

I've added a script which I used to send test data to the device and time how long it takes. If you run the following command it will time how long it takes for the device to receive 10000 100-byte packets:

Code: Select all

python test_tcp.py --ip 172.16.0.2 --port 15533 --packet-size 100 --delay-us 0 --packets 10000 --no-response
Note that you will need to either change your network settings to be on the same subnet or get the IP address of the device (run with --xscope and it will print its IP address on startup).

The --no-response is used to say that the data is uni-directional. If you want to test that the data can be echoed back and how long it takes then you can remove this flag and re-compile with the following change at line 182:

Code: Select all

//  int send_flag = TRUE;
  int send_flag = FALSE;
Hope that helps,

Peter
Attachments
test_tcp.py.zip
Script for testing a TCP device.
(885 Bytes) Downloaded 508 times
test_tcp.py.zip
Script for testing a TCP device.
(885 Bytes) Downloaded 508 times
PhilKoh
New User
Posts: 2
Joined: Sun Jul 17, 2016 6:24 am

Post by PhilKoh »

VERY sweet.

Much appreciated.
jsgn3
Member
Posts: 9
Joined: Tue Jan 07, 2020 4:10 pm

Post by jsgn3 »

Hi Peter,

I would like to use your posted port. However, the link
'fork of 'lib_xtcp' is dead:

https://github.com/pthedinger/lib_xtcp/tree/AN00121

Is your port still available somewhere?

Thanks,
Jos
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

jsgn3
Member
Posts: 9
Joined: Tue Jan 07, 2020 4:10 pm

Post by jsgn3 »

Thank you mon2.

The link you provided concerns a TCP/IP library. It is
not a port of AN00121.

In the mean time I found another port:

https://github.com/Pajeh/XMOS_gigabit_tcp_reflect
Post Reply