Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

VS1002d Code
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
superbrad

Bascom Member



Joined: 18 Sep 2005
Posts: 62

usa.gif
PostPosted: Wed Mar 15, 2006 4:42 am    Post subject: VS1002d Code Reply with quote

Here's some VS1002 code. Thought maybe somebody might like it or be able to use it. I was actually surprised at how easy it was, I mean even I got it Wink.

I used a SparkFun VS1002 breakout board and an M128L running at 3.3V to make the hardware simple. Here's what's hooked up to it:

Lines connected to the MCU:
SO -> Pinb.4
SI -> Portb.5
SCLK -> Portb.7
CS -> Portb.6
RST -> Porte.7
DREQ-> Pine.6

Remaining lines:
BSYNC -> 100K Pullup to Vcc
TX -> NC
RX -> 100K Pullup to Vcc
GND -> Vcc (WHOA! Just kidding, geez ... connect to GND)
Right, Left, Buff -> Stereo jack
MICP-MICN -> NC
GPIO0-GPIO3-> NC
Vin+ -> 3.3V

Remember I used the breakout board. If you are using your own board or a different breakout board, you're on your own for pinouts.

Have fun. If anybody has any suggestions or improvements, feel free to post.

Brad

Edit: All the includes come with the latest version of BASCOM-AVR and should be available in the Samples -> AVRDOS folder under your BASCOM directory. I usually just save my AVR-DOS projects into that folder so the includes are right there without a lot of copies of them scattered around my hard drive.


Last edited by superbrad on Thu Mar 16, 2006 3:09 am; edited 3 times in total
Back to top
View user's profile AIM Address Yahoo Messenger MSN Messenger
papa_of_t

Bascom Member



Joined: 18 Jul 2005
Posts: 88

blank.gif
PostPosted: Wed Mar 15, 2006 11:17 am    Post subject: Reply with quote

Hi, i had a look inside. I don't understand description "This file plays an MP3 file with a VS1002 chip from an MMC card (via AVR-DOS)." but the program is for displaying something (only)?

And also: Is is possible to get your includes (Config_MMC.bas, Config_AVR-DOS.BAS, fs_interpreter.bas) somewhere for free? i doubt.. Smile

_________________
Carsten,
with greetings from the nice city of Berlin
Back to top
View user's profile
george2002

Bascom Member



Joined: 23 Nov 2005
Posts: 74
Location: Krakow

poland.gif
PostPosted: Thu Mar 16, 2006 12:52 am    Post subject: Reply with quote

hi i downloaded newest version of bascom 1.11.8.1 and i cant find that code for driving vs1002 chip Sad where is it ?

ps sry Smile in opera i didn't saw correct this page and attahments Smile and i was not logged in Wink

_________________
Hi 4 all Smile


Last edited by george2002 on Sat Mar 18, 2006 11:11 am; edited 3 times in total
Back to top
View user's profile Visit poster's website
superbrad

Bascom Member



Joined: 18 Sep 2005
Posts: 62

usa.gif
PostPosted: Fri Mar 17, 2006 8:49 pm    Post subject: Reply with quote

Just a note - The above code has been corrected. It is now code that initializes the VS1002d and sends an MP3 song to the chip from an MMC card. Have fun!

- Brad
Back to top
View user's profile AIM Address Yahoo Messenger MSN Messenger
george2002

Bascom Member



Joined: 23 Nov 2005
Posts: 74
Location: Krakow

poland.gif
PostPosted: Sat Mar 18, 2006 11:10 am    Post subject: Reply with quote

superbrad do you have bascom code to drive vs1001 ? because i got him from some time and now i have some time to get it working but if you chave some code to drive him that will helps me much Smile
_________________
Hi 4 all Smile
Back to top
View user's profile Visit poster's website
superbrad

Bascom Member



Joined: 18 Sep 2005
Posts: 62

usa.gif
PostPosted: Mon Mar 20, 2006 5:02 pm    Post subject: Reply with quote

George, the code is already posted above. Log in and you will be able to see it and download it.

- Brad
Back to top
View user's profile AIM Address Yahoo Messenger MSN Messenger
george2002

Bascom Member



Joined: 23 Nov 2005
Posts: 74
Location: Krakow

poland.gif
PostPosted: Mon Mar 20, 2006 7:26 pm    Post subject: Reply with quote

yeah ok i logged in and downloaded that mmc-vs1002.bas but does it support vs1001 chip ? does this code will drive vs1001 too ? or only vs1002 ? do you have bascom example to drive vs1001 chip Smile ?

thx in advice
george2002

_________________
Hi 4 all Smile
Back to top
View user's profile Visit poster's website
superbrad

Bascom Member



Joined: 18 Sep 2005
Posts: 62

usa.gif
PostPosted: Mon Mar 20, 2006 9:32 pm    Post subject: Reply with quote

It shouldn't be too different from the VS1001, but I can't say for sure what or how much is different as I don't have one and probably won't be getting one. A good place to start would be to check the datasheet. I know there's a significant difference with the BSYNC line that you would need to change to send data, but other than that, I don't know. Also, you'll need to change the crystal speed in the initialization subroutine to match whatever crystal you're using.

Good luck,
Brad
Back to top
View user's profile AIM Address Yahoo Messenger MSN Messenger
george2002

Bascom Member



Joined: 23 Nov 2005
Posts: 74
Location: Krakow

poland.gif
PostPosted: Mon Mar 20, 2006 11:12 pm    Post subject: Reply with quote

thanks for replay Smile now i'm studying datascheet and setting up ports and pins Smile

i have last question to you brad, do you tested bigger sample bit rates then 8000Khz like 441000Khz ? can atmega drive that speeds ?

thanx for info
best regards
george2002

_________________
Hi 4 all Smile
Back to top
View user's profile Visit poster's website
superbrad

Bascom Member



Joined: 18 Sep 2005
Posts: 62

usa.gif
PostPosted: Tue Mar 21, 2006 1:39 am    Post subject: Reply with quote

Yes, the file info about the MP3 I was testing it with was:
Under Pressure by Queen/David Bowie
Bitrate: 128 Kbit/s
Sample rate: 44100 KHz

It sounded very clear - I had an M128 running at 8 MHz with it reporting the state of the DREQ pin to an LED. It seemed as though it was only running it at about half load (but that's just judging by sight). I had it running at 4 MHz just fine as well, so I'm pretty sure you should be able to get it working pretty good.

Also, VLSI has an application notes PDF on their website - it was very helpful. It points out a lot of differences between the different versions of the VS series of chips.

Good luck,
Brad
Back to top
View user's profile AIM Address Yahoo Messenger MSN Messenger
george2002

Bascom Member



Joined: 23 Nov 2005
Posts: 74
Location: Krakow

poland.gif
PostPosted: Tue Mar 21, 2006 1:57 pm    Post subject: Reply with quote

thanks for info Smile
i just downloaded those aplication notes and starting to study them, anyway thanks for helping me much Smile

regards
george2002

_________________
Hi 4 all Smile
Back to top
View user's profile Visit poster's website
papa_of_t

Bascom Member



Joined: 18 Jul 2005
Posts: 88

blank.gif
PostPosted: Tue Mar 21, 2006 5:36 pm    Post subject: Reply with quote

Hey superbrad - this is a great example! Thank you very much. I am just waiting for my Sparkfun breakout board and then i will follow you Smile
_________________
Carsten,
with greetings from the nice city of Berlin
Back to top
View user's profile
Gmccomb

Bascom Member



Joined: 25 Mar 2006
Posts: 12

blank.gif
PostPosted: Sun Mar 26, 2006 7:51 pm    Post subject: Reply with quote

Superbrad, Many thanks for the code.

Alas, I find I'm having some compile errors, and am not sure why. I've left your file as-is. In 1.11.8.2, I'm getting the follow errors upon compilation (I've edited out the paths to the fs_interpreter.bas file to make the error listing easier to read):

Code:
Error : 242   Line :   639   Source variable does not match the target variable [ 0]  , in File fs_interpreter.bas
Error : 15    Line :   640   Wrong datatype [ 200:getclassname]  , in File : fs_interpreter.bas
Error : 15    Line :   646   Wrong datatype [ 200:getclassname]  , in File : fs_interpreter.bas
Error : 15    Line :   1147  Wrong datatype [ 305:getclassname]  , in File : fs_interpreter.bas
Error : 242   Line :   1637  Source variable does not match the target variable [ 0]  , in File fs_interpreter.bas
Error : 242   Line :   1654  Source variable does not match the target variable [ 0]  , in File : fs_interpreter.bas


I put the mmc-vs1002.bas file in the same directory as all the other AVR-DOS files. The HW stack etc. have been changed to >128 (tried 128 for some, 256 for others, as in the other AVR-DOS examples, no change).

I noted that the DOS test example included the following function declaration (and corresponding function), and when added, the "Source variable does not match..." error was quieted, but not the others:

Code:
Declare Function Getattr0() As Byte


Commenting out the include for fs_interpreter.bas removed all the errors, as one would imagine.

Any ideas?

-- Gordon
Back to top
View user's profile
papa_of_t

Bascom Member



Joined: 18 Jul 2005
Posts: 88

blank.gif
PostPosted: Mon Mar 27, 2006 10:52 am    Post subject: Reply with quote

Hi superbrad,

i'm still waiting for my sparkfun board Crying or Very sad , meanwhile i made some preparations and calculations - Question is if you ever tested microphone recording and if my thoughts are ok:

I want to use the best recording quality that i can get, and in my mind it is 24kHz sampling rate, expecting 12KByte (96 kBit) /second data stream - is it right in your eyes?

(onboard xtal = 12.288MHz, clock doubling -> Fc = 24.576MHz, d = 4 (minimum) -> Fs = 24576 / (256 * 4) = 24.000 ? -> 16 bit and 4:1 compression -> 12kByte(sec?)

_________________
Carsten,
with greetings from the nice city of Berlin
Back to top
View user's profile
superbrad

Bascom Member



Joined: 18 Sep 2005
Posts: 62

usa.gif
PostPosted: Mon Mar 27, 2006 6:56 pm    Post subject: Reply with quote

Hi guys,

Gordon:

I'm not sure why AVR-DOS has problems with that. I was thinking maybe it was just a problem on my computer, but I guess not. I've never been able to get it to work without messing around with the FS_Interpreter.bas file. It seems as though it needs this file to work properly (even though it will compile without errors it won't work in my experience), but I have to edit out the lines inside the FS_Interpreter file that contains those errors to get it to compile OK. I believe this limits some functions of AVR-DOS, but they're not in use in the program anyways. And it never really compiled OK, it always leaves an error BUT - the way to check it is if it shows the "34% Flash Used" screen (or whatever amount of flash it is). This means it's written the binary file and you can send the program to the chip.

Also, I got errors any time I set any stack setting above 128, but 128 for all three settings seemed to work just fine.

Like I said, just try commenting out the lines that give you errors one at a time in the FS_Interpreter.bas file. I know it's not a clean solution, maybe Josef can shed a little light on this problem. Good luck with that - let me know if you need more help. I can send you my AVR-DOS files if necessary.

I imagine this is most likely a memory allocation problem. I'm in the process of adding XRAM to see if I can alleviate the problem.

Pops:

Sorry, I haven't gotten around to testing out the microphone. I intend to some time, but I probably won't get around to it for a few more weeks. Good luck!

Best regards,
Brad
Back to top
View user's profile AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum