Technical Application Notes
Click an item to read from the list below.

Technical Application Notes


 

 

Storing Data in On-Camera Flash Memory

Storing Data in On-Camera Flash Memory
Technical Application Note TAN2009004
Revised September 1, 2016

 

Subject

Technical Application Note (TAN2009004): Storing Data in On-Camera Flash Memory

10386

Applicable Product(s)

  • Bumblebee BB2 and BBX3
  • Blackfly BFLY
  • Blackfly S BFS
  • Chameleon CMLN
  • Chameleon3 CM3
  • Cricket CR
  • Dragonfly2 DR2
  • Firefly MV FFMV and FMVU
  • Flea FLEA
  • Flea2 FL2 and FL2G
  • Flea3 FL3-FW, FL3-GE and FL3-U3
  • Gazelle GZL
  • Grasshopper GRAS
  • Grasshopper2 GS2-FW and GS2-GE
  • Grasshopper3 GS3-U3 and GS3-PGE
  • Grasshopper Express GX
  • Ladybug3 LD3
  • Ladybug5 LD5
  • Zebra2 ZBR2

 

Application Note Description

The Applicable Product(s) provide the user with flash memory on-board the camera for the purposes of non-volatile data storage. This Technical Application Note explains what flash memory is and provides an example of using flash memory to store image data.

 

Overview of Flash Memory

The flash memory available on the Applicable Product(s) provides users with non-volatile data storage, which is useful for saving data such as calibration files, software license keys, or images. This data will not be erased when the camera is disconnected from power. The following table shows the amount of memory available by camera model.


Table 1: Storage space by camera family

Camera Model

Memory Size

Method for Accessing

BB2/BBX3

512 KB

Camera registers

BFLY

512 KB

Camera registers

BFS

6 MB

File access control

CMLN

256 KB

Image storing utility

CM3

1 MB

Camera registers

CR

2 Images

Snapshot

DR2

512 KB

Camera registers

FFMV/FMVU

256 KB

Image storing utility

FLEA

256 KB

Image storing utility

FL2

256 KB

Image storing utility

FL2G

512 KB

Camera registers

FL3

1 MB

Camera registers

GZL

4 MB

Serial Port Access

GRAS

512 KB

Camera registers

GS2

512 KB

Camera registers

GS3

2 MB

Camera registers

GX

1 MB

Camera registers

LD3

512 KB

Camera registers

LD5

1 MB

Camera registers

ZBR2

1 MB

Camera registers

 

Writing Data to Flash Memory

There are four mechanisms available for users to write data to flash memory.

  • Accessing the DATA_FLASH_CTRL and DATA_FLASH_DATA camera registers.  This mechanism is available on the Camera Models listed above with 512 KB or 1 MB of memory.
  • Using the PGR_Save_Read_Compressed_Images.exe tool for writing to flash memory. This mechanism is available for the Camera Models listed above with 256 KB of memory, and is used for storing images only.
  • Using serial port access. This mechanism is available for Gazelle only.
  • Using snapshot function. This mechanism is available for Cricket only.

Using Camera Registers

The DATA_FLASH_CTRL and DATA_FLASH_DATA camera registers are available on the Camera Models listed in Table 1 above with 512 KB or 1 MB of memory. The following sections provide a description of these registers. Addresses are offsets from the IEEE-1394 base address.

For an example of how to apply these registers using the FlyCapture API, refer to the SaveImageToFlashEx sample program included with the FlyCapture SDK. For more information on Point Grey camera Control and Status Registers, consult the Point Grey Digital Camera Register Reference.

DATA_FLASH_CTRL Register 1240h

This register controls access to the camera’s on-board flash memory. Each bit in the data flash is initially set to 1.

The user can transfer as much data as necessary to the offset address (1244h), then perform a single write to the control register to commit the data to flash. Any modified data is committed by writing to this register, or by accessing any other control register.

Format:

Field

Bit

Description

Presence_Inq

[0]

Presence of this feature
0: Not Available, 1: Available

 

[1-5]

Reserved

Clean_Page

[6]

Read:
1: Page is clean
0: Page is dirty

Write:
1: Write page to data flash
0: No-op

 

[7]

Reserved

Page_Size

[8-19]

8 == 256 byte page
9 == 512 byte page

Num_Pages

[20-31]

11 == 2048 pages
13 == 8192 pages

DATA_FLASH_DATA Register 1244h

This register provides the 32-bit offset to the start of where the data is stored in the flash memory.

Format:

Field

Bit

Description

DF_Data

[0-31]

32-bit offset to the start of data

Using the Image Storing Utility

The PGR_Save_Read_Compressed_Images.exe is a simple command prompt utility. It is used with the Camera Models listed in Table 1 above with 256 KB of memory, but only for storing image data. If you require assistance with this tool, please contact mv-support@flir.com.

Using Serial Port Access (Gazelle Only)

The camera has 4 MB of non-volatile memory for users to store data. Data must be written to individual pages in 528-byte data chunks.

To get the size of the flash memory on the camera:

Read syntax: dfi
This command returns the following, in order:

  • Total size of flash memory
  • number of pages
  • page size

To write data to flash memory:

Write syntax: dfw page_number num_bytes ASCII_string
page_number can be specified from 0 to 8191
num_bytes can be specified from 0 to 527

If the size of ASCII_string is more than 528 bytes, it is cut to 528 to fit the page size.

To read a page of flash memory:

Read syntax: dfr page_number
page_number can be specified from 0 to 8191

To clear individual pages of flash memory:

Write syntax: dfw page_number 0 0
page_number can be specified from 0 to 8191

To clear all pages of flash memory:

Write syntax: dfclear

Using Snapshot (Cricket Only)

The camera is capable of storing the most recent image from each stream as a snapshot. This is saved on board the camera and retrievable even after a power cycle. The images are stored permanently, until the user chooses to store a new one.
To take a snapshot

  1. Ensure the Cricket has powered up and is connected to the network.
  2. In your web browser, enter https://<IP Address>.
  3. Enter your user name and password and click the Log in button.
  4. On the Home page, click the Snapshot button for the stream. The snapshot image appears in a popup window of the browser.

To retrieve a snapshot
The snapshot is retrievable from:

  • Stream 1— https://<IP Address>/snapshot-1.jpg
  • Stream 2—https://<IP Address>/snapshot-2.jpg

For more detailed information on using the Cricket, including how to determine the IP Address, see the Cricket Technical Reference.

 

Using File Access Control (Blackfly S Only)

The camera is capable of storing files through the File Access control feature of GenICam. This is available using the SpinView application provided by the Spinnaker SDK (available from the Point Grey Downloads page). A separate Camera Imaging utility is available from support for users who wish to use a command line tool for this purpose.

Note: This feature is available on firmware 1607.1.5.11 and later. You may have to update your firmware.

To save a file

  1. Connect the camera to the PC.
  2. Launch the SpinView application.
  3. Select the camera from the Devices list.
  4. Start acquisition.
  5. From the Display pane, save a file to disk.

To upload a file to the camera

  1. In SpinView, on the Features pane, click the File Access tab.
  2. From the Camera File Access drop-down, select UserFile1.
  3. Click Upload.
  4. Select the file saved to disk in the steps above.
  5. Click OK.

To retrieve a file from the camera

  1. In SpinView, on the Features pane, click the File Access tab.
  2. From the Camera File Access drop-down, select UserFile1.
  3. Click Download.


Storing Images in Flash Memory

Some degree of JPEG compression is generally required to store images in flash memory, depending on the number of images being stored and the amount of memory available (as noted in Table 1 above). The following table shows the number of images, captured in a sample of standard resolutions that can be stored in flash memory. The table assumes a JPEG compression rate of 1/20 original size and an 8-bit pixel format.

Note:  Not all megapixels/resolutions are available on all cameras. This section does not apply to Cricket. The Cricket camera stores 2 images only.

 

MP

Maximum Resolution

Number of Images Stored

256 KB

512 KB

1 MB

2 MB

4 MB

6 MB

0.3

640x480

17

33

65

130

260

391

0.5

808x608

10

21

41

81

163

244

0.8

1024x768

7

13

25

51

102

153

0.9

1288x728

5

11

21

43

85

128

1.0

1024x1024

5

10

19

38

76

114

1.2

1280x960

4

8

16

33

65

98/p>

1.3

1280x960

4

8

16

33

65

98

1.4

1384x1036

4

7

14

28

56

84

2.0

1624x1224

3

5

10

20

40

60

2.2

2048x1088

2

5

9

18

36

54

2.3

1920x1200

2

4

9

17

35

52

2.8

1932x1452

2

4

7

14

29

43

3.2

2080x1552

2

3

6

12

25

37

4.1

2048x2048

1

2

5

10

19

29

5.0

2448x2048

1

2

4

8

16

24

6.0

2736x2192

1

2

3

7

13

20

8.8

4096x2160

1

1

2

5

9

14

9.1

3376x2704

1

1

2

4

9

13