Open
Description
Ran into a surpising while trying to display images on a ST7796 SPI display attached via SPI with a GC2145 camera on the mid-carrier board. Same sketch works on the GIGA without an issue.
PROBLEM: Display starts normally but camera fails to start with:
call cam.begin
Failed to set video format
Camera begin failed
which typically idicates as clock issue. Right now the GC2145 is set to 10Mhz.
Running camerarawbytes works with the visualizer anda the ST7796 using test sketches and does start and runs through its starting screens.
Not sure what the issue could be.
A simple sketch to test with
#include <ST77XX_zephyr.h>
#include "camera.h"
Camera cam;
#include <SPI.h>
#include <ST77XX_zephyr.h>
#include <ST77XX_zephyr_font_Arial.h>
#define TFT_CS 7 //10 // CS & DC can use pins 2, 6, 9, 10, 15, 20, 21, 22, 23
#define TFT_DC 6 //8 // but certain pairs must NOT be used: 2+10, 6+9, 20+23, 21+22
#define TFT_RST 5 //9 // RST can use any pin
#define CAMERA_WIDTH 320 //320
#define CAMERA_HEIGHT 240 // 240
// Use one or the other
//ST7735_zephyr tft = ST7735_zephyr(&SPI, TFT_CS, TFT_DC, TFT_RST);
// For 1.54" TFT with ST7789
//ST7789_zephyr tft = ST7789_zephyr(&SPI, TFT_CS, TFT_DC, TFT_RST);
// For 3.5" or 4.0" TFT with ST7796
ST7796_zephyr tft = ST7796_zephyr(&SPI, TFT_CS, TFT_DC, TFT_RST);
void fatal_error(const char *msg) {
Serial.println(msg);
pinMode(LED_BUILTIN, OUTPUT);
while (1) {
digitalWrite(LED_BUILTIN, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
delay(100);
}
}
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
while (!Serial && millis() < 5000) {}
Serial.println("\n*** start display camera image on ILI9341 ***");
// Use this initializer if you're using a 1.8" TFT 128x160 displays
//tft.initR(INITR_BLACKTAB);
// Or use this initializer (uncomment) if you're using a 1.44" TFT (128x128)
//tft.initR(INITR_144GREENTAB);
// Or use this initializer (uncomment) if you're using a .96" TFT(160x80)
//tft.initR(INITR_MINI160x80);
// Or use this initializer (uncomment) for Some 1.44" displays use different memory offsets
// Try it if yours is not working properly
// May need to tweek the offsets
//tft.setRowColStart(32,0);
// Or use this initializer (uncomment) if you're using a 1.54" 240x240 TFT
//tft.init(240, 240); // initialize a ST7789 chip, 240x240 pixels
// OR use this initializer (uncomment) if using a 2.0" 320x240 TFT:
//tft.init(240, 320); // Init ST7789 320x240
tft.init(320, 480);
tft.setRotation(1);
tft.fillScreen(ST77XX_BLACK);
delay(500);
tft.fillScreen(ST77XX_RED);
delay(500);
tft.fillScreen(ST77XX_GREEN);
delay(500);
tft.fillScreen(ST77XX_BLUE);
delay(500);
tft.fillScreen(ST77XX_BLACK);
delay(500);
Serial.println("call cam.begin");
if (!cam.begin(CAMERA_WIDTH, CAMERA_HEIGHT, CAMERA_RGB565, true)) {
fatal_error("Camera begin failed");
}
Serial.println("Camera started");
cam.setVerticalFlip(false);
cam.setHorizontalMirror(false);
}
void loop() {}
This uses @KurtE's ST7796 display library.
Any ideas?
Metadata
Metadata
Assignees
Labels
No labels