G'Day,
The code had previously work when I included it in my project sketch, then I added a few more items and a week later found out the Vdrive write no longer works, and causes a runaway condition in the Vdrive.
Have reduced the project code down to the minimum and is based on the excellent sketch in the playground on Arduino Playground - UsbMemory
I can OPEN, CLOSE etc but when I WRITE the Vdrive green led keeps flashing until I power it off. Also when I WRITE without OPENing a file I also get the runaway green Led flashing instead of the “File Open” error response.
Have used an external power supply and added extra filtering all to no avail.
I think the problem is within the Vdrive, as the only way to reset it, is by powering it on/off, and if this is done too quickly the red led flashes.
To eliminate the firmware does anyone know how to reinstall the firmware. The Vdrive will do it automatically if it finds a later version on the memory stick, but as I am using V3.68 this is not the case.
//VB Grants FirstTry
#include <NewSoftSerial.h>
#define READY 0 //fom VDrive low when OK to send it srite data
unsigned int i;
byte rxBuffer[24];
unsigned int rxBufferPointer;
char vBuffer[100];
unsigned int vBufferPointer;
int incomingByte=0;
NewSoftSerial myVdrive(9, 10); // for Vdrive
void setup(void){
Serial.begin(9600); // start serial port
Serial.println("G'Day World");
delay(1000);
myVdrive.begin(9600); // Vdrive
myVdrive.print("IPA");
myVdrive.print(13, BYTE); //
ViewReply();
}
void loop(void)
{
Main:
if (Serial.available() >0){
delay(10);
rxBufferPointer=0; //i=0;
while(Serial.available()>0){
rxBuffer[rxBufferPointer]=Serial.read();
rxBufferPointer++;}
}
incomingByte=rxBuffer[0];
if (incomingByte=='1'){ // OPEN File
myVdrive.print("OPW Audit.txt");
myVdrive.print(13, BYTE);
ViewReply(); }
if (incomingByte=='2'){ // CLOSE file
myVdrive.print("CLF Audit.txt"); // open to write creates a file - named
myVdrive.print(13, BYTE); // return character
ViewReply(); }
if (incomingByte=='3'){ //DIR
myVdrive.print("DIR");
myVdrive.print(13, BYTE);
delay(1000);
ViewReply(); }
if (incomingByte=='5'){ // WRITE file
myVdrive.print("WRF 20"); //write to file)
myVdrive.print(13, BYTE);
myVdrive.print("This is a test 1234"); //Data
ViewReply(); }
if (incomingByte=='8'){ //READ 15 byts
myVdrive.print("RDF 15");
myVdrive.print(13, BYTE);
delay(1000);
ViewReply(); }
if (incomingByte=='9'){ //Get Vdrive infoD
myVdrive.print(13, BYTE);
ViewReply(); }
goto Main;
}
void ViewReply(void){
delay(100);
vBufferPointer=0;
while(myVdrive.available()>0){
vBuffer[vBufferPointer]=myVdrive.read();
vBufferPointer++;
if (vBufferPointer> 30) break;
}
Serial.print("vDisk reply: ");
for (i=0; i<vBufferPointer-1;i++){
Serial.print(vBuffer[i]);
if (i> 30) break;
}
Serial.print(',');
Serial.println(vBufferPointer,DEC);
rxBuffer[0]=0;
}
Have inserted delays and used RTS sensing but still get the same non-working results.
Does anyone have any other ideas.