cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F769I EVAL: Why camera stop streaming when creating a JPEG file into SD card?

mthanh2602
Associate II

Hello everyone.

Sorry for post this question again. But I really need some help.

I am trying to write a program can take picture from camera and save it into SD card when I press a button.

I had finish this, but it had one problem. I don't know why but the program stop after created one picture into SD card.

I had found the cause is because "f_open" command. I try to run program like this below.

..........

..........

Start camera and display on LCD---

loop{

->wait for the button was pressed.

if(FATFS_LinkDriver(&SD_Driver, SDPath) == 0)    {

    if(f_mount(&SDFatFs, (TCHAR const*)SDPath, 0) == FR_OK)    {

    f_open(&JPEG_File, "image.jpg", FA_WRITE || FA_CREATE_ALWAYS);

    f_close(&JPEG_File);

  }

 }

} (end loop)

The camera stop even I didn't do anything. Just creating JPEG file and closing it.

Trying to understand the f_open() function, I think it's related to the line "stat = disk.drv[pdrv]->disk_initialize(disk.lun[pdrv]);" into the function disk_initialize() of diskio.c.

When I ignore this line, camera didn't stop. But I still really don't understand what happened.

Anyone know about this problems, please tell me. Why the camera is stop when I create JPEG file, and what should I do for dealing with this problem.

Sorry for my English. Thanks so much.

4 REPLIES 4
AvaTar
Lead

I don't know much about the inner working of your firmware.

But I guess the camery seems to stop because you miss interrupts and associated streaming packets.

Perhaps your SDIO interrupts (SD access) are on the same interrupt level, blocking the camera input.

mthanh2602
Associate II

Thanks Avatar. I really appreciate your help.

I had set dma stream1 for DCMI to highest priority. But it's still stop. But I have some confusing about what is interrupt? Are these below an interrupt?

  1. --> void JPEG_IRQHandler(void)
  2. --> void DMA2_Stream1_IRQHandler(void)

I will find out about SDIO interrupt.

Actually my purpose is writing a program could save a video (MJPEG) from camera into SD card (or USB). And I think the first thing that I have done is learning how to save JPEG picture already. I didn't research how to save MJPEG video yet. Maybe I should move on this problem and try to understand about MJPEG.

You should track what errors specifically come out of FATFS, and ideally instrument DISKIO so you can isolate failures/errors there. This is the only way to pin errors/bugs down effectively.

On the F7 it is also strongly advisable to use DMA for SDIO/SDMMC as the polled method is highly sensitive to bus and interrupt loading.

Can't say I've had cause to use the JPEG unit, but there is typically an interrupt for the peripheral to flag completion, progress or status. On the DMA side you typically have HT/TC interrupts to manage ping-pong buffering and allow for processing of the inactive half, or if there is an error of some kind.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mthanh2602
Associate II

Dear Clive Two.Zero. Many thank for your answer.

It's hard a bit for a newbie like me to understand what you said. I'll research about it.