This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

lpc2148+vs1033d

Hi,

I am trying to interface vs1033d mp3/aac decoder with LPC2148.I wrote code for testing sine test on vs1033d...but it is not working.

So, to activate the sine test these are the steps,
- Reset the VS chip
- Set the ALLOW_TESTS bit in the SCI_MODE register (register 0)
- Make sure the XCS is high (never have both XCS and XDCS low at the same time)
- Pull XDCS low
- Send the 8 byte sequence to the SPI bus
- Wait for the sending of bytes to be complete
- Pull XDCS back high
You should now hear the beep.
i m writing my code here..please check the code and help me what is wrong in it..

//----------------------------------------------------------------------------
// C main line
//----------------------------------------------------------------------------

#include <lpc214x.h>
#include "integer.h"
#define xReset 0x00002000; //P0.13 es Reset
#define xDCS 0x00004000; //P0.14 as Bsync
#define xCS 0x00000080; //P 0.7 as CS_SPI
#define DREQ 0x00001000; //P0.12 es DREQ

void VS1033_SCI_write(unsigned char, unsigned short int);
unsigned short int VS1002_SCI_read(unsigned char);
void VsSineTest(void);
void Delay(unsigned int milliseconds);
BYTE SPI_Send(BYTE data);
void SPI_Init ();

void SPI_Init ()
{

PINSEL0 |= 0x1500; //Configure the SPI I/O.
VPBDIV = 0x02;
S0SPCCR = 0x12; //SPI Preescaler.
 S0SPCR = 0x20; //SPI master configuration.

}
/* send and receive a byte on the SPI bus */
BYTE SPI_Send(BYTE data)
{ S0SPDR = data;
while (!(S0SPSR & 0x80)){}
 return S0SPDR;
}

/* main */
int main(void) {
 SPI_Init();
IODIR0 = xReset ;
IODIR0 = xDCS;
IODIR0 = xCS ;
 IODIR0 &= ~DREQ;
VsSineTest();
}

void VsSineTest(void)
{ int i;
IOCLR0 = xReset;
SPI_Send(0xff);

IOSET0 = xReset;
Delay(100);
while((0X00001000)==0) ;

/* As an example, let's write value 0x0820 to register 00 byte by byte */

IOCLR0 = xCS;
SPI_Send(0x02);
SPI_Send(0x00);
SPI_Send(0x08);
SPI_Send(0x20);

IOSET0 = xCS; /* Now SPI writes don't go to SCI port */

/* Send a Sine Test Header to Data port */
IOCLR0 = xDCS; /* Now SPI writes go to SDI port*/

SPI_Send(0x53);
SPI_Send(0xef);
SPI_Send(0x6e);
SPI_Send(0x44);
SPI_Send(0x00);
SPI_Send(0x00);
SPI_Send(0x00);
SPI_Send(0x00);
Delay(200);
IOSET0 = xDCS;

Delay (200);

/* Stop the sine test sound */
 IOCLR0 = xDCS;
SPI_Send(0x45);
 SPI_Send(0x78);
 SPI_Send(0x69);
SPI_Send(0x74);
SPI_Send(0x00);
SPI_Send(0x00);
SPI_Send(0x00);
SPI_Send(0x00);
Delay(200);
IOSET0 = xDCS;

Delay(500);
}

void Delay(unsigned int milliseconds)
{ volatile unsigned int i;
 while(milliseconds--)
{ for(i=0;i<60000;i++);
 __asm__ ("nop"); }
}

0