ISD4002 Project

Hello,

I am attempting to get an ISD4002 chip to record and playback a signal from a PUI electret mic, via an Arduino Uno. The wiring schematic is very much like the one I’m listing here below, except that I’m using an Arduino Uno instead of a PIC16F690IP chip:

I have the basic structure for the code implemented, but it does not seem to do anything. I can get the mic to work fine and it seems to be going through the entire circuit, but there is no recording or playback going on. I’ve included the code below as well and would appreciate any ideas on what to focus on to solve this problem. Thanks in advance for the feedback!

#define DATAOUT 11 // MOSI
#define DATAIN 12 // MISO
#define SPICLOCK 13 // SCK
#define SLAVESELECT 10 // SS
#define INTERRUPT 2 // INT

#define ISD_OPCODE_POWERUP B00100
#define ISD_OPCODE_SETPLAY B00111
#define ISD_OPCODE_PLAY B01111
#define ISD_OPCODE_SETREC B00101
#define ISD_OPCODE_REC B01101
#define ISD_OPCODE_STOP B01100
#define ISD_OPCODE_POWERDOWN B00000
#define ISD_OPCODE_RINT B01100
#define ISD_POWERUP_DELAY 25

char spi_transfer(volatile char data) {
SPDR = data;
while (!(SPSR & (1<<SPIF))) { }
return SPDR;
}

void spi_init() {
byte clr;
pinMode(DATAOUT, OUTPUT);
pinMode(DATAIN, INPUT);
pinMode(SPICLOCK, OUTPUT);
pinMode(SLAVESELECT, OUTPUT);
pinMode(INTERRUPT, OUTPUT);

digitalWrite(SLAVESELECT, HIGH); // Disable device

// SPCR = 01010000
//interrupt disabled,spi enabled,msb 1st,master,clk low when idle,
//sample on leading edge of clk,system clock/4 rate (fastest)

SPCR = (1<<SPE)|(1<<MSTR);
clr=SPSR;
clr=SPDR;
delay(10);
}

void isd_send_command(unsigned char command, unsigned int address) {
digitalWrite(SLAVESELECT, LOW);
spi_transfer(address & 0xff);
spi_transfer(((address & 0xff00) >> 3) | command);
//digitalWrite(SLAVESELECT, HIGH);
}

void isd_powerdown() {
//Serial.println(“Powering down…”);
isd_send_command(ISD_OPCODE_POWERDOWN, 0);
digitalWrite(SLAVESELECT, HIGH);
}

void isd_powerup() {
//Serial.println(“Powering up…”);
isd_send_command(ISD_OPCODE_POWERUP, 0);
delay(ISD_POWERUP_DELAY);
}

void isd_play(unsigned int address) {
//Serial.println(“Playing…”);
isd_powerup();
isd_send_command(ISD_OPCODE_SETPLAY, address);
isd_send_command(ISD_OPCODE_PLAY, 0);
}

void isd_record(unsigned int address) {
//Serial.println(“Recording…”);
isd_powerup();
isd_powerup();
delay(ISD_POWERUP_DELAY);
isd_send_command(ISD_OPCODE_SETREC, address);
isd_send_command(ISD_OPCODE_REC, 0);
}

void isd_stop() {
//Serial.println(“Stopping…”);
isd_send_command(ISD_OPCODE_STOP, 0);
digitalWrite(SLAVESELECT, HIGH);
}

void setup() {
Serial.begin(9600);
spi_init();
//isd_powerup();
}

void loop() {
isd_record(0);
delay(10000);

isd_stop();
delay(2000);

isd_play(0);
delay(10000);

isd_stop();
delay(2000);
}

Sorry, the picture didn't display above. Here's the circuit schematic here: