CAP_DONE_MASK is never set

1.Which seller did you purchase the product(s) from?
https://www.robotshop.com/en/arducam-mini-camera-module-w--2mp-plus-ov2640-arduino.html
2.The Model number of the product(s) you have purchased?
ArduCam 2MP OV2640
3.Which Platform are you using the product(s) on?
TTGO LoRa32 Oled v1
4.Which instruction are you following?
https://github.com/ArduCAM/ArduCAM_ESP32S_UNO/tree/master/libraries/ArduCAM
5.Has your product ever worked properly?
No
6.What problems are you experiencing?
Hi ,

now i really get lost. I need your help.

I connected the ArduCam correctly an get positive return messages for SPI & I2C checks.

I even tried with a new bought ArduCam, but no luck, I even did not get the sample code working.

 

The hardware does not take a picture, i do not understand why:

#define ESP32 1;

#include <Arduino.h>
#include “FS.h”
#include “SPIFFS.h”
#include <Wire.h>
#include <SPI.h>
#include <ArduCAM.h>
#include “memorysaver.h”
const int CS = 18;
//Version 2,set GPIO0 as the slave select :
const int SD_CS = 0;
ArduCAM myCAM(OV2640, CS);
uint32_t length = 0;

void capture()
{

//Flush the FIFO
myCAM.flush_fifo();
//Clear the capture done flag
myCAM.clear_fifo_flag();
//Start capture
//Start capture
myCAM.start_capture();
Serial.println(F(“Start Capture”));
while (!myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK))
;
Serial.println(F(“Capture Done.”));
}

void setup()
{
uint8_t vid, pid;
uint8_t temp;
Wire.begin(4, 15);
Serial.begin(115200);
Serial.println(“ArduCAM Start!”);

//set the CS as an output:
pinMode(CS, OUTPUT);
//initialize SPI:
SPI.begin();
SPI.setFrequency(8000000); //4MHZ
SPI.setDataMode(0);

//Reset the CPLD
myCAM.write_reg(0x07, 0x80);
delay(100);
myCAM.write_reg(0x07, 0x00);
delay(100);

delay(100);

while (1)
{
//Check if the ArduCAM SPI bus is OK
myCAM.write_reg(ARDUCHIP_TEST1, 0x55);
temp = myCAM.read_reg(ARDUCHIP_TEST1);
if (temp != 0x55)
{
Serial.println(F(“SPI interface Error!”));
delay(1000);
continue;
}
else
{
Serial.println(F(“SPI interface OK!”));
break;
}
}

while (1)
{
//Check if the camera module type is OV2640
myCAM.wrSensorReg8_8(0xff, 0x01);
myCAM.wrSensorReg8_8(0x12, 0x80);
myCAM.rdSensorReg8_8(OV2640_CHIPID_HIGH, &vid);
myCAM.rdSensorReg8_8(OV2640_CHIPID_LOW, &pid);
if ((vid != 0x26) && ((pid != 0x41) || (pid != 0x42)))
{
Serial.println(F(“Can’t find OV2640 module!”));
delay(1000);
continue;
}
else
{
Serial.println(F(“OV2640 detected.”));
break;
}
}

myCAM.set_format(JPEG);
myCAM.InitCAM();

myCAM.OV2640_set_JPEG_size(OV2640_320x240);

delay(1000);
myCAM.clear_fifo_flag();
}

void loop()
{
// put your main code here, to run repeatedly:
delay(5000);

capture();
}

 

It would be great if you can point me to the issue. Thank you very much.

 
7.What attempts at troubleshooting have you already made?

8.How would you like us to help you?
Check if the ArduCam init is correct and get the ArduCam working on my site.

Hi,

Is your I2C and spi communication normal?
Can you see the two messages “SPI interface OK!” and OV2640 detected.

Hi,

yes i can see the “SPI inteface OK” message and OV2640 is detected, when i use different pin or different SPI init/ CS values the error message is shown.

I really stuck here. I tried this with 2 OV2640 cams.

Hi,
have you modified our configuration file?
Can you send me pictures of I2C communication waveforms?

Hi,
sorry i do not have the tools for this.
Is there a command i can execute to verify the communication is ok between esp32 TTGO and ArduCam?

Are there som special SPI settings needed for example frequency?
The FAQ say when CAP_DONEMASK does not return, the CAM is not configured correctly.
Question: Why does the init do the correct config?

Hi,

i found the problem. It’s not the ArduCam, it was how and which pins are used.


  //set the CS as an output:
  // pinMode(CS, OUTPUT);
  //digitalWrite(CS, HIGH);
  //initialize SPI:
  SPI.begin(17, 23, 21, CS);
  SPI.setFrequency(4000000); //4MHZ
  //SPI.setDataMode(0);

  //Reset the CPLD
  myCAM.write_reg(0x07, 0x80);
  delay(100);
  myCAM.write_reg(0x07, 0x00);
  delay(100);

  delay(100);

Hi,

is there a ArduCam example how to read the image from fifo to base64?

Thank you very much.

Sorry, we don’t have such an example.