Hi everyone, I’m stuck with an ArduCAM mini module camera shield (OV2640) on an Arduino Uno WiFi Rev2. When I run the example with an SD card reader attached, I get ‘ACK CMD SPI interface Error! END’ and it won’t communicate with the camera. I’ve double checked the wiring myself and had someone else look at it too. The weird part is the same camera works fine on a regular Arduino Uno without WiFi. Has anyone seen this before, or have an idea why the WiFi Rev2 behaves differently?
One thing to check first: the SD card reader and the camera can both sit on the SPI bus, and that can cause contention. A lot of SD card readers share the SPI bus and can conflict with SPI camera modules like the OV2640. Can you try a quick test with the SD card reader completely disconnected, and see if the camera alone starts communicating?
I removed the SD card reader and re-ran the OV2640 functional test, but I’m still getting ‘ACK CMD SPI interface Error! END’. Same camera works on the Arduino without WiFi, so at this point it really seems like something specific to the Arduino Uno WiFi Rev2 is causing the SPI interface error. Should the OV2640 work with the Arduino Uno WiFi Rev2 at all? What actually causes that SPI interface error?
Thanks for testing that. Since the camera works on a non-WiFi Arduino but fails on the WiFi Rev2, that does isolate it to the WiFi Rev2 platform rather than the camera itself or the SD card reader. The SPI clock speed on the WiFi board is one of the things that can differ and cause this kind of interface error. Can you check what SPI clock speed your sketch is using on the WiFi Rev2?
Quick question on that - should the SPI clock speed be 4 MHz or 24 MHz for the Arduino WiFi? I’ve seen both mentioned and I’m not sure which one to set.
Try 4 MHz first. If the camera talks at 4 MHz we can go from there. Higher SPI clock speeds on the WiFi board can make the interface error more likely.
Okay, I set the clock to 4 MHz (I also tried adding Wire.setClock(400000)), but now the ArduCAM_mini_2mp_Capture2SD sketch fails with ‘SD Card Error!’. I’m connecting SPI through the 6-pin ICSP header since the WiFi Rev2 needs that for SPI. Here’s what I’m seeing now:
ArduCAM_mini_2mp_OV2640_Functions:
12:02:38.504 → ACK CMD ArduCAM Start! END
12:02:38.688 → ACK CMD SPI interface OK. END
12:02:38.688 → ACK CMD OV2640 detected. END
ArduCAM_mini_2mp_Capture2SD:
12:25:48.601 → ArduCAM Start!
12:25:48.805 → SPI interface OK.
12:25:50.769 → SD Card Error!
So the WiFi module seems to be talking to the OV2640 (SPI interface OK, OV2640 detected), but it still won’t capture to the SD card. The SD card reader itself works fine with the non-WiFi Arduino. I couldn’t get the individual function tests to run to check each feature. Any ideas what’s different here?
So the picture is clearer now: on the WiFi Rev2 the camera itself is being detected (SPI interface OK, OV2640 detected), but the Capture2SD sketch still fails at SD initialization even at 4 MHz. That points more toward an SD library / SPI pin conflict on the WiFi Rev2 than the camera module itself, since the SD reader works on the non-WiFi board. At the moment it’s still unresolved - the current state is that the OV2640 is detected on the WiFi Rev2 but capture to SD keeps hitting ‘SD Card Error!’. If anyone else has run the Capture2SD sketch on an Uno WiFi Rev2 through the ICSP header, it would be helpful to know what clock/pin setup worked.