Changing Arducam Mega 3MP data pins (MOSI etc.) on ESP32

Hi everyone, I’m using an Arducam Mega 3MP with an ESP32 dev board. The camera works fine with the GUI software when I use the default pin wiring, and I’ve managed to capture an image. The problem is I need to change which ESP32 pins the data lines plug into. I’ve figured out how to change the CS pin in code, but I’m stuck on how to change the other pins, like MOSI. Can someone point me to where in the software those pins get assigned?

Thanks for the details. To clarify what’s going on: on the ESP32, the default SPI pins (MOSI/MISO/SCK) are tied to the hardware SPI controller, which is why the camera runs fast and reliably out of the box. CS is a different story - it’s just a regular GPIO that the library toggles to select the chip, so that’s why you were able to move it without trouble. The MOSI/MISO/SCK lines can’t be reassigned the same way because they’re driven by the SPI peripheral. If you move those lines to other GPIOs, you’re no longer on the hardware SPI path, and it may require a software SPI implementation instead. Software SPI is significantly slower and less reliable, and the default configuration has been tested to make sure everything works properly. So we’d generally recommend keeping the default SPI pins if you can.

I see what you’re saying, but on my PCB the default SPI pins are already taken by other sensors and drivers, so I can’t free them up. That’s exactly why I need to move the camera to different pins. What software changes would I actually need to make to get the camera working on other pins? Is there a setting in the Arducam library, or do I need to change something in the ESP32 SPI setup itself?

Right now there isn’t a simple config change that moves MOSI/MISO/SCK to arbitrary pins while keeping hardware SPI. Because those lines map to the ESP32’s hardware SPI controller, moving them off the default pins generally means switching to a software SPI approach - basically bit-banging the lines manually - which is slower and less reliable than the hardware path. The recommendation is still to keep the default SPI pins for the camera if at all possible, since that gives the most stable and fastest data transfer. If your other sensors are hard-wired to those pins and you really have to move the camera, we’d need to work through the exact software changes for your setup: which pins you want to use and which library/sketch you’re running with the camera. That will let us confirm whether software SPI is your only option and what that would look like. I’ll follow up once we’ve confirmed that part.