AVB/TSN Talker-only Configuration

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
User avatar
akp
XCore Expert
Posts: 578
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

I have changed the RGMII code to disable the GbE portion of it. Perhaps if I changed to the MII MAC that would work, I didn't know if it would or not with the RGMII chip as I'm not really familiar with Ethernet chips. But I suppose it must if you got it working.


User avatar
akp
XCore Expert
Posts: 578
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

Unfortunately when I try this on the AN00202 code I get an internal compiler error.

Steps:
1. Install clean lib_tsn 8.0.0 rc1 and lib_random from xmos github
2. Build examples/AN00202_gige_avb_i2s_demo allowing it to pull other libs
3. in avb_conf.h:
#define AVB_NUM_LISTENER_UNITS 0
#define AVB_1722_1_LISTENER_ENABLED 0
4. Make the following code changes in main.xc:

Code: Select all

#if AVB_NUM_LISTENER_UNITS
    on tile[0]: avb_1722_listener(c_eth_rx_hp,
                                  c_buf_ctl[0],
                                  null,
                                  c_listener_ctl[0],
                                  AVB_NUM_SINKS,
                                  i_audio_out_push);
#endif

Code: Select all

        avb_manager(i_avb, NUM_AVB_MANAGER_CHANS,
                     null,
                     c_media_ctl,
#if AVB_NUM_LISTENER_UNITS
                     c_listener_ctl,
#else
                     null,
#endif
                     c_talker_ctl,
                     i_eth_cfg[MAC_CFG_TO_AVB_MANAGER],
                     i_media_clock_ctl);

Code: Select all

#if AVB_NUM_LISTENER_UNITS
  for (int j=0; j < AVB_NUM_SINKS; j++)
  {
    const int channels_per_stream = AVB_NUM_MEDIA_OUTPUTS/AVB_NUM_SINKS;
    int map[AVB_NUM_MEDIA_OUTPUTS/AVB_NUM_SINKS];
    for (int i = 0; i < channels_per_stream; i++) map[i] = j ? j*channels_per_stream+i : j+i;
    avb.set_sink_map(j, map, channels_per_stream);
    avb.set_sink_format(j, AVB_FORMAT_MBLA_24BIT, default_sample_rate);
    avb.set_sink_sync(j, 0);
    avb.set_sink_channels(j, channels_per_stream);
  }
#endif
If I do that and compile with 14.3.0 under Windows 7 x64 I get:

Code: Select all

xcc1: internal compiler error
Failed in ..\FrontEnd\Lowering\par_lowering.cpp, line 902
	c->size != NIL && c->offset % SizeOfChanend() == 0 && c->size % SizeOfChanend() == 0
For bug reporting instructions, please see:
http://www.xmos.com/support
xmake[1]: *** [.build/src/main.xc.o] Error 1
xmake: *** [bin//AN00202_gige_avb_i2s_demo.xe] Error 2

Perhaps I am missing a necessary change?
ahogen
Member++
Posts: 26
Joined: Fri Mar 31, 2017 5:16 pm

Post by ahogen »

-
Attachments
Capture.PNG
Sync libraries with XMOS online.
Capture.PNG (6.06 KiB) Viewed 9809 times
Sync libraries with XMOS online.
Sync libraries with XMOS online.
Capture.PNG (6.06 KiB) Viewed 9809 times
Last edited by ahogen on Mon Jul 29, 2019 6:24 pm, edited 2 times in total.
User avatar
akp
XCore Expert
Posts: 578
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

Hi, apparently I have done something wrong because I retrieved everything as you said, cleaned and rebuilt, and still get the xcc error. Are you running tools 14.3.0 Community as I am? I have attached the two files I changed, just avb_conf.h and main.xc. I have also attached a picture of my workspace to show the versions of each file.
AN00202_project_explorer.png
AN00202_project_explorer.png (9.59 KiB) Viewed 9799 times
AN00202_project_explorer.png
AN00202_project_explorer.png (9.59 KiB) Viewed 9799 times
Here is the error:

Code: Select all

xcc1: internal compiler error
Failed in ..\FrontEnd\Lowering\par_lowering.cpp, line 902
	c->size != NIL && c->offset % SizeOfChanend() == 0 && c->size % SizeOfChanend() == 0
For bug reporting instructions, please see:
http://www.xmos.com/support
xmake[1]: *** [.build/src/main.xc.o] Error 1
xmake: *** [bin//AN00202_gige_avb_i2s_demo.xe] Error 2
Thanks for all your help -- this will be great if I get it working. I suppose the MII PHY would probably work even with an XE(F) device if I didn't call up the RGMII code but just used the pins in GPIO mode, but XL(F) would be cheaper.
Attachments
main.xc
(19.91 KiB) Downloaded 326 times
main.xc
(19.91 KiB) Downloaded 326 times
avb_conf.h
(3.63 KiB) Downloaded 338 times
avb_conf.h
(3.63 KiB) Downloaded 338 times
User avatar
akp
XCore Expert
Posts: 578
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

It just built OK with 14.2.4... very odd that 14.3.0 would complain. I had best submit a bug on 14.3.0 because I get unexplainable (to me) runtime behaviour on my actual app when I build with 14.2.4.

With listener:

Code: Select all

Creating AN00202_gige_avb_i2s_demo.xe
Constraint check for tile[0]:
  Cores available:            8,   used:          6 .  OKAY
  Timers available:          10,   used:          6 .  OKAY
  Chanends available:        32,   used:         27 .  OKAY
  Memory available:       262144,   used:      103468 .  OKAY
    (Stack: 23780, Code: 66376, Data: 13312)
Constraints checks PASSED.
Constraint check for tile[1]:
  Cores available:            8,   used:          8 .  OKAY
  Timers available:          10,   used:          8 .  OKAY
  Chanends available:        32,   used:         27 .  OKAY
  Memory available:       262144,   used:      110444 .  OKAY
    (Stack: 79116, Code: 21964, Data: 9364)
Constraints checks PASSED.
Build Complete
Without listener:

Code: Select all

Creating AN00202_gige_avb_i2s_demo.xe
Constraint check for tile[0]:
  Cores available:            8,   used:          5 .  OKAY
  Timers available:          10,   used:          5 .  OKAY
  Chanends available:        32,   used:         24 .  OKAY
  Memory available:       262144,   used:      94112 .  OKAY
    (Stack: 22348, Code: 58892, Data: 12872)
Constraints checks PASSED.
Constraint check for tile[1]:
  Cores available:            8,   used:          8 .  OKAY
  Timers available:          10,   used:          8 .  OKAY
  Chanends available:        32,   used:         27 .  OKAY
  Memory available:       262144,   used:      110444 .  OKAY
    (Stack: 79116, Code: 21964, Data: 9364)
Constraints checks PASSED.
Build Complete
ahogen
Member++
Posts: 26
Joined: Fri Mar 31, 2017 5:16 pm

Post by ahogen »

-
Last edited by ahogen on Mon Jul 29, 2019 6:24 pm, edited 2 times in total.
User avatar
akp
XCore Expert
Posts: 578
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

I created Ticket 10249 to report the xcc bug.
User avatar
akp
XCore Expert
Posts: 578
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

Here is the response:
Hello

Thank you for contacting XMOS

It looks like there is a problem with passing in zero-length arrays of channel ends in the top level main par. I have entered an internal engineering report based on your example, reduced to:

void f(chanend c[]);
int main(void)
{
chan c[0];
par {
on tile[0]: f(c);
}
return 0;
}

While at this point I won't have a timescale for when the issue can be fixed, I can suggest a workaround. Try passing one unconnected buffer control channel to gptp_media_clock_server. Buffer control is initiated by the listener, so the media clock server will not try to talk to an unconnected channel end (leading to an exception or locking the media clock server).

Regards
Larry Snizek
Customer Engineering
I will go ahead and do that and post results.

I also found a bug in avb_1722_1_aecp.c function create_aem_read_descriptor_response() that was vexing me (a non-obvious reason why setting AVB_NUM_SINKS to 0 wouldn't work, e.g. not a divide 0/0 etc). In fact, this bug meant setting AVB_NUM_SINKS to anything less than AVB_NUM_SOURCES will cause an 'enumeration' failure with a Mac.

Change

Code: Select all

    if (read_type == AEM_STREAM_PORT_OUTPUT_TYPE) {
      aem_desc_stream_port_input_output_t *stream_port = (aem_desc_stream_port_input_output_t *)descriptor;
      hton_16(stream_port->base_cluster, AVB_NUM_MEDIA_OUTPUTS + (read_id * AVB_NUM_MEDIA_INPUTS/AVB_NUM_SOURCES));
      hton_16(stream_port->base_map, AVB_NUM_SOURCES + read_id);
    }
to

Code: Select all

    if (read_type == AEM_STREAM_PORT_OUTPUT_TYPE) {
      aem_desc_stream_port_input_output_t *stream_port = (aem_desc_stream_port_input_output_t *)descriptor;
      hton_16(stream_port->base_cluster, AVB_NUM_MEDIA_OUTPUTS + (read_id * AVB_NUM_MEDIA_INPUTS/AVB_NUM_SOURCES));
      hton_16(stream_port->base_map, AVB_NUM_SINKS + read_id);
    }
All the other changes to enable AVB_NUM_SINKS to be 0 are pretty obvious. Will post up some optimized usage numbers in 14.2.4 and 14.3.0 (with the workaround suggested above).
User avatar
akp
XCore Expert
Posts: 578
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

I decided to build AN00203 (TDM master) since that is what my project is based on. But it should give a feeling for the I2S master app note. I found that I could actually compile on 14.3.0 without the workaround when I completed my optimizations to completely remove the audio output capability, i.e.:

#define AVB_NUM_SINKS 0
#define AVB_NUM_LISTENER_UNITS 0
#define AVB_NUM_MEDIA_OUTPUTS 0
#define AVB_1722_1_LISTENER_ENABLED 0

Here are the resource usage results. It seems like with listener disabled the resource usage of 14.2.4 is very similar to that of 14.3.0, but with listener enable 14.3.0 uses a lot more stack memory which seems mistifying.

xTIMEComposer 14.2.4

AN00203 32in/32out
Creating AN00203_gige_avb_tdm_demo.xe
Constraint check for tile[0]:
Cores available: 8, used: 6 . OKAY
Timers available: 10, used: 6 . OKAY
Chanends available: 32, used: 27 . OKAY
Memory available: 262144, used: 109528 . OKAY
(Stack: 25228, Code: 66652, Data: 17648)
Constraints checks PASSED.
Constraint check for tile[1]:
Cores available: 8, used: 8 . OKAY
Timers available: 10, used: 8 . OKAY
Chanends available: 32, used: 27 . OKAY
Memory available: 262144, used: 110444 . OKAY
(Stack: 79116, Code: 21964, Data: 9364)
Constraints checks PASSED.
Build Complete

AN00203 32in/0out
Creating AN00203_gige_avb_tdm_demo_.xe
Constraint check for tile[0]:
Cores available: 8, used: 5 . OKAY
Timers available: 10, used: 5 . OKAY
Chanends available: 32, used: 22 . OKAY
Memory available: 262144, used: 76852 . OKAY
(Stack: 8780, Code: 55240, Data: 12832)
Constraints checks PASSED.
Constraint check for tile[1]:
Cores available: 8, used: 8 . OKAY
Timers available: 10, used: 8 . OKAY
Chanends available: 32, used: 26 . OKAY
Memory available: 262144, used: 110332 . OKAY
(Stack: 79084, Code: 21892, Data: 9356)
Constraints checks PASSED.
Build Complete


xTIMEComposer 14.3.0

AN00203 32in/32out
Creating AN00203_gige_avb_tdm_demo.xe
Constraint check for tile[0]:
Cores available: 8, used: 6 . OKAY
Timers available: 10, used: 6 . OKAY
Chanends available: 32, used: 27 . OKAY
Memory available: 262144, used: 125544 . OKAY
(Stack: 41204, Code: 66692, Data: 17648)
Constraints checks PASSED.
Constraint check for tile[1]:
Cores available: 8, used: 8 . OKAY
Timers available: 10, used: 8 . OKAY
Chanends available: 32, used: 27 . OKAY
Memory available: 262144, used: 110516 . OKAY
(Stack: 79164, Code: 21992, Data: 9360)
Constraints checks PASSED.
Build Complete

AN00203 32in/0out
Creating AN00203_gige_avb_tdm_demo_.xe
Constraint check for tile[0]:
Cores available: 8, used: 5 . OKAY
Timers available: 10, used: 5 . OKAY
Chanends available: 32, used: 22 . OKAY
Memory available: 262144, used: 77444 . OKAY
(Stack: 9356, Code: 55252, Data: 12836)
Constraints checks PASSED.
Constraint check for tile[1]:
Cores available: 8, used: 8 . OKAY
Timers available: 10, used: 8 . OKAY
Chanends available: 32, used: 26 . OKAY
Memory available: 262144, used: 110404 . OKAY
(Stack: 79132, Code: 21920, Data: 9352)
Constraints checks PASSED.
Build Complete
ahogen
Member++
Posts: 26
Joined: Fri Mar 31, 2017 5:16 pm

Post by ahogen »

-
Last edited by ahogen on Mon Jul 29, 2019 6:24 pm, edited 2 times in total.
Post Reply