Author Topic: access to camera frames  (Read 2540 times)

SoftwareProjekt

  • Active Member
  • *
  • Posts: 5
access to camera frames
« on: July 19, 2017, 04:44:54 PM »
We are using a zynqberry board and a version 1.3 rasberry pi camera. We are trying to modify demo 1 2016.2. Demo generally works but we need access to single frames from the camera (csi input). How are data stored and how can we grab single frames? we thought there should be a framebuffer for camera input but there only is a frame buffer device for hdmi output (fb0).
Hope anyone can help us out.

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1987
Re: access to camera frames
« Reply #1 on: July 20, 2017, 08:12:49 AM »
Hi,

there are two frame buffer with same address space, see:

\te0726_m_demo1\os\petalinux\subsystems\linux\configs\device-tree\
Code: [Select]
// -- 512M (-02M modules) --
framebuffer0: framebuffer@0x1FC00000 {      // HDMI out
compatible = "simple-framebuffer";
// -- 512M (-02M modules) --
reg = <0x1FC00000 (1280 * 720 * 4)>;    // 720p
width = <1280>;     // 720p
height = <720>;     // 720p
stride = <(1280 * 4)>;     // 720p
format = "a8b8g8r8";
};

    framebuffer1: framebuffer@0x1F700000 {      // CAMERA in
        compatible = "simple-framebuffer";
        reg = <0x1F700000 (1280 * 720 * 4)>;    // 720p
        width = <1280>;                         // 720p
        height = <720>;                         // 720p
        stride = <(1280 * 4)>;                  // 720p
        format = "a8b8g8r8";
    };

FSBL is used to configure DMA Controller, but this can be done also with Linux application without driver. Check modified FSBL Code for details.

PS: 17.1 Demo is also available with camera Rev 2.1 support (currently not completely stable):

br
John

SoftwareProjekt

  • Active Member
  • *
  • Posts: 5
Re: access to camera frames
« Reply #2 on: July 21, 2017, 01:23:40 PM »
Hi, thank you for the reply.
As far as we understood we have defined two framebuffers in the device-tree:

framebuffer@0x1FC00000 (for HDMI out) and
framebuffer@0x1F700000 (for Camera in).

However in the demo only one framebuffer is activated, because of the configuration of the FSBL.
To get both framebuffers, we changed one line of code in fsbl_hook.c to:

Code: [Select]
//#define DIRECT_CAMERA_VIEW
Now we boot the zynqberry and perform:
# rpi-camera /dev/i2c-5
# reg 0x43C10040 1

Now with modified FSBL we do not get the camera image on HDMI (as expected I think), but there isn't a /dev/fb1 neither, so that we can not perform something like

# cat /dev/fb1 > /dev/fb0

We get the following error message from simple-framebuffer during boot:

Code: [Select]
simple-framebuffer 1fc00000.framebuffer: framebuffer at 0x1fc00000, 0x384000 bytes, mapped to 0x60400000
simple-framebuffer 1fc00000.framebuffer: format=a8b8g8r8, mode=1280x720x32, linelength=5120
simple-framebuffer 1fc00000.framebuffer: fb0: simplefb registered!
simple-framebuffer: probe of 1f700000.framebuffer failed with error -12

We then also made a single change in the petalinux project config:

Code: [Select]
SUBSYSTEM_MEMORY_PS7_DDR_0_BANKLESS_SIZE [=0x1F700000]
Which did not change anything. What are we missing/doing wrong?

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1987
Re: access to camera frames
« Reply #3 on: July 21, 2017, 01:55:07 PM »
Hi,

Demo 1,2 and 3 has same Block Design only some small changes on Framebuffer and petalinux.

Demo1 : DIRECT_CAMERA_VIEW must be defined
-> Camera stream is written into the same ddr address space like hdmi monitor read (on this demo this will be done simultaneity, no protection for write/read)
Demo 2 or 3 DIRECT_CAMERA_VIEW is commended
-> Camera stream and hdmi is other address space.
For Demo2  HDMI Frame buffer is used for Debian desktop
For Demo3   HDMI Frame buffer is used for videos

br
John