Hello,
I thought it would be good to have a running discussion about how to interface with the audio slice. Since many of us are working on audio applications and are starting at the same point, it only makes sense to help eachother out.
The way I first started out was to first make the slice LED turn on and off.
Then I imported the I2C library to interface with the CS4270 control registers.
After I got that all going, I imported the I2S library to start getting my info.
At this point I'm working on defining the I2S_resources which is being difficult (noted here http://www.xcore.com/forum/viewtopic.php?f=26&t=2512 )
I just wanna keep this as a general guide on how to do this since with the release of the startKIT, many people new to this stuff are going to be coming in.
How to interface the startKIT with the audio slice
-
- Active Member
- Posts: 32
- Joined: Mon Nov 11, 2013 6:17 pm
-
- Active Member
- Posts: 32
- Joined: Mon Nov 11, 2013 6:17 pm
Looking through the startKIT hardware guide, it looks like the RST_N pin is mapped to the XSYS LINK points on the bottom of the board. Specifically the pad labelled R
Check it out at the schematics on page 16
Check it out at the schematics on page 16
-
- Junior Member
- Posts: 6
- Joined: Wed Jan 01, 2014 8:31 pm
Having trouble setting up the codec control registers. I imported codec.h and codec.xc from the audio sliceKit modules, but I keep throwing the error
Any ideas?
Code: Select all
Unexpected CODEC Device ID, expected 0xC, got FF
-
- Member
- Posts: 8
- Joined: Fri Oct 18, 2013 9:23 am
Hi
Ensure that port mapping that you have configured on slice kit for I2C lines are correct.
Regards,
Yuvaraj
Ensure that port mapping that you have configured on slice kit for I2C lines are correct.
Regards,
Yuvaraj
-
Verified
- XCore Legend
- Posts: 1156
- Joined: Thu May 27, 2010 10:08 am
Port mapping for the audio slice is below. This is known working.
However, note that I2C is mapped to a 4b port. This means it can write only (not read back or check ACK etc.) due to the limitations of a port either being completely out or in, not a mixture of them both. Hence you'll need to use the I2C module which does a blind write to the CODEC. It's not ideal (no ack check and can't verify/read back contents) but does work OK for the CODEC used.
Code: Select all
// Ports
#define PORT_I2S_DAC0 XS1_PORT_1G
#define PORT_I2S_DAC1 XS1_PORT_1H
#define PORT_I2S_ADC0 XS1_PORT_1K
#define PORT_I2S_ADC1 XS1_PORT_1L
#define PORT_I2S_LRCLK XS1_PORT_1I
#define PORT_I2S_BCLK XS1_PORT_1F
#define PORT_MCLK_IN XS1_PORT_1E
#define PORT_GPIO XS1_PORT_4C
#define PORT_I2C XS1_PORT_4D
Code: Select all
module_i2c_single_port
-
- Member
- Posts: 8
- Joined: Fri Oct 18, 2013 9:23 am
CODEC_RST_N should be driven from xcore. The RST_N which is on XSYS LInk doesn't drive the reset on Finger connector (Codec reset) By default it is pulled-down (on audio slice without pll) to operate on low-power mode. You have to provide a high pulse (high-low-high or low-high) to bring the codec on active state. Check whether the codec is acknowledging for the slave address (hope 7-bit addressing is taken care on code)
Better choice I would recommend is to use:
Better choice I would recommend is to use:
Code: Select all
module_i2c_master
-
Verified
- XCore Legend
- Posts: 1156
- Joined: Thu May 27, 2010 10:08 am
I'm afraid module_i2c_master won't work. Check the port mapping (see attached). module_i2c_master needs two ports declared in a struct. On the startKIT/audio slice, I2C is mapped to a single 4b port. So you need to use module_i2c_single_port which has a single wide (in this case 4b) port assigned.
For the GPIO port masks, I forgot to attach this:
This is all working in the example http://www.youtube.com/watch?v=4FxB8RBPtKU. I'm not sure where we are at with publishing this - it has the framework for audio in/out with a DSP thingy in the middle.. I'll check as it might save a lot of time for users trying this sort of thing out
For the GPIO port masks, I forgot to attach this:
Code: Select all
/* General output port bit definitions */
#define P_GPIO_SPDIF_EN 0x01 /* SPDIF enable*/
#define P_GPIO_MCLK_SEL 0x02 /* MCLK frequency select. 0 - 22.5792MHz, 1 - 24.576MHz. */
#define P_GPIO_COD_RST_N 0x04 /* CODEC RESET. Active low. */
#define P_GPIO_LED 0x08 /* LED. Active high. */
You do not have the required permissions to view the files attached to this post.
-
Verified
- XCore Legend
- Posts: 1156
- Joined: Thu May 27, 2010 10:08 am
The audio effects example, using startKIT and the audio slice (https://www.xmos.com/en/products/xkits/ ... udio-slice), has been pushed to github.
You can find the source here:
https://github.com/xcore/sw_startkit_examples
and it should soon shortly also be available via the community tab in xTIMEcomposer.
You can find the source here:
https://github.com/xcore/sw_startkit_examples
and it should soon shortly also be available via the community tab in xTIMEcomposer.
-
- Junior Member
- Posts: 6
- Joined: Wed Jan 01, 2014 8:31 pm
Whoohoo! Thank you!infiniteimprobability wrote:The audio effects example, using startKIT and the audio slice (https://www.xmos.com/en/products/xkits/ ... udio-slice), has been pushed to github.
You can find the source here:
https://github.com/xcore/sw_startkit_examples
and it should soon shortly also be available via the community tab in xTIMEcomposer.
-
- Junior Member
- Posts: 6
- Joined: Wed Jan 01, 2014 8:31 pm
Thanks again for posting the audio slice tutorial. It has been immensely helpful in getting my own projects going.
Though, I am having trouble getting it to work with the xSCOPE (real-time).
I've made sure USE_XSCOPE is defined, and followed the directions here:
https://www.xmos.com/en/support/documen ... nent=14796
Is there anything tricky I'm missing?
Though, I am having trouble getting it to work with the xSCOPE (real-time).
I've made sure USE_XSCOPE is defined, and followed the directions here:
https://www.xmos.com/en/support/documen ... nent=14796
Is there anything tricky I'm missing?