Xconnect Xlink / Link Problem

All technical discussions and projects around startKIT
User avatar
data
Active Member
Posts: 43
Joined: Wed Apr 06, 2011 8:02 pm

Re: Xconnect Xlink / Link Problem

Postby data » Wed Aug 23, 2017 2:50 pm

Chanends can transmit any type at any time; they do not have to be set up to send a specific type. There is no special initialization to do to make a chanend transmit a 32-bit integer, for instance. You can use a chanend to transmit a 32-bit integer, and in the next instruction use it to transmit an 8-bit char. Chanends do not "know" what types are going to be transmitted through them.

By "initialization" I meant the activity of setting up the chanends for static forwarding, which is the technique used in the dynamic Xlink demo. If those steps are not done properly, e.g. if you skip them or don't set up the routes properly, you could get an ET_ILLEGAL_RESOURCE.

You generally only use static forwarding if you have to have something like hot-plugging with Xlinks -- I believe it's a relatively unusual application, and it can be tricky to get working. (Note to XMOS: proper hardware & system support for hot-plugged Xlink would be received with great enthusiasm!)

At any rate, for static-forwarded links, the outuint-style functions are what you'll need to use.
Bambus
Member++
Posts: 24
Joined: Tue Feb 28, 2017 12:52 pm

Postby Bambus » Wed Aug 23, 2017 3:52 pm

I just took the exact code from the demo and it works for transmitting characters. I am sending integers from one end but the receiving end throws exceptions when I try to write the data to an integer variable. I doesn't throw exceptions when I write data to a char. This is why I thought that there must be something about the chanend that I have missed. I have tried in/out inline asm instructions and outuint but to no avail.
User avatar
data
Active Member
Posts: 43
Joined: Wed Apr 06, 2011 8:02 pm

Postby data » Wed Aug 23, 2017 3:54 pm

Did you also change the receiving end to receive integers, using inuint?
Bambus
Member++
Posts: 24
Joined: Tue Feb 28, 2017 12:52 pm

Postby Bambus » Wed Aug 23, 2017 3:55 pm

Yes I also tried that. It just gives me the same resource exception.
User avatar
data
Active Member
Posts: 43
Joined: Wed Apr 06, 2011 8:02 pm

Postby data » Wed Aug 23, 2017 3:59 pm

Can you post the code you changed?
Bambus
Member++
Posts: 24
Joined: Tue Feb 28, 2017 12:52 pm

Postby Bambus » Wed Aug 23, 2017 4:02 pm

In the transmitting part:

case 5: /* send data tokens */
/*if (!link_got_credit(LINK_NUM)) {
comm_state = 4;
break;
}*/
unsafe {
// outct((chanend)c,XS1_CT_WRITE4);
outuint((chanend)c, 753);
}
if (err_ctr++ == SEND_CTRL_TOKEN) {
err_ctr = 0;
unsafe {
outct((chanend)c, XS1_CT_ACK); //Send a control token as app sync point

}
}
break;

And in the receiving part:

else {
unsafe{
// outct((chanend)c,0x83);
data=inuint((chanend)c);
// asm ("in %0, res[%1]":"=r"(data):"r"((chanend)c));

// c :> data;
volatile int * unsafe p = &g_data_tokens;
*p = *p + 1;
if (data!=753) error++;
}
}

edit: the code from the receiving part is in the test_ct function.
User avatar
data
Active Member
Posts: 43
Joined: Wed Apr 06, 2011 8:02 pm

Postby data » Wed Aug 23, 2017 4:26 pm

If this is the only code you changed, I suspect that the control token is somehow coming through at the wrong time. This might not be caught by testct because testct only checks the next byte. What happens if you comment out the outct in the transmit part?

By the way, I'm afraid I steered you a bit wrong. In this code, the chanend is streaming, and when you use the I/O operators with a streaming chanend, they expand to the same instructions as inuint/outuint. So, the I/O operators are fine here.

I still prefer inuint/outuint in this situation, just because they make it very clear what's going on -- the I/O operator depends on the type of the rvalue and that can add a little confusion.
Bambus
Member++
Posts: 24
Joined: Tue Feb 28, 2017 12:52 pm

Postby Bambus » Wed Aug 23, 2017 4:40 pm

When i comment out the outct, I still get the resource exception on the receive part.

I am surprised that there is no other thread on issues with xconnect. How do people setup anything if there is no document containing all necessary information?
User avatar
data
Active Member
Posts: 43
Joined: Wed Apr 06, 2011 8:02 pm

Postby data » Wed Aug 23, 2017 5:05 pm

Don't despair -- some of us have got it working! This is an off-label use of Xconnect, so support can unfortunately be a bit light. In fact there's much more documentation than there used to be.

I'm out of guesses, so I'll try this out on my hardware (I have a setup for running this demo, as it happens).
Bambus
Member++
Posts: 24
Joined: Tue Feb 28, 2017 12:52 pm

Postby Bambus » Wed Aug 23, 2017 5:14 pm

Thank you, I appreciate your help a lot! Always makes me happy when someone puts effort into helping me :)

Return to “startKIT”

Who is online

Users browsing this forum: No registered users and 5 guests