Pages: [1]   Go Down
Author Topic: Waveshield not working  (Read 1464 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all

i am testing out the code for the Arduino Wave shield. However, whenever i try to compile the code, it tells me that my AF_Wave.h is not in the directory. And i know i copied the AF wave library AND the waveHC  into the hardware of the program. So it should technically work.

Here is my code
Code:
#include <AF_Wave.h>
#include <avr/pgmspace.h>
#include "util.h"
#include "wave.h"

AF_Wave card;
File f;
Wavefile wave;      // only one!

#define redled 9

uint16_t samplerate;

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Wave test!");

  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(redled, OUTPUT);
  
  if (!card.init_card()) {
    putstring_nl("Card init. failed!"); return;
  }
  if (!card.open_partition()) {
    putstring_nl("No partition!"); return;
  }
  if (!card.open_filesys()) {
    putstring_nl("Couldn't open filesys"); return;
  }

 if (!card.open_rootdir()) {
    putstring_nl("Couldn't open dir"); return;
  }

  putstring_nl("Files found:");
  ls();
}

void ls() {
  char name[13];
  int ret;
  
  card.reset_dir();
  putstring_nl("Files found:");
  while (1) {
    ret = card.get_next_name_in_dir(name);
    if (!ret) {
       card.reset_dir();
       return;
    }
    Serial.println(name);
  }
}

uint8_t tracknum = 0;

void loop() {
   uint8_t i, r;
   char c, name[15];


   card.reset_dir();
   // scroll through the files in the directory
   for (i=0; i<tracknum+1; i++) {
     r = card.get_next_name_in_dir(name);
     if (!r) {
       // ran out of tracks! start over
       tracknum = 0;
       return;
     }
   }
   putstring("\n\rPlaying "); Serial.print(name);
   // reset the directory so we can find the file
   card.reset_dir();
   playcomplete(name);
   tracknum++;
}

void playcomplete(char *name) {
  uint16_t potval;
  uint32_t newsamplerate;
  
  playfile(name);
  samplerate = wave.dwSamplesPerSec;
  while (wave.isplaying) {    
 // you can do stuff here!
 delay(500);
   }
  card.close_file(f);
}

void playfile(char *name) {
   f = card.open_file(name);
   if (!f) {
      putstring_nl(" Couldn't open file"); return;
   }
   if (!wave.create(f)) {
     putstring_nl(" Not a valid WAV"); return;
   }
   // ok time to play!
   wave.play();
}

any suggestions?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49077
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The library should be in the Hardware/libraries folder, not the hardware folder. Is that a typo?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ah yes i apologize. I meant to say its in the Hardware/library.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

alright update

so i needed to open the file via the arduino shortcut folder, and i avoided that error. Hooray!

now i have it all successfully downloaded, but when i try to execute the code and look through the serial monitor, i keep getting the error:

Wave test!
Free RAM: 1191
No valid FAT partition!


SD I/O error: 10, 80

anyone know what that means?
Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

how big is the card, and how is it formatted
Logged


0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The SD card is a mini 2 GB and its FAT 16 formatted
i basically followed it according to this site here: http://www.ladyada.net/make/waveshield/formatcard.htm
Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would first try FAT formatting it. Maybe the card is not reading properly.

Mowcius
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hmm i have done that...
and the funny part is, we tried it with my friend's mac, with the EXACT configurations and setup and it worked perfectly.

could the problem be my pc laptop then?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49077
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
we tried it with my friend's mac
You tried what? Formatting the SD card?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

lol we tried the whole wave shield arduino and code and ran it on the MAC, and the sound system worked perfectly.
Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe you modified some code by accident on the windows laptop before you uploaded it. I suggest now you know it works you try again on the windows laptop.

It would be good to find out what the issue was/is in case someone else has the same problem. Have you looked on the waveshield page to see if there are any bugs reported relating to your problem?

Mowcius
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hmmm

i went ahead and tried to modify a couple of things in the code itself.

i changed the code from this:
  if (!card.init()) {//play with 8 MHz spi  
to

  if (!card.init(true)) {//play with 4 MHz spi

and i still get

No valid FAT partition!


SD I/O error: 10, 7F

the only thing i can think of is make it a FAT32 which you are NOT suppposed to do...but i am running out of options
« Last Edit: December 09, 2009, 12:32:36 pm by haukmoon269 » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i even ran a test an SD_read test and it gave me this error

init time: 38

Card type: SD1

Manufacturer ID: 6F
OEM ID:
Product: SMI  
Version: 1.0
Serial number: 369557504
Manufacturing date: 1/2003
card size: 3920896 (512 byte blocks)
partion,boot,type,start,length
read partition table failedSD error
errorCode: 10
errorData: 0
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

alrighty then

after browsin around a bit, i had the idea to change my SD card to a different one. and it worked. I guess some SD cards are better than others. So i guess for anyone out there that is experiencing this problem, you might want to try other SD cards.

thanks for all the input!
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49077
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are definitely differences between SD cards, and some work with the various libraries/hardware, and some do not. Since they all seem to work in the computer, it would be nice to track down the source of the problem, and try to correct it. Whether that means a change to the libraries or to the hardware I do not know.

You showed data for a card that did not work. Could you show the same data for the card that did work?
Logged

Pages: [1]   Go Up
Jump to: