Itead Gboard and Jpeg Camera

OK I am a novice and I’m tired of pulling my hair out. Any help will be appreciated :

I am using the Gboard : http://imall.iteadstudio.com/im120411004.html

Camera : https://www.sparkfun.com/products/11610

I have code From Camera Maker :

sketch :

// LinkSprite.com

// Note:

// 1. SD must be formated to FAT16

// 2. As the buffer of softserial has 64 bytes, so the code read 32 bytes each time

// 3. Please add the libaray to the lib path

// * SD card attached to SPI bus as follows:

//** MOSI - pin 11

// ** MISO - pin 12

// ** CLK - pin 13

// ** CS - pin 4

#include <SoftwareSerial.h>

#include <SPI.h>

#include <SD.h>

byte ZERO = 0x00;

byte incomingbyte;

SoftwareSerial mySerial(0, 1); // Set Arduino pin 4 and 5 as softserial

long int a = 0x0000, j = 0, k = 0, count = 0, i = 0;

uint8_t MH, ML;

boolean EndFlag = 0;

File myFile;

void TakePictureNow();

void SendResetCmd();

void SetBaudRateCmd();

void SetImageSizeCmd();

void SendTakePhotoCmd();

void SendReadDataCmd();

void StopTakePhotoCmd();

void setup()

{

Serial.begin(38400);

while (!Serial) {

; // wait for serial port to connect. Needed for Leonardo only

}

mySerial.begin(38400);

Serial.print(“Initializing SD card…”);

// On the Ethernet Shield, CS is pin 4. It’s set as an output by default.

// Note that even if it’s not used as the CS pin, the hardware SS pin

// (10 on most Arduino boards, 53 on the Mega) must be left as an output

// or the SD library functions will not work.

pinMode(10, OUTPUT);

pinMode(0, INPUT);

pinMode(1, OUTPUT);

if (!SD.begin(10)) {

Serial.println(“initialization failed!”);

return;

}

Serial.println(“initialization done.”);

TakePictureNow();

}

void loop()

{

}

void TakePictureNow()

{

byte a[32];

int ii;

Serial.print(“Sending Camera Reset…”);

SendResetCmd();

delay(4000); //Wait 2-3 second to send take picture command

Serial.println(“Cam reset done.”);

Serial.print(“Taking Picture…”);

SendTakePhotoCmd();

Serial.println(“Pic done.”);

while (mySerial.available()>0)

{

incomingbyte = mySerial.read();

}

Serial.println(“Finished Reading pic”);

myFile = SD.open(“pic.jpg”, FILE_WRITE); //The file name should not be too long

Serial.println(“File Created.”);

while (!EndFlag)

{

j = 0;

k = 0;

count = 0;

Serial.print(“Sending Read Data…”);

SendReadDataCmd();

delay(20); //250 for regular

while (mySerial.available()>0)

{

incomingbyte = mySerial.read();

Serial.print(“Imcoming Byte…”);

Serial.println(incomingbyte);

k++;

if ((k>5) && (j<32) && (!EndFlag))

{

a[j] = incomingbyte;

if ((a[j - 1] == 0xFF) && (a[j] == 0xD9)) //tell if the picture is finished

EndFlag = 1;

j++;

count++;

}

}

for (j = 0; j<count; j++)

{

if (a[j]<0x10)

Serial.print(“0”);

Serial.print(a[j], HEX); // observe the image through serial port

Serial.print(" ");

}

for (ii = 0; ii<count; ii++)

myFile.write(a[ii]);

Serial.println();

i++;

}

myFile.close();

Serial.print(“Finished writing data to file”);

}

void SendResetCmd()

{

mySerial.write(0x56);

mySerial.write(ZERO);

mySerial.write(0x26);

mySerial.write(ZERO);

}

void SetImageSizeCmd()

{

mySerial.write(0x56);

mySerial.write(ZERO);

mySerial.write(0x31);

mySerial.write(0x05);

mySerial.write(0x04);

mySerial.write(0x01);

mySerial.write(ZERO);

mySerial.write(0x19);

mySerial.write(0x11);

}

void SetBaudRateCmd()

{

mySerial.write(0x56);

mySerial.write(ZERO);

mySerial.write(0x24);

mySerial.write(0x03);

mySerial.write(0x01);

mySerial.write(0x2A);

mySerial.write(0xC8);

}

void SendTakePhotoCmd()

{

mySerial.write(0x56);

mySerial.write(ZERO);

mySerial.write(0x36);

mySerial.write(0x01);

mySerial.write(ZERO);

}

void SendReadDataCmd()

{

MH = a / 0x100;

ML = a % 0x100;

mySerial.write(0x56);

mySerial.write(ZERO);

mySerial.write(0x32);

mySerial.write(0x0c);

mySerial.write(ZERO);

mySerial.write(0x0a);

mySerial.write(ZERO);

mySerial.write(ZERO);

mySerial.write(MH);

mySerial.write(ML);

mySerial.write(ZERO);

mySerial.write(ZERO);

mySerial.write(ZERO);

mySerial.write(0x20);

mySerial.write(ZERO);

mySerial.write(0x0a);

a += 0x20;

}

void StopTakePhotoCmd()

{

mySerial.write(0x56);

mySerial.write(ZERO);

mySerial.write(0x36);

mySerial.write(0x01);

mySerial.write(0x03);

}

From the Itead Studios : ( from question I sent into them )

The camera module should be compatible with gboard, but first of all, software serial doesn’t suggest to use 38400 to communicate with UART module. So in this case you should connect the hardware serial(D0,D1) to the camera module.

A0~5 pins can be both digital and analog pins.

http://wiki.iteadstudio.com/Gboard

Where my issue is " I think" is Im not sure which of the D1 and D0 Pins to connect to. Something about the Gboard pinouts has got me completely confused.

Questions:

Which Pins should the Camera be plugged into? Digital or Analog? ( I understand that that pins A0 ~ A5 can be digital aswell)

What should be the baud rate for this camera? I have read high Baud on v5 and lower on v3.3?

Where all should I have the jumpers set on this ? Currently Have jumpers set for Software UART to SIM900, Hardware UART to Specific but only on the ST, SR side.

I can upload and run code against the Board no problem. I can get the camera to power up. All code runs, but It like there is no actual communication back and forth with he camera no matter what pins I use.

Again Thanks for any help .