Page 1 of 1

Shield Pinout

PostPosted: Wed Apr 10, 2013 2:25 pm
by jimmyboy
What pins does the codec shield use on the arduino and what are their functions?


Re: Shield Pinout

PostPosted: Thu Apr 11, 2013 3:28 am
by guest
the full schematic can be found here: ... _schem.png

it uses:
5V , GND, 3.3V - power rails
A0, A1 - pots
A4, A5 - I2C
D5 - codec clock input
D10, D11, D12, D13 - SPI

Re: Shield Pinout

PostPosted: Wed Apr 17, 2013 2:56 pm
by jimmyboy
Thank you, guest -

I am attempting to create a code that would be able to select between the different effect examples given for the audio codec. I am using a 6-position switch to accomplish this which I have successfully gotten to work with the Arduino. The problem is that I do not really understand the ISR function. I was attempting to make a while(switch position) loop to call the different effects. Is this possible? If so, will you give me some advice on how to accomplish this? Is there a way to implement these effects without using an interrupt? I appreciate the help!

Re: Shield Pinout

PostPosted: Thu Apr 18, 2013 8:07 am
by guest
there are a couple of different ways of doing this. probably the easiest is to put the switch checking in the ISR, and have it update a variable. an example is below

Code: Select all

byte switch_position = 0;

ISR(TIMER1_COMPA_vect, ISR_NAKED) { // dont store any registers

  // leave the transfer function at the top as usual
  AudioCodec_data(&left_in, &right_in, left_out, right_out);
  // go to the right code depending upon switch position
  if (switch_position == 0) {
    // one set of code here
  else if (switch_position == 1) {
    // second set of code here
  else {
    // last set of code here
  // check for new switch position
  // this code assumes a rotary encoder on D2,D3,D4
  switch_position = (PIND >> 2) & 0x07;
  // dont forget to return from interrupt

basically, at the end of the ISR you update the switch_position, and then use that later to decide which set of code to use above. this works well if the switch checking function doesnt take up much time. otherwise it can be placed in the main loop(), but then care has to be taken that switch_position isnt being modified when an interrupt occurs. you would have to declare it volatile, and put cli() and sei() around any code that modifies it.

the switch checking code above uses pins D2,D3,D4, and assumes a binary rotary encoder on them. for an 8 position rotary encoder, this gives values 0 - 7, depending upon the position.

Re: Shield Pinout

PostPosted: Mon May 20, 2013 10:28 am
by agprimatic
I just purchased an Audio Codec Shield, and I would recommend these 3 changes for the next rev.

1) The SDA/SCL pins have now been standardized in the 1.0 pinout next to the AREF pin.

2) IOREF can now be used to determine whether the I/O is 5V or 3.3V in the 1.0 pinout.

3) The SPI interface is on the 2x3 programming header in the middle of the board.

So, the only pins that are non-standardized are SS and the clock output. I think the SS signal can go anywhere, but it is unfortunate that the T1 input on the Uno does not exist on the Mega 2560 (only T5). Maybe if the clock were buffered and brought to a spare header, that would work for the Mega 2560.


Ag Primatic

From :
1.0 pinout: added SDA and SCL pins that are near to the AREF pin and two other new pins placed near to the RESET pin, the IOREF that allow the shields to adapt to the voltage provided from the board. In future, shields will be compatible both with the board that use the AVR, which operate with 5V and with the Arduino Due that operate with 3.3V