Arduino
Arduino copied to clipboard
Cannot use OV5642 with Arduino MRK1000
I'm trying to use Arduino MRK1000 with OV5642 ArduCAM-Mini-5MP-Plus.
In order to do so I first loaded the following example: ArduCAM_Mini_5MP_OV5642_Plus_Functions
When I compile I get the same error as here: https://github.com/ArduCAM/Arduino/issues/308 So I edited the ArduCAM.h coping the setting of ESP8266:
#define MKR1000 1
#if defined(MKR1000)
#define cbi(reg, bitmask) digitalWrite(bitmask, LOW)
#define sbi(reg, bitmask) digitalWrite(bitmask, HIGH)
#define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask);
#define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask);
#define cport(port, data) port &= data
#define sport(port, data) port |= data
#define swap(type, i, j) {type t = i; i = j; j = t;}
#define fontbyte(x) cfont.font[x]
#define regtype volatile uint32_t
#define regsize uint32_t
#endif
In this way I solved the compilation problems but the SPI does not work.
The sketch give me the following error: ACK CMD SPI interface Error!
and I have no idea on how to solve this problem.
This is how I connected the cam to the MKR:
CAM |||| MKR1000
CS pin 7
MOSI pin 8 (MOSI)
MISO pin 10 (MISO)
SCK pin 9 (SCK)
GND GND
VCC 5V
SDA pin 11 (SDA)
SCL pin 12 (SCL)
Here is the pinout of the MKR1000 (e.g. pin 7 correspond to D7):
EDIT:
I solved changing the connection of CS, now it is:
CAM |||| MKR1000
CS pin 0
Now the example print me this:
ACK CMD SPI interface OK.
ACK CMD Can't find OV5642 module!
Why it can not find the module?
EDIT2:
Sometimes the module is recognised and print the following message:
ACK CMD OV5642 detected.
And then doesn't print nothing.
Now, how can I read the image?