2018-10-08 02:30 AM
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.
2018-10-08 05:36 AM
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.
2018-10-09 05:06 PM
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?
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.
2018-10-09 07:53 PM
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.
2018-10-09 09:49 PM
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.