Music on Xplain

Go To Last Post
21 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys,
hoping to enjoy you all, I post here a simple and fast demo for Xplain that play 4 sec of a Luciano Pavarotti song.
I've one question: AvrGCC limit my array Music at about 28K or a little bit more. Why I can't use an array bigger example 115K?
If you want to try, I posted also an array bigger that is into the file PAVAROTTI.wa2 this is about 115K

The array that now I'm using and runs well, called "Music" is into the file Audio.h
You can try to use the array Music into the file PAVAROTTI.wa2 and delate the array Music into the Audio.h
For now the demo runs but play only 4 sec of music.
Using the PAVAROTTI.wa2 you could listen about 19 second of music but the compiler say that the array it's too large.
Is there a solution?

For now enjoy the demo. and I thank you if you have an answer at my question.
Bye.
Davide

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Why I can't use an array bigger example 115K?

The largest size a variable can be is 32k bytes. For something larger than that you will have to use multiple variables. But for something like this, I would think that you could stream the data from a file a bit at a time.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I would think that you could stream the data from a file a bit at a time.

Hi Steve, do you mean to store a file into data flash and then read it?
I'd like to do this but for now I'm not able to read a Fat format from DF, I don't understand well how to do.... :)
I saw that exist FAT library and Data flash library but how to use togheter? I open the file and I read in streaming it....I'm able to say this but not do do it. :-).
Can you suggest me one way?
Thanks again
Davide

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Can you suggest me one way?

http://elm-chan.org/fsw/ff/00ind...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, but I'm a little bit comfused because I don't know how to change the SD/mmc used into the example, with a dataflash. :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well the joy of FatFs is that it's been written in a way to isolate all the lowest level read/write stuff in a separate file with a well defined API. You just provide the "disk IO interface" routines (disk_*()).

In effect AT45 works very like SD/MMC anyway - there's the same concept of blocks/sectors in each so you could probably use mmc.c as a template for what needs to be done with AT45

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is no point in using a computer filesystem like FAT on a DataFlash. Except if the computer can somehow use the DataFlash as block device, like over USB.

Just store your audio data on dataflash in a way you want.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you very much.
I'll try to understand better and do some demo for to learn better how to read a file from DF stored with a program of mass storage.
I already use the Df but I write in and read out the data in a simple way reading the pages sequentially.
Doing so, I'm not able to read a file stored in DF in a FAT format. I really don't know how I could read it, so I thought it needed a FAT system to read files in the DF. The point is that I'd like to store the Audio files into the Data Flash with the USB of the Xplain thanks the USB mass storage program and then read the files fro DF with the XMEGA of Xplain.
For to do this I thought that it was necessary a FAT system or I'm wrong ? Thank you all again.
Davide

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So your DataFlash already has FAT so you must implement it then.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

oops... I'm a little bit without answers because I do not have much practice with the FAT, now I'm only speaking teorically because I've to do all this work.
I thought that loading the masstorage program into the AT90USB1287 of the XPLAIN, it could be possible loadfile music direcly into the dataflash, so I think that my answer is yes, I think that my files and so DF have already a FAT format. Now my problem it's only to read it. Example set the file called song1.wav and play it etc.. For now I play songs from dataflash but I puted them inside the DF by UART and sequentially not in fat format, thank a VB6 software that I made and comunicate with the XPLAIN at 128Kbaud but for to store 9 songs I need to wait too much time :)

Davide

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you using LUFA? Dean has said in the past that when it's running as USB-MSD it'd be quite easy to integrate FatFs to provide FAT filing for the storage.

Once you have FatFs then there'd be no problem to internally f_open(FatFS, "song1.wav", FA_READ) to read the data locally.

To copy a new song to the device you'd then just plug it into the PC which would recognise it as a USB Mass Storage Device and then you simply drag/drop files to it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, my LUFA Mass Storage demo will compile for BOARD = XPLAIN (or BOARD = XPLAIN_REV1, if you have a first revision board with the different dataflash) and run on the board to allow you to write to the dataflash via your PC OS. Your problem then just becomes writing the XMEGA side of things to make FatFs talk to the dataflash.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi and thanks for yours answers but Excuse me for my question I'm not able to find the masstorage for XPLAIN.
I downloaded the LUFA-100219.zip but inside I'm not able to see an XPLAIN masstorage. Is this the right zip file to download?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes - the Mass Storage code is simply the regular Mass Storage device demos (Demos/Device/ClassDriver/MassStorage or Demos/Device/LowLevel/MassStorage depending on the complexity you want). Just edit the makefile so that the BOARD parameter is set to XPLAIN (or XPLAIN_REV1 if you have a first revision board) and recompile.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Dean a thanks at all the other guys. When I've time I'll try.
Bye
Davide

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using Chan's FatFS library on an XMEGA. If you want to see the details on how I ported it, take a look at my project:
http://www.gabotronics.com/development-boards/xmega-xmultikit.htm

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow, thank you very much, it's a nice and big project.
I'll take a look soon at the FatFS library.
Thanks again.
Davider

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dean,

i recently bought XPLAIN but somehow i cant get it to write any file to dataflash from windows using your LUFA Mass Storage device demos, it just says device not formatted, and cant format from windows, do i need to modify the files in any way? (other than edit the makefile so that the BOARD parameter is set to XPLAIN), i understood the example already took care of all(apart from the user layer).

thanks for any help
Edgar

PS, sorry for using a 8 months old thread but it pretty much defines what im trying to achieve.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Edgar,

I just tested the Mass Storage demo on my XPLAIN (Rev4) and it appears to work fine. Two questions:

1) Are you using a FIRST revision XPLAIN? If so, you need to compile for the board target "XPLAIN_REV1" as it has a different (and smaller) Dataflash IC.

2) Is the XMEGA still running the original application? Only one of the two AVRs can access the Dataflash at the one time, and the original application steals control over the Dataflash's select line. Try erasing the XMEGA and try again.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanx for the quick answer.
Im using a rev 5 Board so thats not it, however i already proggramed with my code and it uses dataflash, never tought it would make problems.

ill check in the morning.

:)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just as a follow up, erasing the XMEGA solved the issue.

Thanx for the help and the great demos on LUFA DEAN.

-Edgar