FPSControl

From ElphelWiki
Jump to: navigation, search

Controlling FPS

Modes

The sensor has 2 operation modes:

  • Free Running
  • Triggered


Free Running Mode

In this mode you can achieve higher frame rate and exposures can overlap frames (while you are reading the current frame exposure of the next one already began). The maximum exposure this is basically 1/FPS.

In the free running mode the software can only adjust frame period by changing vertical and horizontal blanking. It is also possible to change the sensor clock frequency, but sensor "does not like" when the clock is adjusted while it is running and may hang.

Setup

There are 2 things that can prevent your custom FPS settings to work properly:

  • Too high resolution
  • autoexposure is enabled and your camera environment is too dark

Reduce Resolution

  1. Open up the Camera Control Interface (codename: camvc)
  2. Click the "Camera" icon (first on the left)
  3. Reduce the resolution (full frame will not give more than 10 fps in RGB mode) to 1280x720 for example by reducing the WOI (Windows of Interest).

Disable Autoexposure

  1. Also in the Camera Control Interface (codename: camvc) click the "Sun" icon (first slider under the WOI settings). You will notice that the slider will change from a triangle to a circle.
  2. Now you can move the slider. Set it to a value below 40 ms.

Settings FPS

  1. Open up the Parameter Editor (codename: autocampars).
  2. Check the "Streamer" Settings and click "View/Edit Current"
  3. Find the FP1000SLIM and FPSFLAGS parameters. Notice that if you hover over these parameters a tooltip will popup giving you an explanation of the particular parameter.
  4. Set the desired FPS x 1000 in the dec (decimal) field of FP1000SLIM. Lets say you want 25 frames per second. Write "25000" in the dec field of FP1000SLIM.
  5. Set the FPSFLAGS field to "1". This means "maintain fps (not lower than)". Don't forget to press the "Apply" button after changing the values in the fields.
  6. Go back to the Camera Control Interface (codename: camvc) and take a look at the fps indicator. If it did not change click the live image to the right of the settings. The Camera Control Interface has a time-out and stops to reload the live image if there is no activity in the interface. Clicking the live image will wake it up again.
  7. The fps indicator will show "24.989fps". To get higher FPS precision use the Triggered mode.

Triggered Mode

In triggered mode the minimal frame period is the frame readout time (same as the frame period in the free running mode) plus exposure time plus 8 extra lines (some sensor internal overhead). This can effectively reduces exposure time to less than 50% of 1/FPS.

On the other hand it is much more precise to set any required frame period in triggered mode than in free running - you can just specify the period in single pixel clock increments (as long as it is above the minimal for this image size and exposure, of course).

The camera supports both internal triggering (FPGA trigger generator) and external triggering (i.e. another camera).

More details on the own Trigger page.

Setup

  1. Open up the Parameter Editor (codename: autocampars).
  2. Check the "Camera trigger modes" Settings and click "View/Edit Current"
  3. Set TRIG_CONDITION = 0
  4. Set TRIG = 4
  5. Set the TRIG_PERIOD according to your desired FPS (96.000,000 / FPS). For our example of 25 FPS that will be 96.000,000 / 25 = 3840000
  6. Go back to the Camera Control Interface (codename: camvc) and take a look at the fps indicator. If it did not change drag the exposure time slider below 16. Now you should see an FPS of exactly 25.
Recovering from too long TRIG_PERIOD

If you set TRIG_PERIOD to something too long, camera may wait and wait... Refreshing the page will not help, at some point all 3 currently specified instances of PHP will be occupied and you'll not be able to open any PHP-based pages (i.e. Parameter Editor) anymore. To recover from that condition (without power-cycling the camera) you may telnet to the camera and run killall -9 lighttpd # - that will kill web server and all PHP instances, then restart them all.

That PHP restart still will not "unfreeze" the camera from waiting for the trigger thought, the driver responsible for changing the run time parameters is driven by the sensor frame sync interrupts, you may check the status of the camera/sensor by refreshing the http://192.168.0.9:8081/pointers page - it will work even when the main web server and PHP are busy. If frame number is not changing - the sensor is not being triggered. In that case you can open external trigger control page, set TRIG=0 and before applying change the value in "Program ahead" column from 3 to 0 - in that case the driver will not wait the frame sync interrupts before applying the parameter(s).

Summary


Free Running Mode Triggered Mode
max. FPS higher lower
max. Exposure Time 1 / FPS less than 1 / FPS
FPS precision low
high