2026-04-20 5:42 AM
Dear all,
I have a working camera + video encoder solution running with LCD display disabled.
I have one preview thread that displays camera data on the LCD, this thread can be suspended and restarted. While the first run looks fine, the output has a green tint from the second start on:
First iteration:
Second+ iteration:
The code is quite straigh-forward, initializing the hw blocks as needed and freeing resources when it is stopped:
void ui_thread_func(ULONG arg)
{
while (1) {
run_ui();
// wait until being woken again:
tx_thread_suspend(&ui_thread);
}
}
#define FRAME_BASE 0x34050000
#define FRAME_SIZE ( 800 * 480 * 2 )
#define FRAME_0 (FRAME_BASE)
#define FRAME_1 (FRAME_BASE + (FRAME_SIZE))
static void run_ui()
{
/* Initialize camera */
if(BSP_CAMERA_Init(0, CAMERA_R2592x1944, CAMERA_PF_RAW_RGGB10) != BSP_ERROR_NONE){
Error_Handler();
}
/* start camera acquisition */
if(BSP_CAMERA_DoubleBufferStart(0, (uint8_t *)(FRAME_0),(uint8_t *)(FRAME_1), CAMERA_MODE_CONTINUOUS)!= BSP_ERROR_NONE){
Error_Handler();
}
/* Initialize LCD */
int err = BSP_LCD_InitEx(0, LCD_ORIENTATION_LANDSCAPE, LCD_PIXEL_FORMAT_RGB565, LCD_DEFAULT_WIDTH, LCD_DEFAULT_HEIGHT);
if(err){
printf("error initializing LCD : %d\n", err);
Error_Handler();
}
BSP_LCD_SetLayerAddress(0, 0, FRAME_0);
while (keep_ui_running) {
// TODO: introduce proper state handling.
if (!buf_index_changed) {
tx_thread_sleep(1);
continue;
}
/* new frame available */
buf_index_changed = 0;
if(BSP_CAMERA_BackgroundProcess() != BSP_ERROR_NONE)
{
Error_Handler();
}
}
/// free resources again:
BSP_CAMERA_Stop(0);
BSP_CAMERA_DeInit(0);
BSP_LCD_DeInit(0);
}I wrote the video stream to disk, it has the same green tint like the preview.
The ISP code is version 1.3.0. Any idea which parts of the ISP has not been re-initialized correctly or where else to look?
Simon