|
| 1 | +.. _video_capture-sample: |
| 2 | + |
| 3 | +Video Capture |
| 4 | +############# |
| 5 | + |
| 6 | +Description |
| 7 | +*********** |
| 8 | + |
| 9 | +This sample application uses the Video API to retrieve video frames from the |
| 10 | +video capture device, writes a frame count message to the console, and then |
| 11 | +discards the video frame data, and the captured image will be shown on the display |
| 12 | + |
| 13 | +Requirements |
| 14 | +************ |
| 15 | + |
| 16 | +This sample requires a video capture device (e.g. a camera). |
| 17 | + |
| 18 | +- :ref:`hpm6800evk` |
| 19 | +- `ov5640 camera(mipi csi) module`_ |
| 20 | +- `ov7725 camera(dvp) module`_ |
| 21 | + |
| 22 | +Wiring |
| 23 | +****** |
| 24 | + |
| 25 | +On :ref:`hpm6800evk`, if use DVP, the ov7725 camera module should be plugged in the |
| 26 | +J12 camera connector; if use MIPI CSI, the ov5640 camera module should be plugged in the Expansion Board J6 camera connector |
| 27 | + |
| 28 | +Building and Running |
| 29 | +******************** |
| 30 | + |
| 31 | +For :ref:`hpm6800evk`, build this sample application with the following commands: |
| 32 | + |
| 33 | +.. US DVP camera: |
| 34 | +.. zephyr-app-commands:: west build -p always -b hpm6800evk -S video_dvp samples/subsys/video/capture/ |
| 35 | + |
| 36 | +.. US MIPI CSI camera: |
| 37 | +.. zephyr-app-commands:: west build -p always -b hpm6800evk -S video_mipi samples/subsys/video/capture/ |
| 38 | + |
| 39 | +Sample Output |
| 40 | +============= |
| 41 | + |
| 42 | +on MIPI CSI: |
| 43 | + |
| 44 | +.. code-block:: console |
| 45 | +
|
| 46 | + mipi csi clk freq: 13813953 Hz |
| 47 | + [00:00:00.001,000] <inf> hpm_camera: hpmicro cam driver interface: mipi |
| 48 | +
|
| 49 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: interface: mipi-dsi |
| 50 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: mipi_base = 0xf1020000 |
| 51 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: mipi_phy_base = 0xf4140000 |
| 52 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: pixelmux_base = 0xf1034000 |
| 53 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: id = 0 |
| 54 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: lcdc info: |
| 55 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: id = 0 |
| 56 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: lcdc_base = 0xf1000000 |
| 57 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: pixelmux_base = 0xf1034000 |
| 58 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: panel info: |
| 59 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: panel_name = mc10128007 |
| 60 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: pixel_clock_khz = 60000 |
| 61 | + --- 1 messages dropped --- |
| 62 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: hactive = 800 |
| 63 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: hfront_porch = 52 |
| 64 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: hback_porch = 48 |
| 65 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: hsync_len = 8 |
| 66 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: vactive = 1280 |
| 67 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: vfront_porch = 15 |
| 68 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: vback_porch = 16 |
| 69 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: vsync_len = 6 |
| 70 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: hsync_pol = 0 |
| 71 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: vsync_pol = 0 |
| 72 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: de_pol = 0 |
| 73 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: pixel_clk_pol = 0 |
| 74 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: pixel_data_pol = 0 |
| 75 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: mipi_lane_num = 4 |
| 76 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: mipi_lane_speed = 500 |
| 77 | + [00:00:00.135,000] <dbg> display_hpm_mipi: hpm_display_init: mipi_cmd_len = 774 |
| 78 | + [00:00:00.135,000] <inf> display_hpm_mipi: pll clk : 594000 KHz |
| 79 | + [00:00:00.135,000] <inf> display_hpm_mipi: lcdc pixel clk : 59400 KHz |
| 80 | + [00:00:00.135,000] <inf> display_hpm_mipi: panel pixel clk: 60000 KHz |
| 81 | + [00:00:00.135,000] <dbg> display_hpm: hpm_display_gpio_init: mc10128007: gpio |
| 82 | + [00:00:00.135,000] <dbg> display_hpm: hpm_display_gpio_init: mc10128007: no cfg_gpio |
| 83 | + [00:00:00.135,000] <dbg> display_hpm: hpm_display_gpio_init: mc10128007: no backlight_gpio |
| 84 | + [00:00:00.276,000] <inf> display_hpm: mc10128007: alloc fb(addr, size): 0x4bb897c0, 4096000 |
| 85 | + *** Booting Zephyr OS build 36940db938a8 *** |
| 86 | + - Device name: video0 |
| 87 | + - Capabilities: |
| 88 | + RGBP width [1280; 1280; 0] height [720; 720; 0] |
| 89 | + YUYV width [1280; 1280; 0] height [720; 720; 0] |
| 90 | + RGBP width [640; 640; 0] height [480; 480; 0] |
| 91 | + YUYV width [640; 640; 0] height [480; 480; 0] |
| 92 | + - Default format: RGBP 640x480 |
| 93 | + Capture started |
| 94 | + Got frame 0! size: 1228800; timestamp 461 ms |
| 95 | + Got frame 1! size: 1228800; timestamp 493 ms |
| 96 | + Got frame 2! size: 1228800; timestamp 527 ms |
| 97 | + Got frame 3! size: 1228800; timestamp 560 ms |
| 98 | + Got frame 4! size: 1228800; timestamp 593 ms |
| 99 | + Got frame 5! size: 1228800; timestamp 660 ms |
| 100 | + Got frame 6! size: 1228800; timestamp 727 ms |
| 101 | + Got frame 7! size: 1228800; timestamp 760 ms |
| 102 | + Got frame 8! size: 1228800; timestamp 793 ms |
| 103 | + Got frame 9! size: 1228800; timestamp 860 ms |
| 104 | + Got frame 10! size: 1228800; timestamp 893 ms |
| 105 | + Got frame 11! size: 1228800; timestamp 927 ms |
| 106 | + Got frame 12! size: 1228800; timestamp 960 ms |
| 107 | + Got frame 13! size: 1228800; timestamp 993 ms |
| 108 | + Got frame 14! size: 1228800; timestamp 1027 ms |
| 109 | + Got frame 15! size: 1228800; timestamp 1060 ms |
| 110 | + Got frame 16! size: 1228800; timestamp 1093 ms |
| 111 | + Got frame 17! size: 1228800; timestamp 1126 ms |
| 112 | + Got frame 18! size: 1228800; timestamp 1160 ms |
| 113 | + Got frame 19! size: 1228800; timestamp 1193 ms |
| 114 | +
|
| 115 | + <repeats endlessly> |
| 116 | +
|
| 117 | +
|
| 118 | +on DVP: |
| 119 | + |
| 120 | +.. code-block:: console |
| 121 | +
|
| 122 | + [00:00:00.001,000] <inf> hpm_camera: hpmicro cam driver interface: dvp |
| 123 | +
|
| 124 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: interface: mipi-dsi |
| 125 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: mipi_base = 0xf1020000 |
| 126 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: mipi_phy_base = 0xf4140000 |
| 127 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: pixelmux_base = 0xf1034000 |
| 128 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: id = 0 |
| 129 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: lcdc info: |
| 130 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: id = 0 |
| 131 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: lcdc_base = 0xf1000000 |
| 132 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: pixelmux_base = 0xf1034000 |
| 133 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: panel info: |
| 134 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: panel_name = mc10128007 |
| 135 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: pixel_clock_khz = 60000 |
| 136 | + --- 1 messages dropped --- |
| 137 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: hactive = 800 |
| 138 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: hfront_porch = 52 |
| 139 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: hback_porch = 48 |
| 140 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: hsync_len = 8 |
| 141 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: vactive = 1280 |
| 142 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: vfront_porch = 15 |
| 143 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: vback_porch = 16 |
| 144 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: vsync_len = 6 |
| 145 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: hsync_pol = 0 |
| 146 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: vsync_pol = 0 |
| 147 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: de_pol = 0 |
| 148 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: pixel_clk_pol = 0 |
| 149 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: pixel_data_pol = 0 |
| 150 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: mipi_lane_num = 4 |
| 151 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: mipi_lane_speed = 500 |
| 152 | + [00:00:00.039,000] <dbg> display_hpm_mipi: hpm_display_init: mipi_cmd_len = 774 |
| 153 | + [00:00:00.039,000] <inf> display_hpm_mipi: pll clk : 594000 KHz |
| 154 | + [00:00:00.039,000] <inf> display_hpm_mipi: lcdc pixel clk : 59400 KHz |
| 155 | + [00:00:00.039,000] <inf> display_hpm_mipi: panel pixel clk: 60000 KHz |
| 156 | + [00:00:00.040,000] <dbg> display_hpm: hpm_display_gpio_init: mc10128007: gpio |
| 157 | + [00:00:00.040,000] <dbg> display_hpm: hpm_display_gpio_init: mc10128007: no cfg_gpio |
| 158 | + [00:00:00.040,000] <dbg> display_hpm: hpm_display_gpio_init: mc10128007: no backlight_gpio |
| 159 | + [00:00:00.180,000] <inf> display_hpm: mc10128007: alloc fb(addr, size): 0x4bb897c0, 2048000 |
| 160 | + *** Booting Zephyr OS build 36940db938a8 *** |
| 161 | + - Device name: video1 |
| 162 | + - Capabilities: |
| 163 | + RGBP width [640; 640; 0] height [480; 480; 0] |
| 164 | + - Default format: RGBP 640x480 |
| 165 | + Capture started |
| 166 | + Got frame 0! size: 614400; timestamp 255 ms |
| 167 | + Got frame 1! size: 614400; timestamp 300 ms |
| 168 | + Got frame 2! size: 614400; timestamp 322 ms |
| 169 | + Got frame 3! size: 614400; timestamp 344 ms |
| 170 | + Got frame 4! size: 614400; timestamp 367 ms |
| 171 | + Got frame 5! size: 614400; timestamp 389 ms |
| 172 | + Got frame 6! size: 614400; timestamp 411 ms |
| 173 | + Got frame 7! size: 614400; timestamp 433 ms |
| 174 | + Got frame 8! size: 614400; timestamp 455 ms |
| 175 | + Got frame 9! size: 614400; timestamp 477 ms |
| 176 | + Got frame 10! size: 614400; timestamp 500 ms |
| 177 | + Got frame 11! size: 614400; timestamp 522 ms |
| 178 | + Got frame 12! size: 614400; timestamp 545 ms |
| 179 | + Got frame 13! size: 614400; timestamp 566 ms |
| 180 | + Got frame 14! size: 614400; timestamp 589 ms |
| 181 | + Got frame 15! size: 614400; timestamp 611 ms |
| 182 | + Got frame 16! size: 614400; timestamp 633 ms |
| 183 | + Got frame 17! size: 614400; timestamp 655 ms |
| 184 | + Got frame 18! size: 614400; timestamp 678 ms |
| 185 | + Got frame 19! size: 614400; timestamp 699 ms |
| 186 | + Got frame 20! size: 614400; timestamp 722 ms |
| 187 | + Got frame 21! size: 614400; timestamp 744 ms |
| 188 | + Got frame 22! size: 614400; timestamp 766 ms |
| 189 | + Got frame 23! size: 614400; timestamp 788 ms |
| 190 | + Got frame 24! size: 614400; timestamp 811 ms |
| 191 | + Got frame 25! size: 614400; timestamp 833 ms |
| 192 | + Got frame 26! size: 614400; timestamp 855 ms |
| 193 | + Got frame 27! size: 614400; timestamp 877 ms |
| 194 | + Got frame 28! size: 614400; timestamp 900 ms |
| 195 | + Got frame 29! size: 614400; timestamp 922 ms |
| 196 | + Got frame 30! size: 614400; timestamp 944 ms |
| 197 | + Got frame 31! size: 614400; timestamp 966 ms |
| 198 | + Got frame 32! size: 614400; timestamp 989 ms |
| 199 | +
|
| 200 | +
|
| 201 | + <repeats endlessly> |
| 202 | +
|
| 203 | +References |
| 204 | +********** |
| 205 | + |
| 206 | +.. _MT9M114 camera module: https://www.onsemi.com/PowerSolutions/product.do?id=MT9M114 |
0 commit comments