ArduCAM / Arduino

This is ArduCAM library for Arduino boards
MIT License
477 stars 350 forks source link

SPI Error with Arduino Uno, OV5642, 5MP ArduCAM mini #88

Open ideapod opened 8 years ago

ideapod commented 8 years ago

Hi there,

I have an Arduino Uno and have connected the 5MP ArduCAM mini Rev B via I2C and SPI pins as per the hardware application note. I have used pin 10 as the CS pin, and the code constant has been set to reflect. I keep having an SPI interface error.

I have modified the #includes in memorysaver.h to reflect I'm using UNO and 5642. I have defined the contstant to say do the bit rotation.

The SPI check fails, and I cannot work out why.

`#if defined(SAM3X8E) Wire1.begin();

else

Wire.begin();

endif

Serial.begin(38400); Serial.println("ArduCAM Start!");

// set the SPI_CS as an output: pinMode(CS, OUTPUT);

// initialize SPI: SPI.begin();

checkSPI();`

check SPI says:

uint8_t temp; //Check if the ArduCAM SPI bus is OK Serial.println("testing Arducam SPI"); myCAM.write_reg(ARDUCHIP_TEST1, 0x55); temp = myCAM.read_reg(ARDUCHIP_TEST1); Serial.println(temp); if(temp != 0x55) { Serial.println("SPI1 interface Error!"); //while(1); } else Serial.println("SPI checks out ok");

'testing Arducam SPI 255 SPI1 interface Error! '

Any ideas on what could be going wrong?

ArduCAM commented 8 years ago

@Mark, You don't need any bit rotation on Arduino UNO R3 board. It seems like you didn't power the board properly. Would you please show me the photo how you wiring the hardware, especially the VCC pins.

ideapod commented 8 years ago

Hi. Thanks for responding. It turns out I'm on a UNO prior to R3. I switched my wiring to use ICMP header for SPI, pin 10 for CS. see http://nanosatrevolution.com/hardware-design/connecting-arduino-to-arducam-mini-5mp/. That seemed to work.

ideapod commented 8 years ago

I'm still having trouble. i setup on a new machine, got the latest code, ran the latest example. it failed to identify the 5642 chip over i2c: `#else //Check if the camera module type is OV5642 myCAM.wrSensorReg16_8(0xff, 0x01); myCAM.rdSensorReg16_8(OV5642_CHIPID_HIGH, &vid); myCAM.rdSensorReg16_8(OV5642_CHIPID_LOW, &pid); if((vid != 0x56) || (pid != 0x42)) Serial.println("Can't find OV5642 module!"); else Serial.println("OV5642 detected.");

endif`

said not detected. i bought a bitscope micro, and got a trace of the i2c signals. see attached. logic analyzer view.

i wondered if the levels were bad. but 4.7 volts seems ok. ![Uploading 2nd go of bitscope with logic.png…]()

any ideas? nothing working still.

ideapod commented 8 years ago

heres the voltage levels: 2nd go of bitscope with logic

ArduCAM commented 8 years ago

@Mark, it seems that the I2C commands are all with NAK. Would you please show me your hardware setup?

ideapod commented 8 years ago

@ArduCAM thanks very much. Here is the pic. It's a bit confusing, because I've got my bitscope connected via the breadboard and my arducam mini directly into the breadboard. I'll add another file for the equivalent fritzing pic

file 26-10-16 9 54 55 pm

ideapod commented 8 years ago

and this is the equivalent fritzing view: prototype arduino r3 arducam_bb