Gigabit XTCP and Webserver Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Gigabit XTCP and Webserver

Post by DemoniacMilk »

On having finished implementing one set of features (thanks for the help to everyone) the next goal is running a Webserver on the xcore.

I am using the RGMII for GBit ethernet, while the webserver example uses the MII on 100 MBit.
On reading through the xtcp source code I saw that the xtcp thread started in the main() function has many optional parameters and I thought that simply passing an rgmii rx,tx,cfg interface instead of a mii interface might achieve what I wanted.
After doing this, the xtcp thread hangs. The thread stops executing whenever the first cfg/rx/tx interface function is called. Pausing execution shows the program is waiting for a control token to be received over a chanel at

Code: Select all

static void send_cmd(chanend c, xtcp_cmd_t cmd, int conn_id)
{
  outct(c, XTCP_CMD_TOKEN);
  outct(c, XS1_CT_PAUSE);
> chkct(c, XS1_CT_END);
  chkct(c, XS1_CT_END);
  outuint(c, cmd);
  outuint(c, conn_id);
  outct(c, XS1_CT_END);
  chkct(c, XS1_CT_END);
}
Sending the CT the program waits for should be done in functions in xtcp_server.xc file. The channel transactions do not block when the webserver example is run (uses a raw mii interface), but blocks when I change the example to use RGMII interfaces.


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

Post by peter »

Hi DemoniacMilk,

I have done a port of the UDP example on
the AN00121 branch of my lib_xtcp fork.

That supports the XCORE-200-EXPLORER board (RGMII). Hopefully that should show you how to XTCP with RGMII.

Let me know if you have any specific questions,

Peter
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Post by DemoniacMilk »

Thank you for pointing me towards the project.
I compared our main routines and they are pretty much identical, just that I start an http handler instead of the udp handler you are using. the xtcp() call in your main is identical to mine
This library connects to the XMOS Ethernet library to provide layer-3 traffic over Ethernet via MII or RGMII.
I am using the correct phy driver for the eXplorer board, so I am a bit confused as to what the differences between our two versions are.

I found out that the ethernet RX server is not starting correctly (using a clean version of lib_ethernet 3.1.2). In rgmii_buffering.xc - rgmii_ethernet_rx_server() execution of the program is blocked at line 421

Code: Select all

418 unsafe {
419     c_rgmii_cfg <: (rx_client_state_t * unsafe) client_state_lp;
420     c_rgmii_cfg <: n_rx_lp;
421 >   c_rgmii_cfg <: p_port_state;
422   }
This probably means that the CFG thread wasn't starting correctly, what I was able to confirm.
The problem (and pretty much the only difference in our two source codes) was that I set the smi() thread to a specific core for testing purposes and forgot about this change. That broke the whole program.
peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

So, can you confirm that you now have it working? and the problem was that you were trying to share the smi thread with another one. Can you confirm which thread you were trying to share the smi thread with, I'd be interested to know whether it is a sharing we'd expect to work (in which case it could be a tools bug) or something which cannot work for good reasons.

Peter
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Post by DemoniacMilk »

Hello Peter,

yes, everything is working as intended. smi was set to share a core with rgmii_ethernet_mac_config and the phy driver.
peter
XCore Addict
Posts: 230
Joined: Wed Mar 10, 2010 12:46 pm

Post by peter »

That would make sense that have the smi client and server on the same logical core would cause that to lock up and then the rgmii_ethernet_mac_config() process wouldn't be able to respond to the rgmii_ethernet_rx_server().

Regards,

Peter
ozel
Active Member
Posts: 45
Joined: Wed Sep 08, 2010 10:16 am

Post by ozel »

I'm struggling with the same situation (only UDP required in my case). So I tried to follow peter's modifications but still don't get any XTCP_IFUP events. While in ar8035_phy_driver() link state changes occur properly.
In peter's code, the speed is downgraded to 100 MBit as well, is that a mandatory change? In the 1000 MBit setting it doesn't work either.
I'm using lib_xtcp (6.0) and lib_ethernet (3.3.0) as provided from the tools.
Post Reply