|
856
|
Using Arduino / Project Guidance / serial to eeprom - too much information :-)
|
on: October 01, 2011, 02:40:49 pm
|
|
I am going round in circles with all the search results and variations of the EEPROM library.
What I want to do looks dead simple.
I have 11 audio 8 bit WAV files, one is 30KB the others average 6KB, saved in a file on my PC.
I want to simply copy them onto my 24C1024 eeprom that is connected to the Arduino.
I will only need to do this once, so a seperate slow sketch would be fine.
Each file I want to later be able to call up and send to the DAC.
There is a simple looking sketch on the Wise time project, but it doesnt show any libraries, and has commands such as isWrite..
Can anyone point me in the right direction here, I am not clear about page size etc, it seems that I would like to send a batch at a time and record manually the finish address of each file, and start the next after that....?
|
|
|
|
|
857
|
Using Arduino / Project Guidance / Re: EEPROM better than SD card for audio ?
|
on: September 28, 2011, 08:31:46 am
|
|
I had one of my 4 working SD cards pack up before I added the delay to the triggering micro, but the card could still be read by the PC, so I reformatted it with SDformat, reloaded the wav files and it works OK again.
I have since added a 2 second delay on the triggering micro ( though I cant see why it should cause intermittent problems ) and they are still all working.
I am not sure that this is going to be reliable, so I will have another go at the eeprom, and perhaps make 2 plug in audio cards to choose from.....
|
|
|
|
|
860
|
Using Arduino / Project Guidance / Re: EEPROM better than SD card for audio ? the plot sickens !
|
on: September 27, 2011, 03:03:13 pm
|
|
Before changing anything on my problem board, I checked the specs of my 3.3 v low drop out regulator, and it was rated at 100mA output. I had 'scoped the 3v3 output and could not see any glitches ( but my junk usb scope has poor sync )
At that time, two of my SD cards worked ( one 256Mb and one of the 2Gb microSD with adaptor ) , the other 2 ( 2 Gb ) could be read on the PC but wouldn't boot on the project. In case the problem was a dip in the 3v3 when initialising the cards, I just tried putting a 1000mFd cap on the 3v3 line.
Then all 4 cards worked ! I thought I had it cracked, but when I removed the 1000mFd cap, all 4 still booted up OK !
I have since fitted the right type of buffer chip ( 74HC4050 ), and an 800 Ma low dropout regulator and all is still working.
I have since thought that the problem might be something to do with the fact that the audio control micro is triggered from the video control micro, it might be that the one is trying to trigger the other as soon as it comes on, so I am going to try a delay in the setup function of the video control micro to give the other one a chance to initiate the SD card.
Meanwhile I will still experiment with the mysterious eeprom route just in case !
Another mystery is that I have another 4 faulty SD micro cards that had failed in these projects, and they wont even format or be read on a PC ??
|
|
|
|
|
863
|
Using Arduino / Project Guidance / Re: EEPROM better than SD card for audio ?
|
on: September 25, 2011, 03:08:12 pm
|
|
@ AVP
Thats the sort of problems I have been having with the SD cards,( in my project) its only the smaller capacity cards that work consistantly, and there is a chance that I will have to make a load of these devices, so I have to get the sound stable , and if I use SD cards they must be current ones that I can buy.
That why I was thinking of using an eeprom, but its just a bit too confusing for my experience at the moment, so if I can get the card working it would be the best...........................
|
|
|
|
|
865
|
Using Arduino / Project Guidance / Re: EEPROM better than SD card for audio ?
|
on: September 25, 2011, 02:25:10 pm
|
|
This is really frustrating, I used the same circuit as you Bob, I made 4 of these units and they all have the same problem, I have a separate 3.3v 150mA regulator, I scoped the output and its steady. I tried a couple of different voltage buffer chips, I have decoupled everything.
Tomorrow I think I will make a separate part on perf/vero board, and try it with all the recommended part numbers if I can get them.
Have you tried yours playing back audio clips? I can't see it making any difference, I dont think mine is even getting that far.
With it fitted to the board I have no serial to see whats happening.
I would like to go the DS cvard route, the eeprom is fiddly recording to.
|
|
|
|
|
866
|
Using Arduino / Project Guidance / Re: EEPROM better than SD card for audio ?
|
on: September 25, 2011, 04:36:38 am
|
I have had one last try at using the SD card. I modified the Adafruit wave library to take my bcd inputs, but its exactly the same, it reads the 256Mb cards, but not most of the 2Gb cards. Heres the code below, I dont know if there is something stupid, otherwise I will carry on with the eeprom try, which I am rather out of my depth on I must confess... #include <FatReader.h> #include <SdReader.h> #include <avr/pgmspace.h> #include "WaveUtil.h" #include "WaveHC.h"
SdReader card; // This object holds the information for the card FatVolume vol; // This holds the information for the partition on the card FatReader root; // This holds the information for the filesystem on the card FatReader f; // This holds the information for the file we're play
WaveHC wave; // This is the only wave (audio) object, since we will only play one at a time
int talkingPin = 19; // high while audio playing to video chip to keep number on. int aPin =18; //define pin numbers for bcd inputs from HT12D int bPin =17; int cPin =15; int dPin =16; int vtPin = 14; // define pin numbers for valid transmission input from HT12D int track ; // define audio track number int bcda ; // define bcd digitalreads for BCD/dec conversion int bcdb; int bcdc; int bcdd; int valid ; // to be set high if vt in
// this handy function will return the number of bytes currently free in RAM, great for debugging! int freeRam(void) { extern int __bss_end; extern int *__brkval; int free_memory; if((int)__brkval == 0) { free_memory = ((int)&free_memory) - ((int)&__bss_end); } else { free_memory = ((int)&free_memory) - ((int)__brkval); } return free_memory; }
void sdErrorCheck(void) { if (!card.errorCode()) return; putstring("\n\rSD I/O error: "); Serial.print(card.errorCode(), HEX); putstring(", "); Serial.println(card.errorData(), HEX); while(1);
}
void setup() { // set up serial port Serial.begin(9600);
pinMode (aPin,INPUT); //bcd inputs from HT12 pinMode (bPin,INPUT); pinMode (cPin,INPUT); pinMode (dPin,INPUT); pinMode (vtPin,INPUT); // valid trasnmission input pinMode (talkingPin,OUTPUT); // display enable to vga chip
putstring_nl("WaveHC with 9 inputs");
putstring("Free RAM: "); // This can help with debugging, running out of RAM is bad Serial.println(freeRam()); // if this is under 150 bytes it may spell trouble!
// Set the output pins for the DAC control. This pins are defined in the library pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT);
// pin13 LED pinMode(13, OUTPUT);
if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn't working for you ***** TRIED BOTH // if (!card.init()) { //play with 8 MHz spi (default faster!) putstring_nl("Card init. failed!"); // Something went wrong, lets print out why sdErrorCheck(); while(1); // then 'halt' - do nothing! } // enable optimize read - some cards may timeout. Disable if you're having problems *** TRIED WITH AND WITHOUT AND true // card.partialBlockRead(false); // Now we will look for a FAT partition! uint8_t part; for (part = 0; part < 5; part++) { // we have up to 5 slots to look in if (vol.init(card, part)) break; // we found one, lets bail } if (part == 5) { // if we ended up not finding one :( putstring_nl("No valid FAT partition!"); sdErrorCheck(); // Something went wrong, lets print out why while(1); // then 'halt' - do nothing! }
// Lets tell the user about what we found putstring("Using partition "); Serial.print(part, DEC); putstring(", type is FAT"); Serial.println(vol.fatType(),DEC); // FAT16 or FAT32?
// Try to open the root directory if (!root.openRoot(vol)) { putstring_nl("Can't open root dir!"); // Something went wrong, while(1); // then 'halt' - do nothing! }
// Whew! We got past the tough parts. putstring_nl("Ready!"); }
void loop() {
bcda = digitalRead ( aPin ); // read the state of the video micro "decode" data outputs bcdb = digitalRead ( bPin ); bcdc = digitalRead ( cPin ); bcdd = digitalRead ( dPin ); valid = digitalRead ( vtPin ); // check if signal received, set valid high
if (bcda==1 && bcdb==0 && bcdc == 0 && bcdd == 0 ) { //longwinded bcd / dec decoding to give track number to be read track = 1; } if (bcda==0 && bcdb==1 && bcdc == 0 && bcdd == 0 ) { track = 2; } if (bcda==1 && bcdb==1 && bcdc == 0 && bcdd == 0 ) { track = 3; } if (bcda==0 && bcdb==0 && bcdc == 1 && bcdd == 0 ) { track = 4; } if (bcda==1 && bcdb==0 && bcdc == 1 && bcdd == 0 ) { track = 5; } if (bcda==0 && bcdb==1 && bcdc == 1 && bcdd == 0 ) { track = 6; } if (bcda==1 && bcdb==1 && bcdc == 1 && bcdd == 0 ) { track = 7; } if (bcda==0 && bcdb==0 && bcdc == 0 && bcdd == 1 ) { track = 8; } if (bcda==1 && bcdb==0 && bcdc == 0 && bcdd == 1 ) { track = 9; }
// if ( valid == HIGH ){ if (track==1 ) { playcomplete("doornum1.wav"); } else; if (track==2) { playcomplete("doornum2.wav"); } else; if (track==3) { playcomplete("doornum3.wav"); } else; if (track==4) { playcomplete("doornum4.wav"); } else; if (track==5) { playcomplete("doornum5.wav"); } else; if (track==6) { playcomplete("doornum6.wav"); } else; if (track==7) { playcomplete("doornum7.wav"); } else; if (track==8) { playcomplete("doornum8.wav"); } else; if (track==9) { playcomplete("doornum9.wav"); } //} } // Plays a full file from beginning to end with no pause. void playcomplete(char *name) { // call our helper to find and play this name playfile(name); if (wave.isplaying) {// set display enable high to vga chip digitalWrite(talkingPin, LOW); } else { digitalWrite(talkingPin, HIGH); } while (wave.isplaying) {
} // now its done playing }
void playfile(char *name) { // see if the wave object is currently doing something //if (wave.isplaying) {// already playing something, so stop it! cant happen with talkinpin // wave.stop(); // stop it //} // look in the root directory and open the file if (!f.open(root, name)) { putstring("Couldn't open file "); Serial.print(name); return; } // OK read the file and turn it into a wave object if (!wave.create(f)) { putstring_nl("Not a valid WAV"); return; } if (valid == 1){ // wont run without this here // ok time to play! start playback wave.play();
}
}
|
|
|
|
|
867
|
Using Arduino / Project Guidance / Re: EEPROM better than SD card for audio ?
|
on: September 22, 2011, 10:05:47 pm
|
Of course the other thing is that this test addresses, then writes, to each byte in turn. I will be random addressing approx 5 Kb at a time, so just need to send the start address once, then read a whole string of bytes. I havnt even connected the DAC yet, this was just a speed test routine in the library I am going to see if I can test writing a couple of bytes , then test the retrieve time. I will not actually be writing to the eeprom at all once it is "recorded" except for the dummy write before each random read ( as per data sheet for the 24C1024 ) This is all interesting new ground for me. The DAC I am using at the moment is connected as in the top right of http://www.ladyada.net/media/wavshield/waveshield10schem.png
|
|
|
|
|
868
|
Using Arduino / Project Guidance / Re: EEPROM better than SD card for audio ?
|
on: September 22, 2011, 04:13:45 pm
|
I eventually went back to the serial printout, which I thought was hung, and it reports: E24C1024 Library Benchmark Sketch
-------------------------------- Write By Byte Test:
Writing data:...........................DONE Total Time (seconds): 722 Write operations per second: 181 --------------------------------
-------------------------------- Read By Byte Test:
Reading data:...........................DONE
Total Test Time (secs): 83 Read operations per second: 1579 Total errors: 0 -------------------------------- If I cant get more than 1579 bytes ( or is it talking bits? ) I cant see it providing data fast enough to the DAC for the audio ???
|
|
|
|
|
870
|
Using Arduino / Project Guidance / Re: EEPROM better than SD card for audio ?
|
on: September 22, 2011, 02:56:22 pm
|
OK I have bought a 24C1024 eeprom, made up a little Mgyver shield, and studied the datasheet. I have tried the benchmark example of http://www.arduino.cc/playground/Code/I2CEEPROM24C1024but it gets to " writing data " and hangs. I notice there is no "begin" in the setup, which I think should be the memory reset from the datasheet ? I just want to try writing to and receiving from the eeprom for now. I will try through the night and see how I get on. My next task will be to find how to download the WAV files in bytes and store them on the eeprom.
|
|
|
|
|