AVB/TSN Talker-only Configuration

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
User avatar
ahogen
Member++
Posts: 30
Joined: Fri Mar 31, 2017 5:16 pm
Contact:

AVB/TSN Talker-only Configuration

Postby ahogen » Wed May 17, 2017 10:27 pm

Hi all,

I'm working with the xCORE-200 MC Audio board and the associated Gigabit AVB with I2S appnote, AN00202. I don't need Listener functionality and would like to strip all of it out of the code. I can easily use

Code: Select all

// avb_config.h
#define AVB_1722_1_LISTENER_ENABLED 0


but when I comment out listener-related code in main(), things break, so this #define obviously does not remove code like I would like. It only disables some functionality so it doesn't work all the way. I've tried hacking the backend libraries, and commenting listener-related things out. Tried setting listener-related parameters (like channel ends or interfaces) to "null" in main(), but a lot of the library functions don't support "null".

Almost everything I tried either did not build, or would cause the code to freeze during runtime, breaking the Talker functionality. I presume this is due to some code putting data into a channel endpoint for the listener but the mini channel FIFO is full, making the channel write operation a blocking operation. I thought I found where this was happening in the media clocking files and tried commenting it out, but I didn't see any improvement.

Right now, I'm back to just setting LISTENER_ENABLED to 0 and leaving it at that. I'm not exactly happy with it, but it works for now.

How can I truly remove the Listener functions from the application? Thanks!
Last edited by ahogen on Thu May 18, 2017 3:58 pm, edited 2 times in total.
akp
Experienced Member
Posts: 94
Joined: Thu Nov 26, 2015 11:47 pm

Postby akp » Thu May 18, 2017 2:11 pm

+1

Right now I am leaving listener in the code but would be happy to remove it especially if it freed up some cores.
User avatar
ahogen
Member++
Posts: 30
Joined: Fri Mar 31, 2017 5:16 pm
Contact:

Postby ahogen » Thu May 18, 2017 4:04 pm

akp wrote:Right now I am leaving listener in the code but would be happy to remove it especially if it freed up some cores.

Good to know I'm not the only one in this boat.

Anybody done this before with the new lib_tsn and friends?
akp
Experienced Member
Posts: 94
Joined: Thu Nov 26, 2015 11:47 pm

Postby akp » Thu Jul 06, 2017 12:26 pm

Crickets! I'm now to a place where removing the listener code would be beneficial since I am running out of chanends and cores on the XEF216-512. I removed GbE (since I only need Fast Ethernet) and added in TCP and HTTP. Had to split TCP and HTTP across both tiles to get the chanends, and I am down to a single unused chanend on the chip. So it will be tough to implement UART functionality as well -- I want to add a TCP <-> UART translation layer. Obvs I don't need HTTP for that but I just got the simple webserver going to test the TCP + TSN.
akp
Experienced Member
Posts: 94
Joined: Thu Nov 26, 2015 11:47 pm

Postby akp » Tue Jul 18, 2017 4:44 pm

I have made some progress. I haven't been able to disable the listener code yet, but I have "broken" it to release some chanends which I need without causing any exceptions or runtime errors. And I can still get audio on the Mac over AVB. In order to prevent someone opening up a talker stream to the audio board I defined AVB_1722_1_LISTENER_ENABLED to 0. When I do that the devide shows up with the correct number of inputs but 0 outputs on the Mac (otherwise if someone tried to use the audio board as an output it would create odd behaviour since I have stolen channels).

So far I have freed the following channels: c_listener_ctl, c_eth_rx_hp but I suspect there are others that could be freed with some effort. And maybe one or more cores.
User avatar
ahogen
Member++
Posts: 30
Joined: Fri Mar 31, 2017 5:16 pm
Contact:

Postby ahogen » Tue Jul 18, 2017 5:02 pm

I'm curious to know what happens when you try this:

Hidden Content
This board requires you to be registered and logged-in to view hidden content.


Let me know what that does for you, before and after, in terms of cores, memory, channels. Basically, a "Constraints Report" both before and after these changes would be nice to see.
Last edited by ahogen on Wed Jul 19, 2017 4:10 pm, edited 1 time in total.
akp
Experienced Member
Posts: 94
Joined: Thu Nov 26, 2015 11:47 pm

Postby akp » Tue Jul 18, 2017 5:12 pm

I don't think that's possible without more surgery. I couldn't get it to run correctly when I tried that before. I have set c_listener_ctl to null in avb_manager but of course I had to change avb_manager to work with the null chanend. If you make some progress I would be happy to hear it. I think I have freed enough channels for my needs at present; the important thing to me was to ensure that the peer didn't try to open up a talker connection to the listener since that won't work with the few cuts and slashes I've done so far to free up the channels.
User avatar
ahogen
Member++
Posts: 30
Joined: Fri Mar 31, 2017 5:16 pm
Contact:

Postby ahogen » Tue Jul 18, 2017 5:40 pm

I did get it to work, starting from a clean AN00202, which is why I suggested it.

I'm not sure why you'd have to mod "avb_manager." It can already take a "null." That's what the "&?" in the interface indicates here.

I believe I might have also removed the

Code: Select all

for (int j=0; j < AVB_NUM_SINKS; j++)
loop (the second one) in "application_task()" which sets up the static mappings for the Listener. Maybe that's what you're missing? I can't tell without more info on the errors you see when you try to cut things out.

Glad to hear you were able to free enough resources for your use case. Let me know if you experiment more with this "surgery". :)
akp
Experienced Member
Posts: 94
Joined: Thu Nov 26, 2015 11:47 pm

Postby akp » Tue Jul 18, 2017 5:47 pm

Yes could be. Maybe I modded something else. Glad you got it to work. I am using AN00203 so it is a little different I think, there are some hacks for the TDM vs I2S. But your result means I should be able to get there. Thanks!
User avatar
ahogen
Member++
Posts: 30
Joined: Fri Mar 31, 2017 5:16 pm
Contact:

Postby ahogen » Tue Jul 18, 2017 6:02 pm

Hidden Content
This board requires you to be registered and logged-in to view hidden content.
Last edited by ahogen on Mon Aug 14, 2017 10:33 pm, edited 2 times in total.

Return to “Other XMOS Development Kits”

Who is online

Users browsing this forum: No registered users and 16 guests