SPI issues with constant capture

1.Which seller did you purchase the product(s) from?
Amazon
2.The Model number of the product(s) you have purchased?
OV5642
3.Which Platform are you using the product(s) on?
Arduino\Teensy
4.Which instruction are you following?
Library
5.Has your product ever worked properly?
Yes
6.What problems are you experiencing?
I am attempting to send a constant stream of JPEGs to a PC. I have the data path working and am able to pipe JPEGs into MATLAB via ethernet.

I need to get high thoughput and low latency, so I begin reading the FIFO before the capture is complete. I can find the end of the JPG from the delimiter characters.

However, I am having trouble all of the ways I’m trying to do that:

  1. If I set FRAMES_NUM to 0x00, I can read a frame over SPI. If I try to capture another one, only 0x00 is returned. If I wait ~3seconds before re-initiating the capture, it works. This is too slow though.

  2. If I set FRAMES_NUM to 0xFF, I can see the frames arriving in series, but after some time the data stream goes to 0x00. Also, when I try to re-initiate capture, it fails. From the failing state, if I attempt to re-initiate the camera, it fails with the message that SPI is not working.

  3. If I set FRAMES_NUM to 0x0N, I can see a stream of frames that also, goes to 0x00 after some time.

I am reading SPI using DMA in 500 byte chunks. I can see when I’m reading too fast when the data stream goes to 0xCC. Slowing down the read rate does not solve the issue.

Questions:

  1. It seems that SPI is messing up. Is there a reset command I can send to reset it?

  2. Why might reading multiple frams from the FIFO work and then not work within the same capture?

  3. How I can I quickly re-init captures to avoid stutters in the JPEG stream?

  4. Is it possible to get the unit to continuously capture without re-initializing as long as I keep up reading from SPI?

 

 

 

I am able execute a single capture. However, the second
7.What attempts at troubleshooting have you already made?
Many
8.How would you like us to help you?
Question answers.

Hi,

1.The SPI does not need to be reset, and there will be no problems after normal power-on initialization. If you want to transfer faster, you can increase the SPI speed.

2.The process of SPI camera to capture multiple images is: send a photo command, CPLD starts to capture the specified number of images (set by FRAMES_NUM), after the capture is over, set the photo end command.
At this time, the image is read from the FIFO, if one is set to capture, then one is read, and if multiple images are set to be captured, then multiple images are read continuously. Therefore, it is wrong to read directly from the FIFO before receiving the camera command.

3.The capture speed is determined on the one hand by the frame rate of the sensor itself, and on the other hand by the transmission speed of the SPI. You can reduce the resolution to increase the frame rate or increase the SPI speed, but too high SPI speed may be unstable.

4.You can initialize the camera only once, but before each reading, you must set to take a picture and wait for the picture to be finished.

 

I’m still having troubling behavior.

  1. If I set FRAMES_NUM to 0x00, it takes over a second for the capture done flag to be set. This is for a 320x240 image…so this is a very long time for the flag to be set.

2.If I set FRAMES_NUM to 0xNN, it appears to take about NN-1 times as long for the capture to complete. So…still a very long time.

  1. If I set FRAMES_NUM to 0xFF, I’m assuming the capture complete flag will eventually be set, but I never waited this long.

So…it seems like there are static delays set in the capture code somewhere. What can I do to speed up the effective frame rate?

Hi,

If you set FRAMES_NUM to OXFF, it will capture done until the FIFO(8M bytes) is full, so it will comsume much time.

As I said in my last reply, the speed at which the photo is completed is related to multiple reasons, or you can also try a small resolution setting.