electrogen
Joined: 24 Feb 2009 Posts: 15 Location: Addis
|
P18 and VS1002D mp3 decoder |
Posted: Wed Mar 18, 2009 1:21 am |
|
|
While I'm trying to make a hard reset to the VS1002d,
it never raise its DREQ line so that I may feed it with mp3 data and all the program stuck there. Here is my code
Code: |
/* PIC18F458 running at 20MHz
xreset ->pic pin C1 o/p--->VS reset
xdreq<--pic pin A4 i/p----<VS DREQ
xcs -->pic pin E2 o/p--->VS xCS
xdcs -->pic pin A5 o/p--->VS xDCS
void resetvs_hard(void)
{
output_high(xcs);output_high(xdcs);
delay_ms(500);
do
{
output_low(xreset); //hard reset
delay_cycles(250);
output_high(xreset);
delay_cycles(650);
delay_cycles(600);
vs_command(0x02,0x00,0x00,0x04); //sets new mode (native SCI mode) and reset bit
delay_ms(100);
}while(!input(xdreq)); //stuck here(xdreq is always down)
delay_ms(1);
vs_command(0x02,0x00,0x08,0x00); //go into new mode (native SCI mode)
delay_ms(1);
vs_command(0x02,0x03,0x30,0xD4); //clock =25MHz
delay_ms(1);
vs_command(0x02,0x0B,volume,volume); //set volume
delay_ms(1);
} |
and also draws much current (800mA) when it performs this function. What possibly be wrong with it?
FYI: the MP3 is one feature in my system; everything else is working fine |
|