Giga R1: GC2145 Issues
Closed this issue · 3 comments
While playing with the cameras went back to the giga to test the GC2145 and found 1 minor issue and 1 major one.
Minor issue.
Need to add {0} at end of static const struct video_format_cap fmts[] list:
static const struct video_format_cap fmts[] = {
GC2145_VIDEO_FORMAT_CAP(RESOLUTION_QVGA_W, RESOLUTION_QVGA_H, VIDEO_PIX_FMT_RGB565),
GC2145_VIDEO_FORMAT_CAP(RESOLUTION_VGA_W, RESOLUTION_VGA_H, VIDEO_PIX_FMT_RGB565),
GC2145_VIDEO_FORMAT_CAP(RESOLUTION_UXGA_W, RESOLUTION_UXGA_H, VIDEO_PIX_FMT_RGB565),
GC2145_VIDEO_FORMAT_CAP(RESOLUTION_QVGA_W, RESOLUTION_QVGA_H, VIDEO_PIX_FMT_YUYV),
GC2145_VIDEO_FORMAT_CAP(RESOLUTION_VGA_W, RESOLUTION_VGA_H, VIDEO_PIX_FMT_YUYV),
GC2145_VIDEO_FORMAT_CAP(RESOLUTION_UXGA_W, RESOLUTION_UXGA_H, VIDEO_PIX_FMT_YUYV),
{0}
};
other wise if you try and do something like:
printf("\n- Capabilities:\n");
while (caps.format_caps[i].pixelformat) {
const struct video_format_cap *fcap = &caps.format_caps[i];
/* fourcc to string */
printf(" %c%c%c%c width [%u; %u; %u] height [%u; %u; %u]\n",
(char)fcap->pixelformat, (char)(fcap->pixelformat >> 8),
(char)(fcap->pixelformat >> 16), (char)(fcap->pixelformat >> 24),
fcap->width_min, fcap->width_max, fcap->width_step, fcap->height_min,
fcap->height_max, fcap->height_step);
i++;
}
the resulting output list is corrupted, i.e.
uart:~$ Video device: dcmi@48020000
- Capabilities:
RGBP width [[00:00:00.657,000] <inf> usb_cdc_acm: Device suspended
uart:~$ ; 0] height [240; 240; 0]
RGBP width [640; 640; 0] height [480; 480; 0]
RGBP width [1600; 1600; 0] height [1200; 1200; 0]
YUYV width [320; 320; 0] height [240; 240; 0]
YUYV width [640; 640; 0] height [480; 480; 0]
YUYV width [1600; 1600; 0] height [1200; 1200; 0]
width [1; 134640648; 47265] height [220; 1; 2053]
width [134603900; 1073872896; 587] height [134603012; 0; 1]
width [65537; 0; 929] height [0; 0; 2053]
width [1; 134615628; 384] height [11; 3853; 0]
▒ width [384; 4269; 384] height [384; 3885; 0]
M width [384; 3949; 384] height [384; 3437; 0]
▒ width [384; 4237; 384] height [384; 4301; 0]
▒ width [384; 134640886; 29991] height [134640900; 134640920; 2054]
3 width [134602428; 134602428; 57484] height [134602652; 134602660; 2053]
▒ width [134640976; 327681; 30038] height [134627103; 458754; 2054]
width [134619260; 589840; 30052] height [134640987; 524320; 2054]
@
width [134641007; 393344; 0] height [0; 0; 0]
- Current Video format: RGBP 320x240
- Supported frame intervals for the default format:
after the fix:
Video device: dcmi@48020000
- Capabilities:
RGBP width [[00:00:00.657,000] <inf> usb_cdc_acm: Device suspended
uart:~$ ; 0] height [240; 240; 0]
RGBP width [640; 640; 0] height [480; 480; 0]
RGBP width [1600; 1600; 0] height [1200; 1200; 0]
YUYV width [320; 320; 0] height [240; 240; 0]
YUYV width [640; 640; 0] height [480; 480; 0]
YUYV width [1600; 1600; 0] height [1200; 1200; 0]
- Current Video format: RGBP 320x240
- Supported frame intervals for the default format:
MAJOR ISSUE:
after rebuilding I am not seeing any images on in the visualizer just an empyt window. In Serial1.
Video device: dcmi@48020000
- Capabilities:
RGBP width [[00:00:00.657,000] <inf> usb_cdc_acm: Device suspended
uart:~$ ; 0] height [240; 240; 0]
RGBP width [640; 640; 0] height [480; 480; 0]
RGBP width [1600; 1600; 0] height [1200; 1200; 0]
YUYV width [320; 320; 0] height [240; 240; 0]
YUYV width [640; 640; 0] height [480; 480; 0]
YUYV width [1600; 1600; 0] height [1200; 1200; 0]
- Current Video format: RGBP 320x240
- Supported frame intervals for the default format:
[00:00:00.909,000] <inf> usb_cdc_acm: Device configured
[00:00:03.366,000] <wrn> video_stm32_dcmi: HAL_DCMI_ErrorCallback
once I get the <wrn> video_stm32_dcmi: HAL_DCMI_ErrorCallback data will not come out of the buffer and no images will get produced. This is with the stancard raw byte sketch
#include "camera.h"
Camera cam;
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(void) {
Serial.begin(115200);
if (!cam.begin(320, 240, CAMERA_RGB565)) {
fatal_error("Camera begin failed");
}
cam.setVerticalFlip(false);
cam.setHorizontalMirror(false);
Serial.println("Camera Started....");
}
void loop() {
FrameBuffer fb;
if (cam.grabFrame(fb)) {
if (Serial.read() == 1) {
Serial.write(fb.getBuffer(), fb.getBufferSize());
}
cam.releaseFrame(fb);
}
}
Quick update. Loaded @KurtE's test sketch
#include <elapsedMillis.h>
#include "camera.h"
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/video.h>
#include <zephyr/drivers/video-controls.h>
Camera cam;
elapsedMicros emFrame;
#define FRAME_RESTART_TIMEOUT_US 200000ul
uint8_t restart_count = 0;
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);
}
}
const struct device *vdev;
void setup(void) {
Serial.begin(115200);
while (!Serial && millis() < 5000) {}
if (!cam.begin(320, 240, CAMERA_RGB565)) {
fatal_error("Camera begin failed");
}
Serial.println("Camera Started....");
cam.setVerticalFlip(false);
cam.setHorizontalMirror(false);
vdev = DEVICE_DT_GET(DT_CHOSEN(zephyr_camera));
emFrame = 0;
}
void loop() {
FrameBuffer fb;
if (cam.grabFrame(fb)) {
Serial.println((uint32_t)emFrame);
if (Serial.read() == 1) {
Serial.write(fb.getBuffer(), fb.getBufferSize());
}
cam.releaseFrame(fb);
emFrame = 0;
} else if (emFrame > FRAME_RESTART_TIMEOUT_US) {
Serial.println("Timeout try restart");
if (!video_stream_start(vdev)) {
//if (!cam.begin(320, 240, CAMERA_RGB565)) {
fatal_error("Camera begin failed");
}
emFrame = 0;
}
}
and started to see frame data
Sometimes looks like this

and other times:

but notice seems to be out of synch
But even then still get the stop after a while
[00:01:41.772,000] <dbg> video_stm32_dcmi: HAL_DCMI_FrameEventCallback: Failed to get buffer from fifo
[00:01:41.840,000] <dbg> video_stm32_dcmi: HAL_DCMI_FrameEventCallback: Failed to get buffer from fifo
[00:01:41.884,000] <wrn> video_stm32_dcmi: HAL_DCMI_ErrorCallback
3/8/2025 Summary of Camera Issues on GIGA and H7
GC2145:
On the H7 will get several lines of spew and then the following error message:
[00:00:04.029,000] <wrn> video_stm32_dcmi: HAL_DCMI_ErrorCallback
at which point the sketch halts. Will get 1 descent frame after the message.
On the Giga sketch will spew
[00:00:03.669,000] <dbg> video_stm32_dcmi: HAL_DCMI_FrameEventCallback: Failed to get buffer from fifo
for a 1 or 2 seconds and then get the same [00:00:03.404,000] <wrn> video_stm32_dcmi: HAL_DCMI_ErrorCallback back message before the sketch halts. However in this case no images will be seen in the visualizer.
Note for both have tried increasing and lowering the clock with no luck.