I get the camera module(s) on internet: the Arducam Mega 3Mpx
I work on esp32s3 with SD card mount already placed on the pcb. (ESP32-S3-4G-LTE-CAT1-A7670E)
I need to alter the default pin of SPI because the defaults pins of SPI are already used by the SD card mount.
I’ve already tried to change the pin in ArducamSpi.cpp. The program stopped with the mycam.begin()
Here is the code :
#include <Arduino.h>
#include <SPI.h>
#include "Arducam_Mega.h" // Assurez-vous que ce fichier est accessible
#include "D:\Quentin\Documents\Arduino\libraries\Arducam_Mega\src\Arducam\ArducamCamera.h"
#define HSPI_MISO 3
#define HSPI_MOSI 8
#define HSPI_SCLK 16
#define HSPI_SS 9
Arducam_Mega myCAM(HSPI_SS); // Utilisez la broche CS que vous avez définie
void setup() {
Serial.begin(115200);
// Initialisation de HSPI pour la caméra Arducam
Serial.println("Initializing HSPI...");
SPI.begin(HSPI_SCLK, HSPI_MISO, HSPI_MOSI, HSPI_SS);
Serial.println("HSPI Started");
// Initialisation de la caméra
Serial.println("Initializing camera...");
CamStatus status = myCAM.begin();
if (status != CAM_ERR_SUCCESS) {
Serial.println("Failed to initialize camera!");
return;
}
Serial.println("Camera initialized.");
// Prendre une photo
Serial.println("Taking a picture...");
status = myCAM.takePicture(CAM_IMAGE_MODE_QVGA, CAM_IMAGE_PIX_FMT_JPG);
if (status != CAM_ERR_SUCCESS) {
Serial.println("Failed to take picture!");
return;
}
Serial.println("Picture taken.");
}
void loop() {
// Votre code ici
}
Do you know that SPI is a bus, so it can be used to connect a more than one slave device to the master mcu?
You don't need another set of SPI pins to connect a camera, use the same pins as for SD card
That will just put the standard SPI interface, which presumably the SD card is using, onto a different set of pins, so the the SD card probably wont work no more.
What happened when you ran the Camera and SD card on the same SPI pins ?
The real problem may be the different bus clock for both devices. This can be achieved by using device specific SPISettings (.SCK and .CS) for the actual device in SPI.beginTransaction().
AFAIR the ESP provides a different SPI object for each physical SPI but. Classes HSPI and VSPI?
ESP32-S3 4G LTE CAT1 V1.2.PDF (253,9 Ko)
Here is the schematic of the board. The pins are only access on the SD card mount. But I don't want to solder wire on the pad of the SD card mount.
I don't have the table. I need to check on the schematics to see the corresponding port.
But I know this pins:
For SD:
PIN_SD_CMD 11
PIN_SD_CLK 12
PIN_SD_D0 13
For GSM:
IO_RXD2 47
IO_TXD2 48
IO_GSM_PWRKEY 4
IO_GSM_RST 5