I am attempting to use the dataflash library from the playground which can be found here Arduino Playground - Dataflash I have an AT45DB081D (data sheet here) http://www.atmel.com/Images/doc3596.pdf on a break out board and connected to my UNO with VCC going to the 3.3V output and the rest go to the locations specified in the library. I am trying to get the example to run so that I can build off of that. I initially got compile errors because of WProgram.h so I changed that to Arduino.h since I am using IDE 1.0. Then I got compile errors because BYTE is no longer supported so I removed that and then everything compiled. However, it gets to a while loop and appears to hang. I posted the sketch right up to the point where it hangs and I notated it in the code where I get to. I also tried the library in its original format with IDE 0023 with the same results. I also tried a second AT45DB081D on a breadboard Arduino running an 8mhz internal clock which also gave the same results.
#include <dataflash.h>
int lastpage=0; //last page written to
int pages=5; //total pages that will be used changed from 25 to 5
Dataflash dflash;
void setup()
{
Serial.begin(115200);
Serial.print('h');
Serial.print('i');
Serial.print('\n');//debug
dflash.init(); //initialize the memory (pins are defined in dataflash.cpp
}
void loop()
{
int j = 0;
int i = 0;
char messageline[] = "This is only a test on page: ";
char lpstring[] = "lastpage: ";
char int_string[10];
itoa(lastpage, int_string, 10); // make string of the pagenumber
strcat(messageline, int_string); //append to the messagline string
//for (int i=0; messageline[i] != '\0'; i++){
while (messageline[i] != '\0'){
Serial.print(messageline[i]); //This prints the first letter of the array and then stops
dflash.Buffer_Write_Byte(1, i, messageline[i]); //it seems to get hung here and it does not loop through
Serial.println("transmitting"); //this never prints so I assume it gets hung above
j = i;
i++;
}
//my output looks like this
hi
T
I have never seen a while loop hang before so I am a little lost as to what to try next. Any suggestions on how I can troubleshoot this are appreciated.