[SOLVED] exception depending on channel count

Technical questions regarding the XTC tools and programming with XMOS.
voodoosound
Active Member
Posts: 63
Joined: Sat Oct 15, 2011 8:53 pm

[SOLVED] exception depending on channel count

Post by voodoosound »

Hi *,

I am working on an AVB project.
I have defined:

Code: Select all

#define AVB_NUM_CHANNELS_LISTENER 	8
Everythings fine!


Now to my problem.
If I define:

Code: Select all

#define AVB_NUM_CHANNELS_LISTENER 	2
I have an "Illegal Resource Exception" after an undetermined amount of time. The time is never constant.

Code: Select all

-------8<------- from ---- void send_buf_ctl_info(...) ---- out of ---- media_clock_client.xc-------8<-------
  slave {
    buf_ctl :>  buf_;
//	simple_printf("S send_buf_ctl_info: pre tmr  %d %d %d\n",core_id, tmr, buf_);
    tmr :> thiscore_now;                                                       // ILLEGAL RESOURCE EXCEPTION
//	simple_printf("S send_buf_ctl_info: post tmr %d\n", thiscore_now);
    buf_ctl <: thiscore_now;
    buf_ctl <: active;
    buf_ctl <: ptp_ts;
    buf_ctl <: local_ts;
    buf_ctl <: rdptr;
    buf_ctl <: wrptr;
    buf_ctl <: core_id;
  }

-------8<-------------------------------------8<-------

Code: Select all

-------8<------- from ---- void manage_buffer(...) ---- out of ---- media_clock_server.xc-------8<-------

  master {
    buf_ctl <: 0;
//    simple_printf("M manage_buffer: pre tmr %d %d %d \n", tmr,thiscore_now,othercore_now);
    buf_ctl :> othercore_now;
    tmr :> thiscore_now;
//    simple_printf("M manage_buffer: post tmr %d %d %d \n", tmr,thiscore_now,othercore_now);
    buf_ctl :> locked;
    buf_ctl :> presentation_timestamp;    
    buf_ctl :> outgoing_timestamp_local;
    buf_ctl :> rdptr;
    buf_ctl :> wrptr;
    buf_ctl :> server_core_id;
  }

-------8<-------------------------------------8<-------
The tmr variable in MASTER always has a value of 769.
The tmr variable in SLAVE always has a value of 513, but when the exception occurs, it is way higher > 20000, and never the same value.

I don't know where to look anymore.

My suggestion is, that somewhere is a define that causes trouble? I didn't find it yet.
Has anyone any suggestions?
Last edited by voodoosound on Fri Mar 13, 2015 9:50 am, edited 1 time in total.


User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

Hi,

What is AVB_NUM_CHANNELS_LISTENER in relation to an unmodified reference design?

Also - what hardware and firmware version are you using?
voodoosound
Active Member
Posts: 63
Joined: Sat Oct 15, 2011 8:53 pm

Post by voodoosound »

In the reference design sw_avb 5.2.1 it is called:

Code: Select all

#define AVB_NUM_MEDIA_OUTPUTS AVB_DEMO_NUM_CHANNELS
It is a custom hardware, where I am not using any I2S.
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

It's unusual to get an ILLEGAL_RESOURCE on a timer input, especially after a seemingly random time. What tools version are you using?

One possibility is that you have a stack overflow that is trashing the resource ID. Try removing these unsafe array pragmas from media_clock_server.xc and see if it traps somewhere else:

https://github.com/xcore/sw_avb/blob/ma ... er.xc#L105
https://github.com/xcore/sw_avb/blob/ma ... er.xc#L320
voodoosound
Active Member
Posts: 63
Joined: Sat Oct 15, 2011 8:53 pm

Post by voodoosound »

Hi,

I am using xTIMEcomposer 12.1.0. Migration to 13.x was to much pain with this project.

To disable the pragmas did not have any visible effect. Same behavior.

Any further ideas?
User avatar
segher
XCore Expert
Posts: 844
Joined: Sun Jul 11, 2010 1:31 am

Post by segher »

Set a (write) watchpoint on the variable, see where it is
corrupted?
voodoosound
Active Member
Posts: 63
Joined: Sat Oct 15, 2011 8:53 pm

Post by voodoosound »

Hi again,

I have started to port my project to the 6.1.1 AVB stack now.
But from the start, without only one modification.

Code: Select all

#define AVB_DEMO_NUM_CHANNELS 2
I have a similar issue.
The point where the exception is raised and the exception itself are different and even changing.
But the root of the problem is the same.

Code: Select all

xrun: Program received signal ET_ILLEGAL_INSTRUCTION, Unable to decode instruction.
      [Switching to tile[0] core[4]]
It happend just once and I don know where.

Code: Select all

xrun: Program received signal ET_LOAD_STORE, Memory access exception.
      [Switching to tile[0] core[3]]
at line 126 in avb_1722_listener.xc:

Code: Select all

  // process the audio packet if enabled.
   if (stream_id < MAX_AVB_STREAMS_PER_LISTENER &&
      st.listener_streams[stream_id].active) {...}
or at line 41 in avb_1722_listener_support audio.c:

Code: Select all

int num_channels = stream_info->num_channels;
or at line 96 in media_output_fifo.c:

Code: Select all

  if (s->marker == 0) {...}
It seems to be related to the connection management.
If I do a fast connect on startup, it is stable. If I connect with a controller the exception is raised.
Well it seems, that somehow the stream_info gets corrupted. Has anyone an idea how and where?
voodoosound
Active Member
Posts: 63
Joined: Sat Oct 15, 2011 8:53 pm

Post by voodoosound »

2 channels in the listener seem to be a critical mass!!!
I have reduced the listener channel count to 3 and it is working untill now.
voodoosound
Active Member
Posts: 63
Joined: Sat Oct 15, 2011 8:53 pm

Post by voodoosound »

I have found the problem.

the define:

#define AVB_MAX_AUDIO_SAMPLE_RATE 96000

is not allowed to be 48kHz. Otherwise with 2 channels per stream, an exception is raised.