Debugging interface communication problems

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

Debugging interface communication problems

Post by DemoniacMilk »

Hello,

I've been running an XTCP stack for a webserver and TFTP on the xcore for a couple weeks. I ran into some problems when trying to send more than one file over XTCP without a system reset in between (crash on some "client ready" channel communication). Reseting after receiving a file is fine for me tho, so that is an okay workaround.

Now, about two hours ago, I could not connect to the webserver anymore. Hunting down the error showed that the XTCP stack wasnt initializing and got stuck here (core[3], set mac). The other channel communications shown did not advance any further either.
setMac_fail.PNG
More specifically, the xtcp_client and set_macaddr() got stuck when expecting a control token
setMac_fail_asm.PNG
get_index() is stuck on "in (2r) r0, res[r1]", that should be a channel/ressource operation as well.

How may I debug fails like this?

Update: I loaded a backup from the day before. The first time I started a debug session, everything worked. After that: no success.

Update 2: Same behaviour on both custom hardware and eXplorerKit. Also, changing a define that alters some pins (custom hardware and devkit use different ports for e.g. an SPI interface) and the PHY driver used (AR8035 vs KSZ9031) will result in an error that i may only fix by doing a clean build of the project.
xcc1: terminated due to internal unrecoverable error
For bug reporting instructions, please see:
http://www.xmos.com/support
xmake[1]: *** [.build/src/xmos_modem_new.xc.o] Error 1
xmake: *** [bin//xmos_modem_new.xe] Error 2
You do not have the required permissions to view the files attached to this post.
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Post by DemoniacMilk »

I have tracked down the error observed to the rgmii_ethernet_mac_config() task.

mac_config and rgmii_ethernet_rx_server() are connected by a channel and the RX server wants to send client states to the config:

Code: Select all

  printstrln(" send shared state..");
  unsafe {
    c_rgmii_cfg <: (rx_client_state_t * unsafe) client_state_lp;
    c_rgmii_cfg <: n_rx_lp;
    c_rgmii_cfg <: p_port_state;
  }
  printstrln("..shared state sent OK ");
However, I only see "send shared state.." being printed. So I assumed the problem is the data not being taken out of the channel, leading to the send process to block.

So I went ahead and added prints in mac_config (of which i do not see any!):

Code: Select all

    printstrln(" MAC Cfg here ");  <-- first line in function rgmii_ethernet_mac_config()
  // some initialization stuff
  printstrln(" rec client state..");
  unsafe {
    c_rgmii_cfg :> client_state_lp;
    c_rgmii_cfg :> n_rx_lp;
    c_rgmii_cfg :> p_port_state;
  }
  printstrln("..client state rec OK ");
The task is combined with 3 more tasks on tile[1].core[0]. From what i know, combinable tasks are literally combined, as in: everything before the selects is slapped together, then all cases are put in a single select.

So ye, the conclusion was, that some other task got stuck somewhere. I had replayed a resistor on my hardware, what seems to have changed the address of my PHY. So the phy driver got stuck in an infinite loop, trying to wait for the phy to be ready.