Page 1 of 3

AVB/TSN Talker-only Configuration

Posted: Wed May 17, 2017 10:27 pm
by ahogen
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!

Re: AVB/TSN Talker-only Configuration

Posted: Thu May 18, 2017 2:11 pm
by akp
+1

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

Re: AVB/TSN Talker-only Configuration

Posted: Thu May 18, 2017 4:04 pm
by ahogen
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?

Re: AVB/TSN Talker-only Configuration

Posted: Thu Jul 06, 2017 12:26 pm
by akp
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.

Re: AVB/TSN Talker-only Configuration

Posted: Tue Jul 18, 2017 4:44 pm
by akp
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.

Re: AVB/TSN Talker-only Configuration

Posted: Tue Jul 18, 2017 5:02 pm
by ahogen
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.

Re: AVB/TSN Talker-only Configuration

Posted: Tue Jul 18, 2017 5:12 pm
by akp
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.

Re: AVB/TSN Talker-only Configuration

Posted: Tue Jul 18, 2017 5:40 pm
by ahogen
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". :)

Re: AVB/TSN Talker-only Configuration

Posted: Tue Jul 18, 2017 5:47 pm
by akp
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!

Re: AVB/TSN Talker-only Configuration

Posted: Tue Jul 18, 2017 6:02 pm
by ahogen
-