How to interface the startKIT with the audio slice

All technical discussions and projects around startKIT
User avatar
Lefty4000
Active Member
Posts: 32
Joined: Mon Nov 11, 2013 6:17 pm

How to interface the startKIT with the audio slice

Post by Lefty4000 »

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.


User avatar
Lefty4000
Active Member
Posts: 32
Joined: Mon Nov 11, 2013 6:17 pm

Post by Lefty4000 »

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
connerlacy
Junior Member
Posts: 6
Joined: Wed Jan 01, 2014 8:31 pm

Post by connerlacy »

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

Code: Select all

Unexpected CODEC Device ID, expected 0xC, got FF
Any ideas?
User avatar
yuvaraj
Member
Posts: 8
Joined: Fri Oct 18, 2013 9:23 am

Post by yuvaraj »

Hi
Ensure that port mapping that you have configured on slice kit for I2C lines are correct.

Regards,
Yuvaraj
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

Port mapping for the audio slice is below. This is known working.

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
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

Code: Select all

module_i2c_single_port
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.
User avatar
yuvaraj
Member
Posts: 8
Joined: Fri Oct 18, 2013 9:23 am

Post by yuvaraj »

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:

Code: Select all

module_i2c_master
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

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:

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. */
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
Attachments
startKITaudio.xlsx.zip
portmap for startkit with audio slice
(12.09 KiB) Downloaded 332 times
startKITaudio.xlsx.zip
portmap for startkit with audio slice
(12.09 KiB) Downloaded 332 times
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

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.
connerlacy
Junior Member
Posts: 6
Joined: Wed Jan 01, 2014 8:31 pm

Post by connerlacy »

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.
Whoohoo! Thank you!
connerlacy
Junior Member
Posts: 6
Joined: Wed Jan 01, 2014 8:31 pm

Post by connerlacy »

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?
Post Reply