Pic time for OV2640 in JPEG/UXGA with USB connected

Hello all,

I use OV2640 cam in UXGA/JPEG mode on STM32F765 with firmware 3.5.3.

The time between pics is very high when usb is connected.
Even if frame view is desactivated in openmvide, or the test is only through uvc terminal.

Here is an test code :

import sensor, image, time, os,  pyb

total = 10

for i in range(total) :
   filename='temp/test_%d.jpg' % i
   try:
      os.stat(filename)
      os.remove(filename)
      print("%s is deleted" % filename)
   except OSError:
      print("%s does not exist" % filename)

sensor.reset()
sensor.set_pixformat(sensor.JPEG)
sensor.set_framesize(sensor.UXGA)

for i in range(total) :
   start = pyb.millis()
   filename='temp/test_%d.jpg' % i
   try:
      sensor.snapshot().save(filename)
      print('Record %d en %dms: %s' % ( i, pyb.elapsed_millis(start), filename) )
   except:
      print("Error of Record %d: %s" % (i, filename) )

print('photo record is finished')

Whatever i tried, the first image takes around 250ms, then goes around 3s.
If i run this code from sdcard without usb connected and take pictures of a stopwatch, the time between pics is around 250ms.

Thanks for help,

Update firmware?

Oh, it’s because of the SD card write. There’s no way to know how long writing to media takes.

It is the same problem without the SD card write.
it appears along time like 4- 5pics, and stabilize around 3s.

Yeah, the first image takes 250 ms because I reset the camera after you made the setup calls to it. It takes a while to start generating valid frames. You moved skip frames code I see. As for the speed of capture. I can’t say that UXGA mode with the OV2640 is really fast. I only got the driver technically working with that camera. I didn’t speed a lot of time optimizing it.

yes it is, if i dont have usb connected.
The time between pics is around 250ms at each time on pics, when i run main.py and record on sdcard without usb connection.
I will forward today to see if it is not uvc driver, a current limitation of usb2 or something else…