AVB endpoint design

New to XMOS and XCore? Get started here.
Post Reply
nick
Active Member
Posts: 42
Joined: Tue Jan 07, 2020 10:35 am

AVB endpoint design

Post by nick »

Hi,
I made some changes in the firmware of the application note AN00203 (AVB gigabit ethernet using TDM master). Currently I'm using the xCORE-200 multichannel audio platform. The configurations I tested successfully are:
- 32in32out TDM8 (8 channels per stream, 4 input and 4 output TDM lines)
- 32in32out TDM16 (16 channels per stream, 2 input and 2 output TDM lines)
- 48in48out TDM16 (16 channels per stream, 3 input and 3 output TDM lines)
I'm interested in reaching 64 input channels (TDM16). I checked the configuration with 64in64out but it seems that the xCore-200 can't manage so many channels.
I don't care about how many output channels I have (at least one stream for the synchronisation, so 16 channels).
Has anyone ever tried to reach 64 input channels with the AVB firmware?
Is it possible to have a configuration in which the number of input channels is different from the number of output channels?

Thank you


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

Post by akp »

It is possible to have different number of input channels from output channels. There are several typos in the code you will have to fix to get that working, for instance, where XMOS referred to AVB_NUM_SOURCES when then meant AVB_NUM_SINKS or something like that. And also consider the tdm buffer manager (to check it doesn't expect same number of channels for input and output).

I am sorry I have made so many changes I can't put it up. It's for work.

It sounds like you're running into callback pressure on the tdm buffer manager. You many need to optimise the tdm buffer manager.. so if you can get the 64in16out (e.g.) working that might reduce your callback pressure there. Or you may need to optimise the tdm code itself. I have found that hand optimised dual issue assembly can significantly improve critical loop performance (in certain situations).
nick
Active Member
Posts: 42
Joined: Tue Jan 07, 2020 10:35 am

Post by nick »

Hi akp,
I'm working on the buffer_manager_to_tdm().
I noticed there's something strange in the tdm.send and tmd.receive and I've also found your answer here: https://www.xcore.com/viewtopic.php?t=5850
I tried to do this (sample_out_count is set to 0 at the beginning):

Code: Select all

    case tdm.receive(size_t index, int32_t sample):
      unsafe {
        p_in_frame->samples[index] = sample;

        sample_out_count++;
        if(sample_out_count == AVB_NUM_MEDIA_INPUTS)
        {
            tmr :> p_in_frame->timestamp;
            audio_frame_t *unsafe new_frame = audio_buffers_swap_active_buffer(*double_buffer);
            c_audio <: p_in_frame;
            p_in_frame = new_frame;
            sample_out_count = 0;
        }
      }
      break;

    case tdm.send(size_t index) -> int32_t sample:
      unsafe {
        if (send_count == 0) {
          c_audio :> sample_out_buf;
        }
        sample = sample_out_buf[send_count];
        send_count++;
       
        if (send_count == (AVB_NUM_MEDIA_OUTPUTS/AVB_MAX_CHANNELS_PER_TALKER_STREAM)) send_count = 0;
      }
      break; // End of send
    }
But it's not working. Do you have any suggestion?

I was also wondering what we have to put here:
if (send_count == (AVB_NUM_MEDIA_OUTPUTS/AVB_MAX_CHANNELS_PER_TALKER_STREAM)) send_count = 0;
Because in the original code there was send_count == 8, but I'm thougth that 8 was just because the streams were 8 channel. So I changed this way. Am I right?

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

Post by akp »

Sorry, I haven't really optimized the code related to tdm.send... my application calls for tdm.receive function only.
Post Reply