Hello everyone,
a fellow student and me are using the SliceKit und the AudioSlice for an university project. For the Audio I/O we're using the I2S master from the GitHub repository.
By verifying our implementation i recognized a delay of exactly 1 sample between the left and right audiochannel, channel 1and 2 on the AudioSlice. At first i thought the problem is in our code, but didn't find anything. So i tried the loopback demo and measured the same thing with the oscilloscope. Did anyone else notice this behaviour? Is there a solution?
Best regards and thanks in advance,
chrbo
delay between audio channels with SliceKit and loopback
-
- Junior Member
- Posts: 6
- Joined: Thu Nov 07, 2013 9:42 am
-
- XCore Expert
- Posts: 956
- Joined: Fri Dec 11, 2009 3:53 am
- Location: Sweden, Eskilstuna
I have not examined the slice-kit myself, but I earlier had a similar problem earlier with a different board.
The error was in the LR pin on the I2S vs the feeding channel stream.
Check the datasheet for the CODEC.
If the CODEC should have I2S_LR=hi=left ??? and after that LR=lo=right ??? (to be verified in the datasheet), for one stereo output sample you need to send the left and right during that period.
If everything is half a period to late or to early you can end up with
In the last example one audio channel would come out 1 sample to late and the channels would be reversed.
This is just a suggestion for you to examine.
PS. If you find that something is incorrect with the samples and/or that the channels are reversed. File an ticket to XMOS so they can fix it ASAP. DS.
The error was in the LR pin on the I2S vs the feeding channel stream.
Check the datasheet for the CODEC.
If the CODEC should have I2S_LR=hi=left ??? and after that LR=lo=right ??? (to be verified in the datasheet), for one stereo output sample you need to send the left and right during that period.
Code: Select all
Chanend -> L[0] , R[0] , L[1] , R[1] , R[2] , L[2]
LR pin -> Hi , Lo , Hi , Lo , Hi , Lo
sample ->| | | |
Code: Select all
Chanend -> R[0] , L[1] , R[1] , L[2] , R[2] , L[3]
LR pin -> Hi , Lo , Hi , Lo , Hi , Lo
sample ->| | | |
This is just a suggestion for you to examine.
PS. If you find that something is incorrect with the samples and/or that the channels are reversed. File an ticket to XMOS so they can fix it ASAP. DS.
-
- XCore Expert
- Posts: 966
- Joined: Thu Dec 10, 2009 9:20 pm
- Location: Bristol, UK
Thanks for raising a github issue on this one, I will take a look
-
- XCore Expert
- Posts: 966
- Joined: Thu Dec 10, 2009 9:20 pm
- Location: Bristol, UK
Please try swapping these two lines and let us know how you get on:
Code: Select all
// drive word clock
p_lrclk <: 0xffffffff;
Code: Select all
/* Output LR clock value to port */
p_lrclk <: 0;
-
- Junior Member
- Posts: 6
- Joined: Thu Nov 07, 2013 9:42 am
i've swapped it, but didn't change anything. I also downloaded and imported the latest verions of sc_i2s and sc_i2c. By the way, the Codec ID device check in audio_hw.xc
doesn't work anymore because the i2c_master_read_reg() has been removed from module_i2c_single_port. I'll open an issue int the repository.
Code: Select all
/* Read CODEC device ID to make sure everything is OK */
IIC_REGREAD(CODEC_DEV_ID_ADDR, data);
codec_dev_id = data[0];
if (((codec_dev_id & 0xF0) >> 4) != 0xC)
{
printstr("Unexpected CODEC Device ID, expected 0xC, got ");
printhex(codec_dev_id);
}
-
- XCore Expert
- Posts: 966
- Joined: Thu Dec 10, 2009 9:20 pm
- Location: Bristol, UK
This should now be fixed in sc_i2s