
Code: Select all
pi@raspberrypi2B:~/raspiraw/t $ rm /dev/shm/out.0*
pi@raspberrypi2B:~/raspiraw/t $ raspiraw -md 7 -t 2000 -sr 1 -o /dev/shm/out.%04d.raw 2>/dev/null >/dev/null
pi@raspberrypi2B:~/raspiraw/t $ ls -l /dev/shm/out* | wc
241 2169 14701
pi@raspberrypi2B:~/raspiraw/t $
Code: Select all
struct sensor_regs imx219_mode7[] =
{
{0x0100, 0x00},
{0x30eb, 0x05},
{0x30eb, 0x0c},
{0x300a, 0xff},
{0x300b, 0xff},
{0x30eb, 0x05},
{0x30eb, 0x09},
{0x0114, 0x01},
{0x0128, 0x00},
{0x012a, 0x18},
{0x012b, 0x00},
{0x0157, 0x00},
{0x015a, 0x01},
{0x015b, 0x85},
{0x0160, 0x01},
{0x0161, 0x89},
{0x0162, 0x0d},
{0x0163, 0xe8},
{0x0164, 0x03},
{0x0165, 0xe8},
{0x0166, 0x08},
{0x0167, 0xe7},
{0x0168, 0x02},
{0x0169, 0xf0},
{0x016a, 0x06},
{0x016b, 0xaf},
{0x016c, 0x02},
{0x016d, 0x80},
{0x016e, 0x01},
{0x016f, 0xe0},
{0x0170, 0x01},
{0x0171, 0x01},
{0x0174, 0x03},
{0x0175, 0x03},
{0x018c, 0x0a},
{0x018d, 0x0a},
{0x0301, 0x05},
{0x0303, 0x01},
{0x0304, 0x03},
{0x0305, 0x03},
{0x0306, 0x00},
{0x0307, 0x39},
{0x0309, 0x0a},
{0x030b, 0x01},
{0x030c, 0x00},
{0x030d, 0x72},
{0x455e, 0x00},
{0x471e, 0x4b},
{0x4767, 0x0f},
{0x4750, 0x14},
{0x4540, 0x00},
{0x47b4, 0x14},
{0x4713, 0x30},
{0x478b, 0x10},
{0x478f, 0x10},
{0x4793, 0x10},
{0x4797, 0x0e},
{0x479b, 0x0e},
{0x0172, 0x03},
{0x0160, 0x01},
{0x0161, 0xaa},
{0x0162, 0x0d},
{0x0163, 0xe7},
{0x015a, 0x00},
{0x015b, 0x2f},
{0x0157, 0x00},
{0x0157, 0x00},
{0x0160, 0x01},
{0x0161, 0xaa},
{0x0162, 0x0d},
{0x0163, 0xe7},
{0x015a, 0x00},
{0x015b, 0x2f},
{0x0100, 0x01},
};
Code: Select all
pi@raspberrypi2B:~/raspiraw $ git diff
diff --git a/imx219_modes.h b/imx219_modes.h
index caa0122..9417730 100644
--- a/imx219_modes.h
+++ b/imx219_modes.h
@@ -503,6 +503,7 @@ struct sensor_regs imx219_mode6[] =
{0x0100, 0x01},
};
+
struct sensor_regs imx219_mode7[] =
{
{0x0100, 0x00},
@@ -516,6 +517,13 @@ struct sensor_regs imx219_mode7[] =
{0x0128, 0x00},
{0x012a, 0x18},
{0x012b, 0x00},
+ {0x0157, 0x00},
+ {0x015a, 0x01},
+ {0x015b, 0x85},
+ {0x0160, 0x01},
+ {0x0161, 0x89},
+ {0x0162, 0x0d},
+ {0x0163, 0xe8},
{0x0164, 0x03},
{0x0165, 0xe8},
{0x0166, 0x08},
@@ -557,9 +565,16 @@ struct sensor_regs imx219_mode7[] =
{0x4797, 0x0e},
{0x479b, 0x0e},
{0x0172, 0x03},
+ {0x0160, 0x01},
+ {0x0161, 0xaa},
+ {0x0162, 0x0d},
+ {0x0163, 0xe7},
+ {0x015a, 0x00},
+ {0x015b, 0x2f},
{0x0157, 0x00},
- {0x0160, 0x02},
- {0x0161, 0x39},
+ {0x0157, 0x00},
+ {0x0160, 0x01},
+ {0x0161, 0xaa},
{0x0162, 0x0d},
{0x0163, 0xe7},
{0x015a, 0x00},
pi@raspberrypi2B:~/raspiraw $

I'm intending to get the fps stuff merged in the next couple of days, so I'm not that fussed about bumping up the frame rate to 120fps.
Yes, please note https://github.com/6by9/raspiraw/commit ... 4a8a0fee84HermannSW wrote:I just looked, this is the diff from 120fps to current master branch 90fps mode7:

Code: Select all
pi@raspberrypi2B:~/raspiraw $ raspistill -v 2>&1 | grep Width
Width 3280, Height 2464, quality 85, filename (null)
pi@raspberrypi2B:~/raspiraw $ camera_i2c
setting GPIO for board revsion: a01041
A+, B+, and B2 all revisions - I2C 0 on GPIOs 28 & 29. GPIOs 32 & 41 for LED and power
pi@raspberrypi2B:~/raspiraw $
Code: Select all
pi@raspberrypi2B:~/raspiraw $ 1920x1080 1200
removing /dev/shm/out.*.raw
capturing frames for 1200ms with 30fps requested
36 frames were captured at 30fps
frame delta time[us] distribution
1
31 33327
4 33328
after skip frame indices (middle column)
0% frame skips
pi@raspberrypi2B:~/raspiraw $
Code: Select all
pi@raspberrypi2B:~/raspiraw $ 1640x1232 1200
removing /dev/shm/out.*.raw
capturing frames for 1200ms with 40fps requested
47 frames were captured at 40fps
frame delta time[us] distribution
1
19 24990
27 24991
after skip frame indices (middle column)
0% frame skips
pi@raspberrypi2B:~/raspiraw $
Code: Select all
pi@raspberrypi2B:~/raspiraw $ 1640x922 1200
removing /dev/shm/out.*.raw
capturing frames for 1200ms with 40fps requested
48 frames were captured at 40fps
frame delta time[us] distribution
1
19 24990
28 24991
after skip frame indices (middle column)
0% frame skips
pi@raspberrypi2B:~/raspiraw $
Code: Select all
pi@raspberrypi2B:~/raspiraw $ 1280x720 1200
removing /dev/shm/out.*.raw
capturing frames for 1200ms with 90fps requested
108 frames were captured at 90fps
frame delta time[us] distribution
1
43 11080
64 11081
after skip frame indices (middle column)
0% frame skips
pi@raspberrypi2B:~/raspiraw $
Code: Select all
pi@raspberrypi2B:~/raspiraw $ 3280x2464 1200
removing /dev/shm/out.*.raw
capturing frames for 1200ms with 15fps requested
18 frames were captured at 15fps
frame delta time[us] distribution
1
13 66654
4 66655
after skip frame indices (middle column)
0% frame skips
pi@raspberrypi2B:~/raspiraw $
Code: Select all
pi@raspberrypi2B:~/raspiraw $ 640x480 1200
removing /dev/shm/out.*.raw
capturing frames for 1200ms with 90fps requested
108 frames were captured at 90fps
frame delta time[us] distribution
1
43 11080
64 11081
after skip frame indices (middle column)
0% frame skips
pi@raspberrypi2B:~/raspiraw $

Code: Select all
pi@raspberrypi01:~/raspiraw/t $ ./320x240 1200
removing /dev/shm/out.*.raw
capturing frames for 1200ms with 180fps requested
216 frames were captured at 180fps
frame delta time[us] distribution
1
2 5544
109 5545
103 5546
1 5547
after skip frame indices (middle column)
0% frame skips
pi@raspberrypi01:~/raspiraw/t $Code: Select all
raspiraw -md 7 -t $1 -ts tstamps.csv -b 8 -hd0 hd0.32k --height 240 --width 320 --top 0 --left 0 --vinc 1F --hinc F1 --fps $fps -sr 1 -o /dev/shm/out.%04d.raw #2>/dev/null >/dev/null
Code: Select all
$ cat <(echo -e "P5\n320 240\n255") /dev/shm/out.0201.raw > out.0201.pgm
$






raspiraw pretty much exposes everything that the peripheral can do - it is pretty much only converting the incoming CSI2 bitstream into parallel data and writing it to memory.PierreG wrote: ↑Wed Jan 24, 2018 9:38 amHi,
I made some progress about interfacing imx sensor (224) with Rpi3.
I'm pretty sure to correctly set register in mode quadVGA (1280x960 30fps 12bit) with Bayer order GBRG. And give the right image_id=0x2C, data_lanes=2 and native_bit_depth=12 to raspiraw.
I put this test pattern picture in front of the camera :
but I got strange and half left cropped image :
Maybe the GPU decoding process is not correctly configure. Is they any others parameters to set that is not accessible in raspiraw.c ?
Code: Select all
$ 640x480 3000 300
removing /dev/shm/out.*.raw
capturing frames for 3000ms with 300fps requested
905 frames were captured at 302fps
frame delta time[us] distribution
1
407 3310
497 3311
after skip frame indices (middle column)
0% frame skips
$
Code: Select all
$ 640x480 3000 300
removing /dev/shm/out.*.raw
capturing frames for 3000ms with 300fps requested
904 frames were captured at 302fps
frame delta time[us] distribution
1
1 3309
406 3310
494 3311
1 3312
1 6622
after skip frame indices (middle column)
> 6622,179,7252080515
0% frame skips
$
Code: Select all
$ for((i=1; i<=10; ++i)); do 640x480 3000 300; done | grep "^> " | wc --lines
83
$
$ for((i=1; i<=10; ++i)); do 640x480 3000 240; done | grep "^> " | wc --lines
0
$
Code: Select all
$ 640x480 4800 240 | tail -n +6
3 4146
116 4147
1006 4148
30 4149
after skip frame indices (middle column)
0% frame skips
$
$ df /dev/shm
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 448400 434656 13744 97% /dev/shm
$


Code: Select all
$ 640x480 1000 240
removing /dev/shm/out.*.raw
capturing frames for 1000ms with 240fps requested
240 frames were captured at 241fps
frame delta time[us] distribution
1
19 4147
220 4148
after skip frame indices (middle column)
0% frame skips
$ Code: Select all
$ raw2ogg2anim t 1 240 25
removing old auxiliary files
copying /dev/shm/out.????.raw files
240
dcraw each .raw file (to .ppm)
out.0240.raw
.ppm -> .ppm.d
out.0240.ppm
.ppm.d -> .ppm.d.png
out.0240.ppm.d
now creating t.ogg
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:01:57.853761644
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
now creating t.anim.gif
[theora @ 0xcbc7a0] 7 bits left in packet 82
[ogg @ 0xcbb570] Broken file, keyframe not correctly marked.
[theora @ 0xd64cf0] 7 bits left in packet 82
[ogg @ 0xcbb570] Broken file, keyframe not correctly marked.
Last message repeated 2 times
[Parsed_palettegen_2 @ 0xceb650] Dupped color: FF00CF5F
[Parsed_palettegen_2 @ 0xceb650] Dupped color: FF00E172
[Parsed_palettegen_2 @ 0xceb650] Dupped color: FF00FFA1
[Parsed_palettegen_2 @ 0xceb650] Dupped color: FF00FFBB
[theora @ 0x14a3830] 7 bits left in packet 82
[ogg @ 0x14a26b0] Broken file, keyframe not correctly marked.
[theora @ 0x155b190] 7 bits left in packet 82
[ogg @ 0x14a26b0] Broken file, keyframe not correctly marked.
Last message repeated 2 times
done
$

Hi,bbocksta wrote: ↑Fri Jan 26, 2018 6:28 am@HerrmannSW: If you are talking about lost Frames, do you mean the difference between the theoretically possible and the reality?
For example: You shoot 2 seconds with 30fps. Theoretically there should be 60frames, but only 40 frames got saved. So there would
be 20 lost frames, am i right?
Code: Select all
after skip frame indices (middle column)
> 6622,179,7252080515
0% frame skips
$ Code: Select all
$ 640x480 3000 300
removing /dev/shm/out.*.raw
capturing frames for 3000ms with 300fps requested
904 frames were captured at 302fps
frame delta time[us] distribution
1
1 3309
406 3310
494 3311
1 3312
1 6622
Code: Select all
pi@raspberrypi2B:~/raspiraw/t $ 1280x720 2000
removing /dev/shm/out.*.raw
capturing frames for 2000ms with 90fps requested
180 frames were captured at 90fps
frame delta time[us] distribution
1
1 11077
3 11078
13 11079
59 11080
82 11081
16 11082
4 11083
1 11084
after skip frame indices (middle column)
0% frame skips
pi@raspberrypi2B:~/raspiraw/t $
Please use "-o /dev/shm/test.%03d.raw" instead of "-o test.%03d.raw", then you will see much better results.

It turned out that --height worked partially because it did set sensor mode height field.HermannSW wrote: ↑Wed Jan 24, 2018 9:45 pmOutlook:
v2 camera can capture full 640x480 at 240fps.
Y_ODD_INC_A of imx219 has 3 bits only [2:0] according datasheet (ov5647 has 4 bits).
But that should allow to capture 640x240 at 480fps and 640x120 at 960fps in theory.
On ov5647 doubling fps for 640x240 and then 640x120 was true (90->180->360).
Now need to implement "--height" raspiraw option for imx219 to test that out ...
Code: Select all
$ diff 4 5
1c1
< struct sensor_regs imx219_mode4[] =
---
> struct sensor_regs imx219_mode5[] =
18,21c18,21
< {0x0168, 0x00},
< {0x0169, 0x00},
< {0x016a, 0x09},
< {0x016b, 0x9f},
---
> {0x0168, 0x01},
> {0x0169, 0x36},
> {0x016a, 0x08},
> {0x016b, 0x69},
24,25c24,25
< {0x016e, 0x04},
< {0x016f, 0xd0},
---
> {0x016e, 0x03},
> {0x016f, 0x9a},
54d53
<
$Code: Select all
$ diff 640x240 640x120
10c10
< raspiraw -md 7 -t $1 -ts tstamps.csv -hd0 hd0.32k --height 240 --top 0 --vinc 17 --regs "0168,000004CF;016E,00F0" --fps $fps -sr 1 -o /dev/shm/out.%04d.raw 2>/dev/null >/dev/null
---
> raspiraw -md 7 -t $1 -ts tstamps.csv -hd0 hd0.32k --height 120 --top 0 --vinc 17 --regs "016A,0267;016E,0078" --fps $fps -sr 1 -o /dev/shm/out.%04d.raw 2>/dev/null >/dev/null
$Code: Select all
$ for((i=1; i<=10; ++i)); do ./640x240 4000 360; done | grep "^>"
> 5530,712,4687115344
> 5531,741,4696851379
$Code: Select all
$ for((i=1; i<=10; ++i)); do ./640x120 4000 450; done | grep "^>"
> 4401,2,4541050630
> 4401,404,4570934138
> 4401,874,4571970593
> 4401,895,4576851405
$
Not needed anymore, @6by9 and Dave Stevenson did accept all my changes to raspiraw master branch https://github.com/6by9/raspiraw and did some white space and naming changes. If you scroll down on that link you will see the extended documentatiion. Here are the steps needed to get started with raspiraw:HermannSW wrote: ↑Fri Jan 26, 2018 12:44 pmIf you build my fork and run "tools/1280x720" you will see the same results, no skips.
You can find instructions under "raspiraw usage":
https://github.com/Hermann-SW/raspiraw#raspiraw-usage


6by9 is Dave Stevenson - I don't believe I suffer from a multiple personality disorder
Code: Select all
mmal: Set pack to 0, unpack to 0
mmal: Timing 2/6, 2/6/0, 1/1
mmal: Set camera_num to 0
mmal: Create pool of 4 buffers of size 768000
mmal: Sent buffer 0x175f928
mmal: Sent buffer 0x175fb00
mmal: Sent buffer 0x175fcd8
mmal: Sent buffer 0x175feb0
mmal: Failed to set I2C address
mmal: Failed to set I2C address
mmal: Buffer 0x175f928 returned, filled 0, timestamp 0, flags 0000
mmal: Buffer 0x175fb00 returned, filled 0, timestamp 0, flags 0000
mmal: Buffer 0x175fcd8 returned, filled 0, timestamp 0, flags 0000
mmal: Buffer 0x175feb0 returned, filled 0, timestamp 0, flags 0000
That went into the userland repo back in July. The Raspbian packages should update the headers in /opt/vc, but cloning the userland repo and building with the ./buildme script will also update them.grimepoch wrote: ↑Thu Feb 01, 2018 6:52 amTwo things of interest. When I tried to compile your code, it couldn't find the enumeration for MMAL_PARAMTER_BLACK_LEVEL which I found another copy of the header and just added the missing enumerations. It compiled without trouble, but I wonder if something else needs to be updated in the MMAL installation I have.
raspiraw produces two buffers per frame received, one for the data that matched the image data type, and one (with the MMAL_BUFFER_HEADER_T flags field having the MMAL_BUFFER_HEADER_FLAG_CODECSIDEINFO flag set) for everything that didn't match.grimepoch wrote:Second, you mentioned checking if the data is stored else wise because the image_id is not set properly. You mentioned adding a flag and then checking for received data, I just didn't understand how (or where) to add that flag and then where to check for it.
Given all four buffers come back saying "filled=0, timestamp=0, flags=0" does that mean I am just not getting recognition of the CSI signals in general? In other words, even if I had the settings wrong, would I expect to see garbage recorded at least?6by9 wrote: ↑Thu Feb 01, 2018 9:43 amhttps://github.com/6by9/raspiraw/blob/m ... raw.c#L452 is set to ignore the second set of buffers, so it would be worth inverting that first bit of the clause to look at the other set if you think you may be producing the incorrect data type.

That sounds like you're only getting the buffers back on flush/disable as it is quitting. The receiver is set up to return buffers as filled on a "frame end" short packet. If it doesn't see any of those then you will wait forever (or port disable) for any buffers back.grimepoch wrote: ↑Thu Feb 01, 2018 2:56 pmGiven all four buffers come back saying "filled=0, timestamp=0, flags=0" does that mean I am just not getting recognition of the CSI signals in general? In other words, even if I had the settings wrong, would I expect to see garbage recorded at least?6by9 wrote: ↑Thu Feb 01, 2018 9:43 amhttps://github.com/6by9/raspiraw/blob/m ... raw.c#L452 is set to ignore the second set of buffers, so it would be worth inverting that first bit of the clause to look at the other set if you think you may be producing the incorrect data type.
I'm afraid I can't document them fully as it isn't our IP, hence the wooly names to the fields. If you read the DPHY spec or http://download.tek.com/document/61W_25772_0_HR.pdf, then the state change diagrams give you a fair guess as to the timings they'll be defining.grimepoch wrote:The timing configuration numbers, is there a reference to what each of those represent?