HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Tue Dec 26, 2017 6:34 pm

I really got a "Raspberry Pi NoIR Camera Module V2" as Christmas present, and did try two nights ago to capture register sets. The camera worked fine, but captures were completely unstable for capturing two time the same command. Did try yesterday again, same results, so I did work on frame edge detection first.

Today I tried again and wanted to get to the root cause. With unrecreatable I2C decodings for the same command I went back to the command that worked well for determining 60fps/90fps difference for v2 camera. But even that did not help.

Then I even saw Pi 2B rebooting on HDMI monitor and realized that the HDMI connection might make a difference. After removing HDMI cable things were not much better, many hundred differences. I switched back to v2 camera and saw the same unrepeatable I2C sequences for same raspivid command. Finally I removed the I2C analyzer from Salea logic analyzer software and added it newly. That made a difference, with v2 camera now two captures for same command generated identical I2C sequences.

Then I switched cameras again, connecting new v2 NoIR camera module. I had to reboot after a camera switch in order to make raspivid work. Now things are much better, although I do not get identical sequences for v2 capturing of same command captured twice. But in total 133 differences and not near 4 digit numbers:

Code: Select all

$ diff --side-by-side -W 74 <(cut -f2- -d, 1.csv) <(cut -f2- -d, 2.csv) | grep "<" | wc --lines
48
$ diff --side-by-side -W 74 <(cut -f2- -d, 1.csv) <(cut -f2- -d, 2.csv) | grep "|" | wc --lines
41
$ diff --side-by-side -W 74 <(cut -f2- -d, 1.csv) <(cut -f2- -d, 2.csv) | grep ">" | wc --lines
44
$ 

This was the command captured:

Code: Select all

$ raspivid -t 3000 -md 7 -fps 60 -o /dev/null -w 640 -h 480 -ex off -ss 1000

And this is side-by-side difference to look at:

Code: Select all

 Analyzer Name, Decoded Protocol R	 Analyzer Name, Decoded Protocol R
I2C,Setup Write to [0xC8] + NAK		I2C,Setup Write to [0xC8] + NAK
I2C,Setup Write to [0xC8] + NAK		I2C,Setup Write to [0xC8] + NAK
I2C,Setup Write to [0xC8] + NAK		I2C,Setup Write to [0xC8] + NAK
I2C,Setup Read to [0x01] + NAK		I2C,Setup Read to [0x01] + NAK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x04 + NAK				I2C,0x04 + NAK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x11 + ACK				I2C,0x11 + ACK
I2C,0x33 + ACK				I2C,0x33 + ACK
I2C,0x43 + NAK				I2C,0x43 + NAK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x07 + ACK				I2C,0x07 + ACK
I2C,0x02 + ACK				I2C,0x02 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x1E + ACK				I2C,0x1E + ACK
I2C,0x2D + ACK				I2C,0x2D + ACK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x07 + NAK				I2C,0x07 + NAK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x23 + ACK				I2C,0x23 + ACK
I2C,0x68 + ACK				I2C,0x68 + ACK
I2C,0x8F + ACK				I2C,0x8F + ACK
I2C,0x49 + ACK				I2C,0x49 + ACK
I2C,0xD4 + NAK				I2C,0xD4 + NAK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x07 + ACK				I2C,0x07 + ACK
I2C,0x02 + ACK				I2C,0x02 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x02 + ACK				I2C,0x02 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x18 + ACK				I2C,0x18 + ACK
I2C,0xAD + ACK				I2C,0xAD + ACK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x07 + NAK				I2C,0x07 + NAK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x92 + ACK				I2C,0x92 + ACK
I2C,0xB9 + ACK				I2C,0xB9 + ACK
I2C,0x0A + ACK				I2C,0x0A + ACK
I2C,0x7B + ACK				I2C,0x7B + ACK
I2C,0x78 + ACK				I2C,0x78 + ACK
I2C,0x70 + NAK				I2C,0x70 + NAK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x07 + ACK				I2C,0x07 + ACK
I2C,0x02 + ACK				I2C,0x02 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x11 + ACK				I2C,0x11 + ACK
I2C,0x2D + ACK				I2C,0x2D + ACK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x07 + NAK				I2C,0x07 + NAK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0xEE + ACK				I2C,0xEE + ACK
I2C,0x12 + ACK				I2C,0x12 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0xBE + ACK				I2C,0xBE + ACK
I2C,0x84 + NAK				I2C,0x84 + NAK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Read to [0x01] + NAK		I2C,Setup Read to [0x01] + NAK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x04 + NAK				I2C,0x04 + NAK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x11 + ACK				I2C,0x11 + ACK
I2C,0x33 + ACK				I2C,0x33 + ACK
I2C,0x43 + NAK				I2C,0x43 + NAK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x1B + ACK				I2C,0x1B + ACK
I2C,0x16 + ACK				I2C,0x16 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x8A + ACK				I2C,0x8A + ACK
I2C,0xDE + ACK				I2C,0xDE + ACK
I2C,0xBF + ACK				I2C,0xBF + ACK
I2C,0x3C + ACK				I2C,0x3C + ACK
I2C,0x58 + ACK			    |	I2C,0xD6 + ACK
I2C,0x32 + ACK			    |	I2C,0x9D + ACK
I2C,0x4F + ACK			    |	I2C,0xB3 + ACK
				    >	I2C,0x53 + ACK
				    >	I2C,0x88 + ACK
				    >	I2C,0x77 + ACK
				    >	I2C,0x3F + ACK
				    >	I2C,0x35 + ACK
				    >	I2C,0x07 + ACK
				    >	I2C,0x9D + ACK
				    >	I2C,0xC0 + ACK
				    >	I2C,0x59 + ACK
I2C,0x6C + ACK				I2C,0x6C + ACK
I2C,0xF5 + ACK			    |	I2C,0x1C + ACK
I2C,0x66 + ACK			    |	I2C,0xA6 + ACK
I2C,0x72 + ACK			    <
I2C,0x43 + ACK			    <
I2C,0x6B + ACK			    <
I2C,0x81 + ACK			    <
I2C,0xC5 + ACK			    <
I2C,0x0B + ACK			    <
I2C,0x1A + ACK				I2C,0x1A + ACK
I2C,0xF4 + ACK			    |	I2C,0x77 + ACK
I2C,0xBF + ACK			    |	I2C,0x30 + ACK
I2C,0x19 + ACK			    <
I2C,0x82 + ACK			    <
I2C,0xBC + ACK			    <
I2C,Setup Write to [0xC8] + NAK		I2C,Setup Write to [0xC8] + NAK
I2C,Setup Write to [0xC8] + NAK		I2C,Setup Write to [0xC8] + NAK
I2C,Setup Write to [0xC8] + NAK		I2C,Setup Write to [0xC8] + NAK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x23 + NAK				I2C,0x23 + NAK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x82 + ACK			    |	I2C,0xB1 + ACK
I2C,0x26 + ACK			    |	I2C,0xE0 + ACK
				    >	I2C,0xDB + ACK
				    >	I2C,0xD3 + ACK
				    >	I2C,0xC5 + ACK
I2C,0x60 + ACK				I2C,0x60 + ACK
I2C,0x81 + ACK			    |	I2C,0xBE + ACK
I2C,0x82 + ACK			    |	I2C,0x24 + ACK
I2C,0x01 + ACK			    |	I2C,0x66 + ACK
I2C,0xDA + ACK			    |	I2C,0x6B + ACK
I2C,0x3D + ACK			    |	I2C,0xE0 + ACK
I2C,0xF1 + ACK			    |	I2C,0xD1 + ACK
I2C,0xAE + ACK			    |	I2C,0xD5 + ACK
I2C,0xFF + ACK			    |	I2C,0x93 + ACK
I2C,0x97 + ACK			    |	I2C,0x1B + ACK
I2C,0x15 + ACK			    |	I2C,0xB1 + ACK
I2C,0x84 + ACK			    |	I2C,0x8C + ACK
I2C,0x4D + ACK			    |	I2C,0xBD + ACK
I2C,0xA6 + ACK			    |	I2C,0x89 + ACK
I2C,0x10 + ACK			    |	I2C,0x06 + ACK
I2C,0x42 + ACK			    |	I2C,0xED + ACK
I2C,0xA5 + ACK			    <
I2C,0xD6 + ACK			    <
I2C,0xFC + ACK			    <
I2C,0xE5 + ACK			    <
I2C,0x95 + ACK			    <
I2C,0x76 + ACK			    <
I2C,0x90 + ACK			    <
I2C,0x4A + ACK			    <
I2C,0x58 + ACK			    <
I2C,0x3C + ACK			    <
I2C,0x11 + ACK			    <
I2C,0x00 + ACK			    <
I2C,0x9A + ACK			    <
I2C,0x77 + ACK			    <
I2C,0xE9 + ACK				I2C,0xE9 + ACK
I2C,0x21 + NAK			    |	I2C,0xD3 + ACK
				    >	I2C,0x7A + ACK
				    >	I2C,0x33 + ACK
				    >	I2C,0x1C + ACK
				    >	I2C,0x7E + ACK
				    >	I2C,0x0F + ACK
				    >	I2C,0xEB + ACK
				    >	I2C,0x4F + ACK
				    >	I2C,0xFE + ACK
				    >	I2C,0x27 + ACK
				    >	I2C,0xB0 + ACK
				    >	I2C,0x9B + NAK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x07 + ACK				I2C,0x07 + ACK
I2C,0x11 + ACK				I2C,0x11 + ACK
I2C,0x40 + ACK				I2C,0x40 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x14 + ACK				I2C,0x14 + ACK
I2C,0x8D + ACK				I2C,0x8D + ACK
I2C,Setup Write to [0xC8] + NAK		I2C,Setup Write to [0xC8] + NAK
I2C,Setup Write to [0xC8] + NAK		I2C,Setup Write to [0xC8] + NAK
I2C,Setup Write to [0xC8] + NAK		I2C,Setup Write to [0xC8] + NAK
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x23 + NAK				I2C,0x23 + NAK
I2C,Setup Read to [0xC9] + ACK		I2C,Setup Read to [0xC9] + ACK
I2C,0x0B + ACK			    |	I2C,0xF3 + ACK
I2C,0x49 + ACK			    |	I2C,0x42 + ACK
				    >	I2C,0x28 + ACK
				    >	I2C,0x43 + ACK
				    >	I2C,0x01 + ACK
				    >	I2C,0x92 + ACK
				    >	I2C,0x83 + ACK
				    >	I2C,0xA5 + ACK
				    >	I2C,0xA5 + ACK
				    >	I2C,0x06 + ACK
				    >	I2C,0x6E + ACK
				    >	I2C,0x18 + ACK
				    >	I2C,0x87 + ACK
				    >	I2C,0x60 + ACK
				    >	I2C,0x8E + ACK
				    >	I2C,0xA5 + ACK
				    >	I2C,0x50 + ACK
				    >	I2C,0xDE + ACK
				    >	I2C,0xBA + ACK
				    >	I2C,0x1E + ACK
				    >	I2C,0x02 + ACK
I2C,0x5E + ACK				I2C,0x5E + ACK
I2C,0xC6 + ACK			    <
I2C,0xBF + ACK			    <
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0x51 + ACK			    |	I2C,0xA2 + ACK
I2C,0x3D + ACK			    |	I2C,0xA2 + ACK
I2C,0x86 + ACK			    |	I2C,0xBC + ACK
				    >	I2C,0x80 + ACK
				    >	I2C,0x33 + ACK
I2C,0x7F + ACK				I2C,0x7F + ACK
I2C,0xCD + ACK			    |	I2C,0xB7 + ACK
I2C,0xD7 + ACK			    |	I2C,0x58 + ACK
I2C,0xEA + ACK			    |	I2C,0x65 + ACK
I2C,0x6E + ACK			    <
I2C,0xA7 + ACK			    <
I2C,0xFB + ACK			    <
I2C,0xFD + ACK			    <
I2C,0x69 + ACK			    <
I2C,0x0B + ACK			    <
I2C,0x4A + ACK			    <
I2C,0xD4 + ACK			    <
I2C,0xBF + ACK			    <
I2C,0x5B + ACK			    <
I2C,0xD8 + ACK				I2C,0xD8 + ACK
I2C,0x34 + ACK			    |	I2C,0xC6 + NAK
I2C,0x2D + ACK			    <
I2C,0xD5 + ACK			    <
I2C,0xBF + ACK			    <
I2C,0xC3 + ACK			    <
I2C,0xE2 + ACK			    <
I2C,0x07 + ACK			    <
I2C,0xD7 + ACK			    <
I2C,0x59 + ACK			    <
I2C,0x71 + NAK			    <
I2C,Setup Write to [0xC8] + ACK		I2C,Setup Write to [0xC8] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Read to [0x21] + ACK		I2C,Setup Read to [0x21] + ACK
I2C,0x02 + ACK				I2C,0x02 + ACK
I2C,0x19 + NAK				I2C,0x19 + NAK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x02 + ACK				I2C,0x02 + ACK
I2C,Setup Read to [0x21] + ACK		I2C,Setup Read to [0x21] + ACK
I2C,0x10 + NAK				I2C,0x10 + NAK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + NAK		I2C,Setup Write to [0x20] + NAK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x66 + ACK				I2C,0x66 + ACK
I2C,0x20 + ACK				I2C,0x20 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x66 + ACK				I2C,0x66 + ACK
I2C,0x22 + ACK				I2C,0x22 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x05 + ACK				I2C,0x05 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACKhttps://www.raspberrypi.org/forums/viewtopic.php?f=43&t=109137&p=1250619#p1250619
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x0C + ACK				I2C,0x0C + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0x0A + ACK				I2C,0x0A + ACK
I2C,0xFF + ACK				I2C,0xFF + ACK
I2C,0xFF + ACK				I2C,0xFF + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x05 + ACK				I2C,0x05 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x09 + ACK				I2C,0x09 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x14 + ACK				I2C,0x14 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x28 + ACK				I2C,0x28 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x2A + ACK				I2C,0x2A + ACK
I2C,0x18 + ACK				I2C,0x18 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACKhttps://www.raspberrypi.org/forums/viewtopic.php?f=43&t=109137&p=1250619#p1250619
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK				I2C,0x5A + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x85 + ACK				I2C,0x85 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK				I2C,0x60 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x89 + ACK				I2C,0x89 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK				I2C,0x62 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0xE8 + ACK				I2C,0xE8 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x64 + ACK				I2C,0x64 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0xE8 + ACK				I2C,0xE8 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x66 + ACK				I2C,0x66 + ACK
I2C,0x08 + ACK				I2C,0x08 + ACK
I2C,0xE7 + ACK				I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x68 + ACK				I2C,0x68 + ACK
I2C,0x02 + ACK				I2C,0x02 + ACK
I2C,0xF0 + ACK				I2C,0xF0 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x6A + ACK				I2C,0x6A + ACK
I2C,0x06 + ACK				I2C,0x06 + ACK
I2C,0xAF + ACK				I2C,0xAF + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x6C + ACK				I2C,0x6C + ACK
I2C,0x02 + ACK				I2C,0x02 + ACK
I2C,0x80 + ACK				I2C,0x80 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x6E + ACK				I2C,0x6E + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0xE0 + ACK				I2C,0xE0 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x70 + ACK				I2C,0x70 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x74 + ACK				I2C,0x74 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x8C + ACK				I2C,0x8C + ACK
I2C,0x0A + ACK				I2C,0x0A + ACK
I2C,0x0A + ACK				I2C,0x0A + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x05 + ACK				I2C,0x05 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x05 + ACK				I2C,0x05 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x07 + ACK				I2C,0x07 + ACK
I2C,0x39 + ACK				I2C,0x39 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x09 + ACK				I2C,0x09 + ACK
I2C,0x0A + ACK				I2C,0x0A + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x0B + ACK				I2C,0x0B + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0x72 + ACK				I2C,0x72 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x45 + ACK				I2C,0x45 + ACK
I2C,0x5E + ACK				I2C,0x5E + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x1E + ACK				I2C,0x1E + ACK
I2C,0x4B + ACK				I2C,0x4B + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x67 + ACK				I2C,0x67 + ACK
I2C,0x0F + ACK			    |	I2C,0x0F + NAK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x50 + ACK				I2C,0x50 + ACK
I2C,0x14 + ACK				I2C,0x14 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x45 + ACK				I2C,0x45 + ACK
I2C,0x40 + ACK				I2C,0x40 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0xB4 + ACK				I2C,0xB4 + ACK
I2C,0x14 + ACK				I2C,0x14 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x13 + ACK				I2C,0x13 + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x8B + ACK				I2C,0x8B + ACK
I2C,0x10 + ACK				I2C,0x10 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x8F + ACK				I2C,0x8F + ACK
I2C,0x10 + ACK				I2C,0x10 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x93 + ACK				I2C,0x93 + ACK
I2C,0x10 + ACK				I2C,0x10 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x97 + ACK				I2C,0x97 + ACK
I2C,0x0E + ACK				I2C,0x0E + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x9B + ACK				I2C,0x9B + ACK
I2C,0x0E + ACK				I2C,0x0E + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x72 + ACK				I2C,0x72 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK				I2C,0x60 + ACK
I2C,0x04 + ACK				I2C,0x04 + ACK
I2C,0xFD + ACK				I2C,0xFD + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK				I2C,0x62 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0xE7 + ACK				I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK				I2C,0x5A + ACK
I2C,0x04 + ACK				I2C,0x04 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK				I2C,0x60 + ACK
I2C,0x04 + ACK				I2C,0x04 + ACK
I2C,0xFD + ACK				I2C,0xFD + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK				I2C,0x62 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0xE7 + ACK				I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK				I2C,0x5A + ACK
I2C,0x04 + ACK				I2C,0x04 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK				I2C,0x60 + ACK
I2C,0x04 + ACK				I2C,0x04 + ACK
I2C,0xFD + ACK				I2C,0xFD + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK				I2C,0x62 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0xE7 + ACK				I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK				I2C,0x5A + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK			    <
I2C,0xE0 + ACK			    <
I2C,Setup Write to [0x20] + ACK	    <
I2C,0x01 + ACK			    <
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x05 + ACK				I2C,0x05 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x0C + ACK				I2C,0x0C + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0x0A + ACK				I2C,0x0A + ACK
I2C,0xFF + ACK				I2C,0xFF + ACK
I2C,0xFF + ACK				I2C,0xFF + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x05 + ACK				I2C,0x05 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x09 + ACK				I2C,0x09 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x14 + ACK				I2C,0x14 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x28 + ACK				I2C,0x28 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x2A + ACK				I2C,0x2A + ACK
I2C,0x18 + ACK				I2C,0x18 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK				I2C,0x5A + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x85 + ACK				I2C,0x85 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK				I2C,0x60 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x89 + ACK				I2C,0x89 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK				I2C,0x62 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0xE8 + ACK				I2C,0xE8 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x64 + ACK				I2C,0x64 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0xE8 + ACK				I2C,0xE8 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x66 + ACK				I2C,0x66 + ACK
I2C,0x08 + ACK				I2C,0x08 + ACK
I2C,0xE7 + ACK				I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x68 + ACK				I2C,0x68 + ACK
I2C,0x02 + ACK				I2C,0x02 + ACK
I2C,0xF0 + ACK				I2C,0xF0 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x6A + ACK				I2C,0x6A + ACK
I2C,0x06 + ACK				I2C,0x06 + ACK
I2C,0xAF + ACK				I2C,0xAF + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x6C + ACK				I2C,0x6C + ACK
I2C,0x02 + ACK				I2C,0x02 + ACK
I2C,0x80 + ACK				I2C,0x80 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x6E + ACK				I2C,0x6E + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0xE0 + ACK				I2C,0xE0 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x70 + ACK				I2C,0x70 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x74 + ACK				I2C,0x74 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x8C + ACK				I2C,0x8C + ACK
I2C,0x0A + ACK				I2C,0x0A + ACK
I2C,0x0A + ACK				I2C,0x0A + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x05 + ACK				I2C,0x05 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x05 + ACK				I2C,0x05 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x07 + ACK				I2C,0x07 + ACK
I2C,0x39 + ACK				I2C,0x39 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x0C + NAK			    |	I2C,0x09 + ACK
I2C,0x05 + ACK			    |	I2C,0x0A + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x0B + ACK				I2C,0x0B + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0x72 + ACK				I2C,0x72 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x45 + ACK				I2C,0x45 + ACK
I2C,0x5E + ACK				I2C,0x5E + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x1E + ACK				I2C,0x1E + ACK
I2C,0x4B + ACK				I2C,0x4B + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x67 + ACK				I2C,0x67 + ACK
I2C,0x0F + ACK				I2C,0x0F + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x50 + ACK				I2C,0x50 + ACK
I2C,0x14 + ACK				I2C,0x14 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x45 + ACK				I2C,0x45 + ACK
I2C,0x40 + ACK				I2C,0x40 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0xB4 + ACK				I2C,0xB4 + ACK
I2C,0x14 + ACK				I2C,0x14 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x13 + ACK				I2C,0x13 + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x8B + ACK				I2C,0x8B + ACK
I2C,0x10 + ACK				I2C,0x10 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x8F + ACK				I2C,0x8F + ACK
I2C,0x10 + ACK				I2C,0x10 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x93 + ACK				I2C,0x93 + ACK
I2C,0x10 + ACK				I2C,0x10 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x97 + ACK				I2C,0x97 + ACK
I2C,0x0E + ACK				I2C,0x0E + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x9B + ACK				I2C,0x9B + ACK
I2C,0x0E + ACK				I2C,0x0E + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x72 + ACK				I2C,0x72 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK				I2C,0x60 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x55 + ACK				I2C,0x55 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK				I2C,0x62 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0xE7 + ACK				I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK				I2C,0x5A + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x2F + ACK				I2C,0x2F + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0xE0 + ACK			    |	I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0xE5 + ACK			    |	I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK				I2C,0x60 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x55 + ACK				I2C,0x55 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK				I2C,0x62 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0xE7 + ACK				I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK				I2C,0x5A + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x2F + ACK				I2C,0x2F + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0xE5 + ACK			    |	I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK				I2C,0x60 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x55 + ACK				I2C,0x55 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK				I2C,0x62 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0xE7 + ACK				I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK				I2C,0x5A + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x2E + ACK				I2C,0x2E + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0xE5 + ACK			    |	I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK

The differences starting here and later can be ignored, since 0x01,0x00,0x00 is lock down of data lanes after 3 seconds of recording:

Code: Select all

...
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK			    <
I2C,0xE0 + ACK			    <
I2C,Setup Write to [0x20] + ACK	    <
I2C,0x01 + ACK			    <
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
...

Some questions on capturing register sets now:
  1. Shouldn't v2 camera give identical I2C captures for executing and capturing same command twice as v1 camera does?
  2. I read that v2 camera has some crypto chip inside -- does that affect I2C channel from Raspberry to camera, or only data lanes back from camera to Raspberry?
  3. In case there will always be a small amount of differences for different captures of same command, is it OK to take any of them?
  4. What should be the command to capture for a given mode? Perhaps "raspivid -md 7 -t 3000 -o /dev/null"?

The new 8Mpixel mode is cool,
https://stamm-wilbrandt.de/en/forum/8Mpixel.test.jpg

although I am much more interested in high framerate modes derived from 640x480 or 1280x720 ...
  • with v1 camera with 480p at 90fps, new modes 640x128_s stretched or 640x64 can do 665fps
  • according imx219 datasheet: 180 frame/s @720p
  • if linearity is given between both chips, maybe imx219 can do 1.5*2=3 times better at 2000fps?!?!?
  • a 320x240 mode at 540fps would be nice as well ...
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4710
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raw sensor access / CSI-2 receiver peripheral

Tue Dec 26, 2017 7:38 pm

HermannSW wrote:
Tue Dec 26, 2017 6:34 pm
Some questions on capturing register sets now:
  1. Shouldn't v2 camera give identical I2C captures for executing and capturing same command twice as v1 camera does?
  2. I read that v2 camera has some crypto chip inside -- does that affect I2C channel from Raspberry to camera, or only data lanes back from camera to Raspberry?
Note that you have 2 different I2C addresses logged in your captures - 0xC8/0C9 (aka 0x64 + R/W bit) and 0x20/0x21 (aka 0x10 + R/W bit). Seeing as the imx219_modes.h field already identifies the sensor as 0x10, you can make an educated guess as to what is going on with 0x64.
HermannSW wrote:
  • In case there will always be a small amount of differences for different captures of same command, is it OK to take any of them?
  • What should be the command to capture for a given mode? Perhaps "raspivid -md 7 -t 3000 -o /dev/null"?
As with OV5647, I'd go with something along the lines of

Code: Select all

raspivid -md N -fps X -w 320 -h 240 -o /dev/null -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
Setting the resolution to something low ensures that you won't get the H264 codec objecting, nor the ISP failing to keep up. Fixing the shutter speed and gains means that exposure control won't be changing your logs, and you can then fiddle with them later to confirm which registers get changed (although that has already been set up in imx219_modes.h)
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Tue Dec 26, 2017 9:39 pm

Thanks, I will try.

I tested with the only mode available for imx219 for raspiraw sofar, mode 0.
The --fps switch does work for imx219 sensor already.

16fps:

Code: Select all

$ ./16fps 1200
removing /dev/shm/out.*.raw
capturing frames for 1200ms with 16fps requested
19 frames were captured at 16fps
frame delta time[us] distribution
      1 
      4 60119
      3 60120
      5 60121
      1 60122
      1 60123
      2 60144
      2 60145
after skip frame indices (middle column)
0% frame skips
$ 

12fps:

Code: Select all

$ ./12fps 1200
removing /dev/shm/out.*.raw
capturing frames for 1200ms with 12fps requested
14 frames were captured at 12fps
frame delta time[us] distribution
      1 
      2 80215
     11 80216
after skip frame indices (middle column)
0% frame skips
$ 

diff of both scripts:

Code: Select all

$ diff 12fps 16fps 
8c8
< fps=12
---
> fps=16
22c22
< grep "^[1-79]" tstamps.csv
---
> grep "^[1-57-9]" tstamps.csv
24c24
< skips=`grep "^[1-79]" tstamps.csv | wc --lines | cut -f1 -d\ `
---
> skips=`grep "^[1-57-9]" tstamps.csv | wc --lines | cut -f1 -d\ `
$ 

This is 12fps script:

Code: Select all

$ cat 12fps 
#!/bin/bash

if [ "$1" = "" ]; then echo "format: `basename $0` ms"; exit; fi

echo "removing /dev/shm/out.*.raw"
rm -f /dev/shm/out.*.raw

fps=12
echo "capturing frames for ${1}ms with ${fps}fps requested"
raspiraw -md 0 -t $1 -ts tstamps.csv -hd0 hd0.32k --fps $fps -sr 1 -o /dev/shm/out.%04d.raw 2>/dev/null >/dev/null

us=`cut -f1 -d, tstamps.csv | sort -n | uniq -c | sort -n | tail -1 | cut -b9-`
l=`ls -l /dev/shm/out.*.raw | wc --lines`
echo "$l frames were captured at $((1000000 / $us))fps" 

echo "frame delta time[us] distribution"
cut -f1 -d, tstamps.csv | sort -n | uniq -c

# echo "press CTRL-C to stop, or ENTER to show frame skip indices ..."
# read
echo "after skip frame indices (middle column)"
grep "^[1-79]" tstamps.csv

skips=`grep "^[1-79]" tstamps.csv | wc --lines | cut -f1 -d\ `
stamps=`wc --lines tstamps.csv | cut -f1 -d\ `
per=`expr \( 100 \* $skips \) / \( $skips + $stamps \)`
echo "$per% frame skips"
$ 

Really 8MP (raw10 Bayer):

Code: Select all

$ echo "3280*2464*10/8" | bc -q
10102400
$ 
$ ls -l /dev/shm/out.0002.raw 
-rw-r--r-- 1 pi pi 10171392 Dec 26 21:21 /dev/shm/out.0002.raw
$ 
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Wed Dec 27, 2017 2:01 am

6by9 wrote:
Tue Dec 26, 2017 7:38 pm
...
Note that you have 2 different I2C addresses logged in your captures - 0xC8/0C9 (aka 0x64 + R/W bit) and 0x20/0x21 (aka 0x10 + R/W bit). Seeing as the imx219_modes.h field already identifies the sensor as 0x10, you can make an educated guess as to what is going on with 0x64.
...

Thank you !
That is really cool: just starting the diffing at first "[0x20]" and ignoring all the initial 0xC8/0xC9 stuff shows 1st difference when data lanes get shut down after 3 seconds of recording, so no differences in relevant part for two measurements on same command !

From imx219_modes.h, the imx219 I2C identification (0x0219):

Code: Select all

...
      .i2c_addr =             0x10,
      .i2c_addressing =       2,
      .i2c_ident_length =     2,
      .i2c_ident_reg =        0x0000,
      .i2c_ident_value =      0x1902,     //Bytes reversed
...

The initial "Read" just verifies I2C identification, here is the corrected diff command:

Code: Select all

$ diff --side-by-side -W 74 <(cut -f2- -d, 1.csv | sed -n "/\[0x20\]/,//p") <(cut -f2- -d, 2.csv | sed -n "/\[0x20\]/,//p") 
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Read to [0x21] + ACK		I2C,Setup Read to [0x21] + ACK
I2C,0x02 + ACK				I2C,0x02 + ACK
I2C,0x19 + NAK				I2C,0x19 + NAK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + NAK		I2C,Setup Write to [0x20] + NAK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x66 + ACK				I2C,0x66 + ACK
I2C,0x22 + ACK				I2C,0x22 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x0C + ACK				I2C,0x0C + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x05 + ACK				I2C,0x05 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x14 + ACK				I2C,0x14 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x2A + ACK				I2C,0x2A + ACK
I2C,0x18 + ACK				I2C,0x18 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK				I2C,0x5A + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x85 + ACK				I2C,0x85 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK				I2C,0x62 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0xE8 + ACK				I2C,0xE8 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x66 + ACK				I2C,0x66 + ACK
I2C,0x08 + ACK				I2C,0x08 + ACK
I2C,0xE7 + ACK				I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x6A + ACK				I2C,0x6A + ACK
I2C,0x06 + ACK				I2C,0x06 + ACK
I2C,0xAF + ACK				I2C,0xAF + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x6E + ACK				I2C,0x6E + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0xE0 + ACK				I2C,0xE0 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x74 + ACK				I2C,0x74 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x05 + ACK				I2C,0x05 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x05 + ACK				I2C,0x05 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x09 + ACK				I2C,0x09 + ACK
I2C,0x0A + ACK				I2C,0x0A + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0x72 + ACK				I2C,0x72 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x1E + ACK				I2C,0x1E + ACK
I2C,0x4B + ACK				I2C,0x4B + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x50 + ACK				I2C,0x50 + ACK
I2C,0x14 + ACK				I2C,0x14 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0xB4 + ACK				I2C,0xB4 + ACK
I2C,0x14 + ACK				I2C,0x14 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK[/url]
I2C,0x8B + ACK				I2C,0x8B + ACK
I2C,0x10 + ACK				I2C,0x10 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x93 + ACK				I2C,0x93 + ACK
I2C,0x10 + ACK				I2C,0x10 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x9B + ACK				I2C,0x9B + ACK
I2C,0x0E + ACK				I2C,0x0E + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK				I2C,0x60 + ACK[/url]
I2C,0x04 + ACK				I2C,0x04 + ACK
I2C,0xFD + ACK				I2C,0xFD + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK				I2C,0x5A + ACK
I2C,0x04 + ACK				I2C,0x04 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK				I2C,0x62 + ACK
I2C,0x0D + ACK				I2C,0x0D + ACK
I2C,0xE7 + ACK				I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK				I2C,0x60 + ACK
I2C,0x04 + ACK				I2C,0x04 + ACK
I2C,0xFD + ACK				I2C,0xFD + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK				I2C,0x5A + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK			    |	I2C,0x00 + ACK
I2C,0xE0 + ACK			    |	I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x05 + ACK			    |	I2C,0x0C + ACK
I2C,Setup Write to [0x20] + ACK	    <
I2C,Setup Write to [0x20] + ACK	    <
I2C,0x30 + ACK			    <
I2C,0x0A + ACK			    <
I2C,0xFF + ACK			    <
I2C,0xFF + ACK			    <
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x30 + ACK				I2C,0x30 + ACK
I2C,0xEB + ACK				I2C,0xEB + ACK
I2C,0x09 + ACK			    |	I2C,0x05 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x28 + ACK			    |	I2C,0x14 + ACK
I2C,0x00 + ACK			    |	I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK			    |	I2C,0x2A + ACK
				    >	I2C,0x18 + ACK
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK			    |	I2C,0x5A + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x89 + ACK			    |	I2C,0x85 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x64 + ACK			    |	I2C,0x62 + ACK
I2C,0x03 + ACK			    |	I2C,0x0D + ACK
I2C,0xE8 + ACK				I2C,0xE8 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x68 + ACK			    |	I2C,0x66 + ACK
I2C,0x02 + ACK			    |	I2C,0x08 + ACK
I2C,0xF0 + ACK			    |	I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x6C + ACK			    |	I2C,0x6A + ACK
I2C,0x02 + ACK			    |	I2C,0x06 + ACK
I2C,0x80 + ACK			    |	I2C,0xAF + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x70 + ACK			    |	I2C,0x6E + ACK
I2C,0x01 + ACK			    <
I2C,0x01 + ACK				I2C,0x01 + ACK
				    >	I2C,0xE0 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x8C + ACK			    |	I2C,0x74 + ACK
I2C,0x0A + ACK			    |	I2C,0x03 + ACK
I2C,0x0A + ACK			    |	I2C,0x03 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x03 + ACK			    <
I2C,0x01 + ACK				I2C,0x01 + ACK
				    >	I2C,0x05 + ACK
				    >	I2C,Setup Write to [0x20] + ACK
				    >	I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
				    >	I2C,0x05 + ACK
				    >	I2C,0x03 + ACK
				    >	I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x07 + ACK			    |	I2C,0x09 + ACK
I2C,0x39 + ACK			    |	I2C,0x0A + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
I2C,0x0B + ACK			    |	I2C,0x0D + ACK
I2C,0x01 + ACK			    |	I2C,0x72 + ACK
I2C,0x00 + ACK			    <
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x45 + ACK			    |	I2C,0x47 + ACK
I2C,0x5E + ACK			    |	I2C,0x1E + ACK
I2C,0x00 + ACK			    |	I2C,0x4B + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x67 + ACK			    |	I2C,0x50 + ACK
I2C,0x0F + ACK			    |	I2C,0x14 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x45 + ACK			    |	I2C,0x47 + ACK
I2C,0x40 + ACK			    |	I2C,0xB4 + ACK
I2C,0x00 + ACK			    |	I2C,0x14 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x13 + ACK			    |	I2C,0x8B + ACK
I2C,0x30 + ACK			    |	I2C,0x10 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x8F + ACK			    |	I2C,0x93 + ACK
I2C,0x10 + ACK				I2C,0x10 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x47 + ACK				I2C,0x47 + ACK
I2C,0x97 + ACK			    |	I2C,0x9B + ACK
I2C,0x0E + ACK				I2C,0x0E + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x72 + ACK			    |	I2C,0x60 + ACK
I2C,0x03 + ACK				I2C,0x03 + ACK
				    >	I2C,0x55 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK			    |	I2C,0x5A + ACK
I2C,0x0D + ACK			    |	I2C,0x00 + ACK
I2C,0xE7 + ACK			    |	I2C,0x2F + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK				I2C,0x57 + ACK
I2C,0xE0 + ACK			    |	I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x60 + ACK			    |	I2C,0x62 + ACK
I2C,0x03 + ACK			    |	I2C,0x0D + ACK
I2C,0x55 + ACK			    |	I2C,0xE7 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x5A + ACK			    <
I2C,0x00 + ACK				I2C,0x00 + ACK
I2C,0x2F + ACK			    |	I2C,0x01 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK			    |	I2C,0x60 + ACK
I2C,0xE5 + ACK			    |	I2C,0x03 + ACK
				    >	I2C,0x55 + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x62 + ACK			    |	I2C,0x5A + ACK
I2C,0x0D + ACK			    |	I2C,0x00 + ACK
I2C,0xE7 + ACK			    |	I2C,0x2E + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,Setup Write to [0x20] + ACK		I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK				I2C,0x01 + ACK
I2C,0x57 + ACK			    |	I2C,0x00 + ACK
I2C,0xE5 + ACK			    |	I2C,0x00 + ACK
I2C,Setup Write to [0x20] + ACK	    <
$ 

The last write to 0x0160 (before lanes get opened by writing 0x01 to 0x0100) is 0x04FD:

Code: Select all

...
I2C,Setup Write to [0x20] + ACK         I2C,Setup Write to [0x20] + ACK
I2C,0x01 + ACK                          I2C,0x01 + ACK
I2C,0x60 + ACK                          I2C,0x60 + ACK
I2C,0x04 + ACK                          I2C,0x04 + ACK
I2C,0xFD + ACK                          I2C,0xFD + ACK
...

And 0x0160 is 16bit FRM_LENGTH_A, with 2 line units in binning mode 3:

Code: Select all

$ echo -e "ibase=16\n 04FD*2" | bc -q
2554
$ 

Page 52 of imx219 datasheet shows total physical rows of imx219 sensor:
8+2464+8+16+16+8=2520 rows
https://github.com/rellimmot/Sony-IMX21 ... et_XXX.PDF
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

PierreG
Posts: 3
Joined: Fri Dec 01, 2017 11:34 am

Re: Raw sensor access / CSI-2 receiver peripheral

Wed Dec 27, 2017 12:34 pm

PierreG wrote: ↑
Thu Dec 07, 2017 2:08 pm
Hi everybody!
I'm thinking about interfacing another sony imx sensor (224) with Rpi3.
What is the requirements to get raw image with raspiraw?
1) Design/use a sensor board
2) Connect i2c/clock/CSI between sensor board and rpi
3) Define the sensor registers and mode in *_modes.h file
4) run raspiraw, debug and pray

Did someone try to connect another sensor than imx219 and ov5647?

6by9 wrote:
Mon Dec 11, 2017 8:33 am
Sorry, missed this one before.

You're right on what's required. The only bit I think you've missed is adding the include and sensor entry into raspiraw.c. You may need to tweak termination settings depending on how your register set configures csi low to high speed transitions.
Getting the register set right is half the battle, although I seem to recall imx224 has a few drivers kicking around if you search a bit.
Do remember that the csi clock and data lanes are pretty high speed (100-500MHz typically) and are meant to be impedance matched.

I know one other has had an fpga solution interfaced to raspiraw.
There are settings in raspiraw for adv7282m (analogue video to csi bridge), but I never got them to work reliably. I now know they keep the clock lane in high speed mode, so I might revisit that as hopefully it will be about a two line change.

##################
Yeah I'm writing the include sensor mode.
What do you mean by termination?
Why there are 2 different speed transitions?
If you see "drivers kicking around" , it will be wonderful if you share it ;-)
What is the impedance of rpi3 lanes? 50, 75, 100 Ohms?

Sorry what'is the link with adv7282m?

Last question, how does rpi3 generate sensor input clock (INCLK, typically 74Mhz with my sensor)?

Thank you very much!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4710
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raw sensor access / CSI-2 receiver peripheral

Wed Dec 27, 2017 8:07 pm

PierreG wrote:
Wed Dec 27, 2017 12:34 pm
Yeah I'm writing the include sensor mode.
What do you mean by termination?
Why there are 2 different speed transitions?
You need to read the CSI2 spec to get a basic idea of how it works. It has two speeds. It idles in a low power, low speed mode, and then switches to a high speed, lower voltage mode when it needs to send image data. The termination of the differential pair differs between the two modes. Some devices keep the clock lane active constantly, which requires the termination to be altered to match.
If you see "drivers kicking around" , it will be wonderful if you share it ;-)
IMX224 isn't one I've seen kicking around on the main linux-media mailing list, but a few minutes with Google and "imx224 linux" turns up https://github.com/BPI-SINOVOIP/BPI-M3- ... e/imx224.c
You can't use that directly as it is set up for the sunxi boards (BananaPi?), but it does appear to give you a nice register set for 1080P30 12bit, although over 4 CSI2 lanes if line 861 is to be believed (Pi only has 2 lanes exposed except on the Compute Modules. Curious as I thought the BananaPi copied the Raspberry Pi connector pinouts).
What is the impedance of rpi3 lanes? 50, 75, 100 Ohms?
It should be in the CSI2 spec, but quicker to look in the Compute Module board schematics which show them routed as 100ohm differential pairs.
Sorry what'is the link with adv7282m?
Only that it's another CSI2 device that I have had working with the Pi.
Last question, how does rpi3 generate sensor input clock (INCLK, typically 74Mhz with my sensor)?
It doesn't. The camera boards have 25MHz oscillators on them, as sending a single ended clock signal up the flexi cable from the Pi caused all sorts of EMC issues.
74MHz sounds an odd frequency - all the camera sensors I have worked with have tended to take 19.2MHz, 24MHz, or 27MHz. It's almost always fed into a PLL anyway which bumps it up. The driver linked above is implying an MCLK of 27MHz (line 45).
Last edited by 6by9 on Thu Dec 28, 2017 6:45 am, edited 1 time in total.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Wed Dec 27, 2017 9:27 pm

Capturing the I2C sequences for imx219 sensor modes recreatable is easy now.
What is a problem is that any use of option "-fps" crashes raspivid :-(

I took the 2nd part of the resister sets skipping the preview part, but that seems not enough.
I got mode 0 and mode 1 working with my captured register sets, but only after running "raspiraw -md 0" and the pressing CTRL-C. This seems to indicate that existing mode 0 sets some needed registers that are missing in my sets. This is first full HD image captured with raspiraw, but unlike mode 0 where --fps switch works fine with raspiraw, with mode 1 capturing gets always done with 22fps. Will have to dig deeper into this ... especially why my captured mode7 registers show garbage only.
Image

Code: Select all

#define addreg(a, b) { a, b }

struct sensor_regs imx219_mode1[] =
{
      addreg(0x0100, 0x00),
      addreg(0x30EB, 0x0C),
      addreg(0x30EB, 0x05),
      addreg(0x0114, 0x01),
      addreg(0x012A, 0x18),
      addreg(0x012B, 0x00),
      addreg(0x015A, 0x09),
      addreg(0x015B, 0xBD),
      addreg(0x0162, 0x0D),
      addreg(0x0163, 0x78),
      addreg(0x0166, 0x0A),
      addreg(0x0167, 0x27),
      addreg(0x016A, 0x06),
      addreg(0x016B, 0xEB),
      addreg(0x016E, 0x04),
      addreg(0x016F, 0x38),
      addreg(0x0174, 0x00),
      addreg(0x0175, 0x00),
      addreg(0x0301, 0x05),
      addreg(0x0305, 0x03),
      addreg(0x0306, 0x00),
      addreg(0x0309, 0x0A),
      addreg(0x030D, 0x72),
      addreg(0x471E, 0x4B),
      addreg(0x4750, 0x14),
      addreg(0x47B4, 0x14),
      addreg(0x478B, 0x10),
      addreg(0x4793, 0x10),
      addreg(0x479B, 0x0E),
      addreg(0x0160, 0x06),
      addreg(0x0161, 0xE3),
      addreg(0x015A, 0x04),
      addreg(0x015B, 0x20),
      addreg(0x0157, 0x00),
      addreg(0x0162, 0x0D),
      addreg(0x0163, 0x78),
      addreg(0x0100, 0x01)
};
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Fri Dec 29, 2017 10:00 pm

Without help I need to give up on trying to capture mode 2-7 register sets for imx219 v2 camera :-(

I spent numerous hours over the past several days and cannot get it right.

I even suspected the raspivid on Pi 2B that was created with the userland repo and spit out so many messages (because as I said earlier -fps option for that raspivid did crash). Therefore I flashed Pi 2B SD card fresh with 2017-09-07-raspbian-stretch-lite.img and git cloned dcraw and raspiraw.

I did go down to 2Msps with logic analyzer (OK for 100KHz I2C traffic) and captured 60 seconds.
Immediately after starting capture I did "sudo reboot", and after Pi 2 was pingable again, I did ssh into, executed camera_i2c and then:

Code: Select all

raspiraw -md 0 -t 1200 -ts tstamps.csv -hd0 hd0.32k -sr 1 -o /dev/shm/out.%04d.raw 2>/dev/null >/dev/null

Then I did "cat hd0.32k /dev/shm/out.0022.raw > out.0022.raw" and "dcraw out.0022.raw". The generated .ppm was fine.

I exported the whole 60s of capture including shutdown and reboot. And there was no I2C traffic to 0xC8/0xC9 -- this proved that this traffic is not needed.

The last I tried is capturing mode 7, from this command:

Code: Select all

raspivid -md 7 -fps 90 -w 640 -h 480 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0

I played the video and took a screenshoot from one frame:
Image


Then I did

Code: Select all

raspiraw -md 7 -t 1200 -ts tstamps.csv -hd0 hd0.32k -sr 1 -o /dev/shm/out.%04d.raw 2>/dev/null >/dev/null

(after "camera_i2c") and generated the .ppm with dcraw as described above and got this sad result:
Image


This is the cleanly and recreatable captured register set:

Code: Select all

struct sensor_regs imx219_mode7[] =
{
      addreg(0x0100, 0x00),
      addreg(0x30eb, 0x0c),
      addreg(0x30eb, 0x05),
      addreg(0x0114, 0x01),
      addreg(0x012a, 0x18),
      addreg(0x012b, 0x00),
      addreg(0x015a, 0x01),
      addreg(0x015b, 0x85),
      addreg(0x0162, 0x0d),
      addreg(0x0163, 0xe8),
      addreg(0x0166, 0x08),
      addreg(0x0167, 0xe7),
      addreg(0x016a, 0x06),
      addreg(0x016b, 0xaf),
      addreg(0x016e, 0x01),
      addreg(0x016f, 0xe0),
      addreg(0x0174, 0x03),
      addreg(0x0175, 0x03),
      addreg(0x0301, 0x05),
      addreg(0x0305, 0x03),
      addreg(0x0306, 0x00),
      addreg(0x0309, 0x0a),
      addreg(0x030d, 0x72),
      addreg(0x471e, 0x4b),
      addreg(0x4750, 0x14),
      addreg(0x47b4, 0x14),
      addreg(0x478b, 0x10),
      addreg(0x4793, 0x10),
      addreg(0x479b, 0x0e),
      addreg(0x0160, 0x02),
      addreg(0x0161, 0x39),
      addreg(0x015a, 0x00),
      addreg(0x015b, 0x2f),
      addreg(0x0157, 0x00),
      addreg(0x0162, 0x0d),
      addreg(0x0163, 0xe7),
      addreg(0x0100, 0x01),
};

And this mode_def struct:

Code: Select all

struct mode_def imx219_modes[] = {
   { imx219_8MPix, NUM_ELEMENTS(imx219_8MPix), 3280, 2464, 0, BAYER_ORDER_BGGR, 10, 0x2B, 2, 2504, 18904 },
   { imx219_mode1, NUM_ELEMENTS(imx219_mode1), 1920, 1080, 0, BAYER_ORDER_BGGR, 10, 0x2B, 2, 1120, 29762 },
   {},
   {},
   {},
   {},
   {},
   { imx219_mode7, NUM_ELEMENTS(imx219_mode7),  640,  480, 0, BAYER_ORDER_BGGR, 10, 0x2B, 2,  484, 21165 },
};

Any hints appreciated, otherwise I will have to focus on high framerate capturing for v1 camera.
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Sat Dec 30, 2017 9:28 am

Attached are some tools:

comp12: compares two I2C captures 1.csv and 2.csv exported from logic analyzer (should return nothing)

clean: removes generated files
buildme: builds some files, the important one being "1.reg"
(excludes all 0xC8/0xC9 I2C commands proven not to be needed)

I took the registers from 2nd "addreg(0x0100, 0x00)," line until and including 2nd "addreg(0x0100, 0x01)," line in last posting.
1.csv and 2.csv are the taken exported I2C captures for the -md 7 command described.
Attachments
mode7.zip
tools for generating 1.reg
(9.21 KiB) Downloaded 4 times
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

Vlad The Implier
Posts: 5
Joined: Sun Dec 31, 2017 11:25 am

Re: Raw sensor access / CSI-2 receiver peripheral

Mon Jan 08, 2018 12:22 am

Hey,
I'm planing on doing a photogrammetry build with ~50 camera v2.1s with network booted RPi3.
I want to send raw Bayer data over lan and do debayering with Cuda later on, so I'm trying to get the full sweet 10-bit goodness directly. Raspistill with -ag 1.0 -dg 1.0 -awb off and own exposure time and awbgains has given great results, so I'm trying to replicate this with raspiraw, currently on my RPI B+ and the Camera v2.1. The end goal is to trigger captures via GPIO pins, compress the raw data in memory, send of the raw data over lan and once finished capture again, all in C++.

However, I can't get raspiraw to do anything. I have followed multiple threads, setting up the /boot/config.txt and modprobe commands, all ending in "No sensor found, aborting".
Am I misunderstanding all of this and actually have to connect the i2c pins on the Pi with some pins on the camera?

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Mon Jan 08, 2018 8:31 am

Vlad The Implier wrote:
Mon Jan 08, 2018 12:22 am
Am I misunderstanding all of this and actually have to connect the i2c pins on the Pi with some pins on the camera?
No.

However, I can't get raspiraw to do anything. I have followed multiple threads, setting up the /boot/config.txt and modprobe commands, all ending in "No sensor found, aborting".
Following these instructions should work (I did that on 6 different PIs successfully):
viewtopic.php?f=43&t=189661&p=1232058#p1218763

Although you should use 6by9's newer repo:
https://github.com/6by9/raspiraw

You might find some documentation helpful:
https://github.com/Hermann-SW/raspiraw#readme
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

Vlad The Implier
Posts: 5
Joined: Sun Dec 31, 2017 11:25 am

Re: Raw sensor access / CSI-2 receiver peripheral

Mon Jan 08, 2018 1:21 pm

HermannSW wrote: Following these instructions should work (I did that on 6 different PIs successfully):
viewtopic.php?f=43&t=189661&p=1232058#p1218763
Thanks for the quick Response.
Did this, infact I followed that exact post when I tried to set it up with fresh Image of raspbian Stretch.
Just to make sure I'm not crazy, after lunch now I reformated and started anew with the latest Raspbian Stretch lite, did apt-get update + upgrade, followed the whole instruction again, with the new repo. (yesturday tried the old one aswell, where it compiled all kinds of stuff from the userland repo)
Replaced the 1m csi cable to the Default one just in case and it still exits with "no sensor found. Aborting." Also tried with different Switches and combinations of enabling / disabling the camera and i2c Interface just in case.

Should I roll back to Jessie and retry?
Is there a way to debug the whole process, I tried i2cdetect but don't know what to look for (i2cdetect -y 0 yields only a Screen full of Dashes "--" and i2cdetect -y 1 yields {left axis; top axis} "10" at {10;0} and "64" at {60;4}, everything else is again "--"

Raspistill and Raspivid obviously works flawless.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4710
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raw sensor access / CSI-2 receiver peripheral

Mon Jan 08, 2018 2:01 pm

Vlad The Implier wrote:
Mon Jan 08, 2018 1:21 pm
Replaced the 1m csi cable to the Default one just in case and it still exits with "no sensor found. Aborting." Also tried with different Switches and combinations of enabling / disabling the camera and i2c Interface just in case.
Long cables aren't recommended, but if it's working with raspivid/raspistill (as you say below), then it should work with raspiraw.
Vlad The Implier wrote:Should I roll back to Jessie and retry?
Is there a way to debug the whole process, I tried i2cdetect but don't know what to look for (i2cdetect -y 0 yields only a Screen full of Dashes "--" and i2cdetect -y 1 yields {left axis; top axis} "10" at {10;0} and "64" at {60;4}, everything else is again "--"
Which version of the Pi are you running on? From your i2cdetect output it sounds like it is an original model A or B (not the model B+ that you state). How many pins do you have on the GPIO connector?
The original A&B used i2c-1 for the camera, whereas almost all other variants use i2c-0. Address 0x10 is the IMX219 sensor, and 0x64 is the crypto chip, so that would imply that it is seeing the sensor via "i2cdetect -y 1".
If building the latest versions, try "raspiraw -y 1 ..." to use i2c-1.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Vlad The Implier
Posts: 5
Joined: Sun Dec 31, 2017 11:25 am

Re: Raw sensor access / CSI-2 receiver peripheral

Mon Jan 08, 2018 4:13 pm

6by9 wrote:
Mon Jan 08, 2018 2:01 pm
If building the latest versions, try "raspiraw -y 1 ..." to use i2c-1.
Aww lovely! Pure Gold, have a Cookie :]
Image
This is not self evident for newcomers and should be noted in the readme of raspiraw. Especially, since the wiring pi script detects your Pi Version and implies, that all Version specific Settings have been taken care of.

One more questions though:
-Is it possible to get the raw Bayer data in the form of [AAAAAAAA-AABBBBBB-BBBBCCCC-CCCCCCDD-DDDDDDDD] instead of [AAAAAAAA-BBBBBBBB-CCCCCCCC-DDDDDDDD-AABBCCDD] to increase compression Ratio, as mentioned here, without Manual reshuffle after raspiraw spits it out?
Although C++ is my language of choise, I have no knowledge of using bit shifts to get this done efficiently. The Time may have come for me to learn that...
I recall a post, by 6by9 himself if my Memory does not lie to me, stating that this is the way the camera spits it out...

Many Many thanks to the work and incredible knowledge from this thread - deserves it's own wiki page.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4710
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raw sensor access / CSI-2 receiver peripheral

Mon Jan 08, 2018 4:48 pm

Vlad The Implier wrote:
Mon Jan 08, 2018 4:13 pm
6by9 wrote:
Mon Jan 08, 2018 2:01 pm
If building the latest versions, try "raspiraw -y 1 ..." to use i2c-1.
Aww lovely! Pure Gold, have a Cookie :]
Image
This is not self evident for newcomers and should be noted in the readme of raspiraw. Especially, since the wiring pi script detects your Pi Version and implies, that all Version specific Settings have been taken care of.
Sorry, that's part of the headache with this being a side project - I don't always get the chance to get Pull Requests fully knocked into the shape I'd like them to be. I'll add some text to the camera_i2c to relate the need to use -y 1.
NB You are using a Model A or B, not a B+ as you originally reported.
Vlad The Implier wrote:One more questions though:
-Is it possible to get the raw Bayer data in the form of [AAAAAAAA-AABBBBBB-BBBBCCCC-CCCCCCDD-DDDDDDDD] instead of [AAAAAAAA-BBBBBBBB-CCCCCCCC-DDDDDDDD-AABBCCDD] to increase compression Ratio, as mentioned here, without Manual reshuffle after raspiraw spits it out?
Although C++ is my language of choise, I have no knowledge of using bit shifts to get this done efficiently. The Time may have come for me to learn that...
I recall a post, by 6by9 himself if my Memory does not lie to me, stating that this is the way the camera spits it out...
It's possible to get 000000AA AAAAAAAA 000000BB BBBBBBBB 000000CC CCCCCCCC 000000DD DDDDDDDD, at the expense of extra memory. Add "-b 16" to your command line and that should happen automagically.
Part of the recent discussion was around my expectation that -b 8 would take the 8 most significant bits and pack them into 8 bit words, but the hardware actually takes the least significant 8 bits, dropping the 2 MSBs :(
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4710
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raw sensor access / CSI-2 receiver peripheral

Wed Jan 10, 2018 3:55 pm

HermannSW wrote:
Sat Dec 30, 2017 9:28 am
Attached are some tools:

comp12: compares two I2C captures 1.csv and 2.csv exported from logic analyzer (should return nothing)

clean: removes generated files
buildme: builds some files, the important one being "1.reg"
(excludes all 0xC8/0xC9 I2C commands proven not to be needed)

I took the registers from 2nd "addreg(0x0100, 0x00)," line until and including 2nd "addreg(0x0100, 0x01)," line in last posting.
1.csv and 2.csv are the taken exported I2C captures for the -md 7 command described.
I've finally had a chance to analyse your captures. The captures are fine, your analysis is faulty.

As I think you've observed, the IMX219 supports "CCI sequential read starting from current location" (see section 3.1.2.4 of the datasheet). Basically if you write the register address, you can then write address+1 just by writing another value. Therefore looking at your capture:

Code: Select all

2.020186500000000,I2C,0x66 + ACK
2.020276500000000,I2C,0x20 + ACK
2.020366500000000,I2C,0x01 + ACK
2.020456500000000,I2C,0x01 + ACK
2.020576500000000,I2C,Setup Write to [0x20] + ACK
2.020666500000000,I2C,0x66 + ACK
2.020756500000000,I2C,0x22 + ACK
2.020846500000000,I2C,0x01 + ACK
2.020936500000000,I2C,0x01 + ACK
2.021056500000000,I2C,Setup Write to [0x20] + ACK
2.021146500000000,I2C,0x30 + ACK
2.021236500000000,I2C,0xEB + ACK
2.021326500000000,I2C,0x05 + ACK
2.021446500000000,I2C,Setup Write to [0x20] + ACK
2.021536500000000,I2C,0x30 + ACK
2.021626500000000,I2C,0xEB + ACK
2.021716500000000,I2C,0x0C + ACK
2.021836500000000,I2C,Setup Write to [0x20] + ACK
2.021926500000000,I2C,0x30 + ACK
2.022016500000000,I2C,0x0A + ACK
2.022106500000000,I2C,0xFF + ACK
2.022196500000000,I2C,0xFF + ACK
Actually means
0x6620, 0x01
0x6621, 0x01
0x6622, 0x01
0x6623, 0x01
0x30EB, 0x05
0x30EB, 0x0C
0x300A, 0xFF
0x300B, 0xFF

Using buildme I see that expanded to
<< where did 0x6620 and 0x6621 go?
addreg(0x6622, 0x01),
addreg(0x6623, 0x01),
addreg(0x30eb, 0x0c),
addreg(0x30eb, 0x05),
<< where did 0x300A go?
addreg(0x0114, 0x01),
It looks like it is the first stage converting into 1.txt that is going wrong. I'm not a sed or regex expert, so I'm not going to look into it.
Get the full register set and I think you should be there - all the captured data I have checked through is as expected.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Wed Jan 10, 2018 9:55 pm

6by9 wrote:
Wed Jan 10, 2018 3:55 pm
... I've finally had a chance to analyse your captures. The captures are fine, your analysis is faulty. ...
Thank you so much for pointing to my fault and keep me going again!!

I did use the wrong regexp for getting all lines from a matching line until file end.
I looked up sed1line.txt ...
http://sed.sourceforge.net/sed1line.txt

... and immediately found the correct sed command.

Here is the recursive diff of old mode7.zip attachment and corrected new mode7.b.zip attachment:

Code: Select all

$ diff -r mode7.old mode7
diff -r mode7.old/buildme mode7/buildme
3c3
< cut -f2- -d, 1.csv | sed -n "/\[0x20\]/,//p" > 1.txt
---
> cut -f2- -d, 1.csv | sed -n '/\[0x20\]/,$p' | tail -n +12 > 1.txt
5a6,8
> echo -e "#define addreg(a, b) { a, b }\n\nstruct sensor_regs imx219_mode??[] =\n{" > 1.h
> sed -n '/0x0100, 0x01/,$p' 1.reg | sed -n '/0x0100, 0x00/,/0x0100, 0x01/p' >> 1.h
> echo "};" >> 1.h
diff -r mode7.old/clean mode7/clean
2c2
< rm 1.txt 1.reg split
---
> rm 1.txt 1.reg 1.h split
Only in mode7: imx219_modes.h
$ 

Now 1.reg is not the final generated file anymore, file 1.h with sensor_regs struct gets generated from 1.reg as well.
I copied modified imx219_modes.h into attached mode7.b.zip as well, for you and others to play with.

I do have many PIs and cameras with me at my secondary living place near IBM Böblingen lab, but this time no logic analyzer.
So I will do capturing of I2C register sets for modes 1-6 when back home on weekend.

This is one frame of first 640x480 raspiraw capture (only at 90fps) with Raspberry v2 NoIR camera, processed with dcraw:
Image
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Thu Jan 11, 2018 12:57 pm

Oops, missed the promised attachment, here it is.
Attachments
mode7.b.zip
mode7.b.zip
(12.03 KiB) Downloaded 3 times
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Thu Jan 11, 2018 7:28 pm

Thanks to @6by9, I just closed "-b 8 raspiraw" issue after "sudo rpi-update", reboot and fix verification.
https://github.com/6by9/raspiraw/issues ... -357027660

Now you can create GRAY8 images from raw8 bayer frame with this 1-liner (as alternative to "dcraw"):

Code: Select all

$ cat <(echo -e 'P5\n640 480\n255') out.401.raw | pgmtoppm | pnmtopng >out.401.raw.pgm.png
$ 

This frame was taken with v2 camera and experimental v2 "-md 7" mode for raspiraw from previous posting:
Image


I don't want to keep back a side-effect of treating the rg/gb raw8 bayer frame pixels as gray8 pixels.
The four pixels have different brightness, which is not reflected by the simple "to .pgm" transform (detail stretched 4x/4x):
Image


If you want a smoother image, reduction by factor 2 with netpbm tools "pamscale", with pamscale's default method of pixel mixing does help. This command creates a mixed 320x240 .png instead. You can try to zoom in, but the artefacts are gone with pixel mixing:

Code: Select all

$ cat <(echo -e 'P5\n640 480\n255') out.401.raw | pamscale -reduce 2 | pgmtoppm | pnmtopng > out.401.half.png
pamscale: reducing by 2 gives scale factor of 0.500000.
$  
Image


P.S:
First gray frame NoIR camera candle light slowmo:
viewtopic.php?f=43&t=199204&p=1257543#p1257543
Image
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Sat Jan 13, 2018 12:10 pm

6by9 wrote:
Mon Jan 08, 2018 4:48 pm
...
Part of the recent discussion was around my expectation that -b 8 would take the 8 most significant bits and pack them into 8 bit words, but the hardware actually takes the least significant 8 bits, dropping the 2 MSBs :(
That would have been bad, and luckily it is NOT true.
I did raspiraw capture with v2 camera and "-md 7", once with "-b 8" and once with "-b 10".
I did not change the camera or scene.
I did use "-hd0" option and copied the 5th raw frame taken with "-b 8" and "-b 10" from /dev/shm without any header.
As you can see the 1st and last line of hex dump do prove that in fact the highest 8 bits get taken, and the least significant 2 bits get dropped. It is not perfect since the frames are from different captures, but basically you need to shift the first 4 bytes of 1st line and first 4 bytes of last 5 bytes of last line "-b 10" bytes two to the left to get the "-b 8" values:

Code: Select all

$ od -tx1 8/out.0005.raw | head -1
0000000 41 41 40 42 40 42 41 42 40 41 40 41 41 41 41 41
$ od -tx1 10/out.0005.raw | head -1
0000000 10 10 10 10 45 10 10 10 10 58 10 10 10 10 40 10
$ 
$ od -tx1 8/out.0005.raw | tail -2
1127760 57 61 58 64 56 61 56 61 55 62 58 64 55 62 57 63
1130000
$ od -tx1 10/out.0005.raw | tail -2
1355760 f8 15 17 16 18 cd 15 19 16 18 83 16 19 16 18 01
1356000
$ 

This is after dcraw is applied to the "-b 10" frame, converted to .png finally for showing here:
Image


And this is after dcraw is applied to the "-b 8" frame, converted to .png finally for showing here:
Image


Summary:

1)
This is raw10 format (from https://developer.xamarin.com/api/field ... mat.Raw10/):

Code: Select all

	BIT 7	BIT 6	BIT 5	BIT 4	BIT 3	BIT 2	BIT 1	BIT 0
Byte 0:	P0[9]	P0[8]	P0[7]	P0[6]	P0[5]	P0[4]	P0[3]	P0[2]
Byte 1:	P1[9]	P1[8]	P1[7]	P1[6]	P1[5]	P1[4]	P1[3]	P1[2]
Byte 2:	P2[9]	P2[8]	P2[7]	P2[6]	P2[5]	P2[4]	P2[3]	P2[2]
Byte 3:	P3[9]	P3[8]	P3[7]	P3[6]	P3[5]	P3[4]	P3[3]	P3[2]
Byte 4:	P3[1]	P3[0]	P2[1]	P2[0]	P1[1]	P1[0]	P0[1]	P0[0]

And by experiment above this is raw8 format:

Code: Select all

	BIT 7	BIT 6	BIT 5	BIT 4	BIT 3	BIT 2	BIT 1	BIT 0
Byte 0:	P0[9]	P0[8]	P0[7]	P0[6]	P0[5]	P0[4]	P0[3]	P0[2]
Byte 1:	P1[9]	P1[8]	P1[7]	P1[6]	P1[5]	P1[4]	P1[3]	P1[2]
Byte 2:	P2[9]	P2[8]	P2[7]	P2[6]	P2[5]	P2[4]	P2[3]	P2[2]
Byte 3:	P3[9]	P3[8]	P3[7]	P3[6]	P3[5]	P3[4]	P3[3]	P3[2]

2)
As can be seen from both dcraw results above it does not make much sense to use "-b 8" when processing with dcraw is planned. BUT is perfectly makes sense to use "-b 8" in raspiraw callbacks for feature extraction and robot control, because that avoids conversion steps which is very good given the small time available for single frame processing (2.77ms in case of 360fps).


P.S:
I verified that Pi Zero with v1 camera (after rpi-update) has same behavior, 2 least significtant bits get dropped.
Image starts at 0100000 (octal), "10 10 0f 12" (raw8) versus "02 04 03 04 22" (raw10).

Code: Select all

pi@raspberrypi04:~/raspiraw $ od -tx1 out.0021.raw | head
0000000 42 52 43 4d 6f 00 00 00 00 00 00 00 00 00 00 00
0000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0000320 20 0a 98 07 00 00 00 00 00 00 00 00 00 00 00 00
0000340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000360 00 00 21 00 01 02 00 00 00 00 00 00 00 00 00 00
0000400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0100000 10 10 0f 12 0f 10 0f 10 12 10 0e 10 10 0f 0f 10
0100020 12 13 0f 12 0f 0f 0f 0f 0f 10 12 12 0f 10 0f 17
pi@raspberrypi04:~/raspiraw $ od -tx1 out.0021.b10.raw | head
0000000 42 52 43 4d 6f 00 00 00 00 00 00 00 00 00 00 00
0000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0000320 20 0a 98 07 00 00 00 00 00 00 00 00 00 00 00 00
0000340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000360 00 00 21 00 01 03 00 00 00 00 00 00 00 00 00 00
0000400 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0100000 02 04 03 04 22 03 03 03 03 dd 03 04 03 03 e2 03
0100020 03 03 03 ee 04 04 03 04 28 03 03 03 03 ef 03 03
pi@raspberrypi04:~/raspiraw $
Last edited by HermannSW on Sun Jan 14, 2018 3:34 pm, edited 1 time in total.
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

Jonathan_M
Posts: 2
Joined: Fri Jan 05, 2018 5:36 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Sat Jan 13, 2018 12:36 pm

Hi Hermann

I've been following your posts with interest as I am also working on a problem that will need higher speed, smaller ROI video. I'm pleased to see that the raw 8 format is available as it will be easier/faster to process.

Looking at the images though there is something else going on in the 8 bit image, beyond simply a drop in the number of bits for each pixel. The colours have shifted significantly (green->purple, orange->yellow/blue) and a lot of patterning of the background. Is there some problem or shift coming from the bayer filtering perhaps?

I'm actually after a mono image but that is a different problem.

Jonathan

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Sat Jan 13, 2018 12:59 pm

As I said, "-b 8" is definitely not good for dcraw (color) processing. But as shown in my 2nd last posting raw8 can be easily transformed to gray, and with halfresolution you get a nice image form "-b 8" frame:

Code: Select all

$ cat <(echo -e 'P5\n640 480\n255') out.0005.raw | pamscale -reduce 2 | pgmtoppm | pnmtopng > out.0005.half.png
pamscale: reducing by 2 gives scale factor of 0.500000.
$ 
Image


You might want to look starting at this posting on what I learned sofar for the image processing for my target application (robot following 1.5cm wide black line on white ground). The best algorithm is simply too slow (at least in OpenCV, can do process 50fps maximal):
viewtopic.php?f=43&t=189661#p1231151
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Tue Jan 16, 2018 6:01 pm

@6by9:
I did capture the missing modes 1-7 for v2 camera raspiraw usage. In attached .zip you can find the captured I2C sequences from Salea logic analyzer (.csv), the .h files generated from tools in previous mode7.b.zip attachment and finally new file imx219_modes.h with existing mode0 and new modes 1-7.

Please integrate imx219_modes.h into https://github.com/6by9/raspiraw
Feel free to change the last two colums, I made 2nd last column always height+4, which works but probably is not correct. I computed last columns for maximal fps being 1 higher as in v2 mode table in documentation.

These are the number of registers for each mode:
  • existing mode0 has 61 register settings
  • modes 1 and 4-7 have 75 addregs
  • mode 2 and 3 have 79 addregs
I did capture modes 1-7 with these commands:

Code: Select all

raspivid -md 7 -fps 90 -w 640 -h 480 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
raspivid -md 6 -fps 90 -w 1280 -h 720 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
raspivid -md 5 -fps 40 -w 1640 -h 922 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
raspivid -md 4 -fps 40 -w 1640 -h 1232 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0

raspivid -md 3 -fps 15 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
raspivid -md 2 -fps 15 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0

raspivid -md 1 -fps 30 -w 1920 -h 1080 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
I don't know why, but raspivid does not work for modes 2+3 if I specify -w and -h parameter, therefore I captured those modes without -w/-h. The generated files 2.h and 3.h are identical?!?

For comparison I did open frames processed with dcraw for all 8 modes. I did display mode7 first with "eog" image viewer and then stepped through the modes. The result is that the window size is 640x480 for all screenshots below, which has the advantage that the image sizes are small. At the bottom of each frame you can find the resolution of each image. And below sequence of screenshots allows for direct comparison of fov (field of view).

For v1 camera I have a working 320x240 mode (to be git pushed soon) that has same fov as v1 640x480 mode. Similar is needed for 640x480 v2 mode (have 3200x2400 fov).

I assume mode0 frame looks nicer because its regeisters were not captured with " -ex off -ss 1000 -ag 1.0 -dg 1.0".

mode7 (90fps):
Image

mode6 (90fps):
Image

mode5 (40fps):
Image

mode4 (40fps):
Image

mode3 (15fps):
Image

mode2 (15fps):
Image

mode1 (30fps):
Image

mode0 (11fps):
Image
Attachments
v2.modes.raspiraw.zip
captured v2 modes 1-7, imx219_modes.h
(27.39 KiB) Downloaded 2 times
Last edited by HermannSW on Thu Jan 18, 2018 5:41 pm, edited 2 times in total.
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4710
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raw sensor access / CSI-2 receiver peripheral

Tue Jan 16, 2018 6:12 pm

HermannSW wrote:
Tue Jan 16, 2018 6:01 pm
@6by9:
I did capture the missing modes 1-7 for v2 camera raspiraw usage. In attached .zip you can find the captured I2C sequences from Salea logic analyzer (.csv), the .h files generated from tools in previous mode7.b.zip attachment and finally new file imx219_modes.h with existing mode0 and new modes 1-7.

Please integrate imx219_modes.h into https://github.com/6by9/raspiraw
Feel free to change the last two colums, I made 2nd last column always height+4, which works but probably is not correct. I computed last columns for maximal fps being 1 higher as in v2 mode table in documentation.
Thank you.
Modes 2&3 are identical - the extra one was inserted so that the order matched that of the V1.3 where there was the 1/6-1fps mode 3.
HermannSW wrote:I did capture modes 1-7 with these commands:

Code: Select all

raspivid -md 7 -fps 90 -w 640 -h 480 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
raspivid -md 6 -fps 90 -w 1280 -h 720 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
raspivid -md 5 -fps 40 -w 1640 -h 922 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
raspivid -md 4 -fps 40 -w 1640 -h 1232 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0

raspivid -md 3 -fps 15 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
raspivid -md 2 -fps 15 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0

raspivid -md 1 -fps 30 -w 1920 -h 1080 -o t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
I don't know why, but raspivid does not work for modes 2+3 if I specify -w and -h parameter, therefore I captured those modes without -w/-h. The generated files 2.h and 3.h are identical?!?
-w and -h set the OUTPUT resolution. The codec can't cope with anything above 1080P so will throw an error. There is no link between the mode and -w/-h if you used -md, so you could have set them all to 640x480 and it would have worked. Without -w/-h it will default to 1080P which is possible.
HermannSW wrote:For v1 camera I have a working 320x240 mode (to be git pushed soon) that has same fov as v1 640x480 mode. Similar is needed for 640x480 v2 mode (have 3200x2400 fov).
Nice. I tried setting up a 320x240 mode by increasing the skips, but failed.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

HermannSW
Posts: 390
Joined: Fri Jul 22, 2016 9:09 pm

Re: Raw sensor access / CSI-2 receiver peripheral

Tue Jan 16, 2018 6:47 pm

Thanks for the explanations.

Please integrate this different mode7 register set.
I remembered that v2 camera can do 120fps with raspivid without any tricks:
viewtopic.php?f=43&t=201728#p1256653

So I captured this command:

Code: Select all

$ raspivid -md 7 -fps 120 -w 640 -h 480 -o /dev/shm/t.h264 -t 3000 -ex off -ss 1000 -ag 1.0 -dg 1.0
$

The important difference to previous command was storing the video in /dev/shm, on SD card only 90fps can be achieved. This is modified "640x480" capturing tool proving that really 120fps get captured without any frame skips:

Code: Select all

$ ./640x480 5000
removing /dev/shm/out.*.raw
capturing frames for 5000ms with 120fps requested
602 frames were captured at 120fps
frame delta time[us] distribution
      1 
     97 8295
    503 8296
      1 8297
after skip frame indices (middle column)
0% frame skips
$ 

This is 120fps mode7 register set:
struct sensor_regs imx219_mode7[] =
{
addreg(0x0100, 0x00),
addreg(0x30eb, 0x05),
addreg(0x30eb, 0x0c),
addreg(0x300a, 0xff),
addreg(0x300b, 0xff),
addreg(0x30eb, 0x05),
addreg(0x30eb, 0x09),
addreg(0x0114, 0x01),
addreg(0x0128, 0x00),
addreg(0x012a, 0x18),
addreg(0x012b, 0x00),
addreg(0x0157, 0x00),
addreg(0x015a, 0x01),
addreg(0x015b, 0x85),
addreg(0x0160, 0x01),
addreg(0x0161, 0x89),
addreg(0x0162, 0x0d),
addreg(0x0163, 0xe8),
addreg(0x0164, 0x03),
addreg(0x0165, 0xe8),
addreg(0x0166, 0x08),
addreg(0x0167, 0xe7),
addreg(0x0168, 0x02),
addreg(0x0169, 0xf0),
addreg(0x016a, 0x06),
addreg(0x016b, 0xaf),
addreg(0x016c, 0x02),
addreg(0x016d, 0x80),
addreg(0x016e, 0x01),
addreg(0x016f, 0xe0),
addreg(0x0170, 0x01),
addreg(0x0171, 0x01),
addreg(0x0174, 0x03),
addreg(0x0175, 0x03),
addreg(0x018c, 0x0a),
addreg(0x018d, 0x0a),
addreg(0x0301, 0x05),
addreg(0x0303, 0x01),
addreg(0x0304, 0x03),
addreg(0x0305, 0x03),
addreg(0x0306, 0x00),
addreg(0x0307, 0x39),
addreg(0x0309, 0x0a),
addreg(0x030b, 0x01),
addreg(0x030c, 0x00),
addreg(0x030d, 0x72),
addreg(0x455e, 0x00),
addreg(0x471e, 0x4b),
addreg(0x4767, 0x0f),
addreg(0x4750, 0x14),
addreg(0x4540, 0x00),
addreg(0x47b4, 0x14),
addreg(0x4713, 0x30),
addreg(0x478b, 0x10),
addreg(0x478f, 0x10),
addreg(0x4793, 0x10),
addreg(0x4797, 0x0e),
addreg(0x479b, 0x0e),
addreg(0x0172, 0x03),
addreg(0x0160, 0x01),
addreg(0x0161, 0xaa),
addreg(0x0162, 0x0d),
addreg(0x0163, 0xe7),
addreg(0x015a, 0x00),
addreg(0x015b, 0x2f),
addreg(0x0157, 0x00),
addreg(0x0157, 0x00),
addreg(0x0160, 0x01),
addreg(0x0161, 0xaa),
addreg(0x0162, 0x0d),
addreg(0x0163, 0xe7),
addreg(0x015a, 0x00),
addreg(0x015b, 0x2f),
addreg(0x0100, 0x01),
};

And this is modified mode7 "struct mode_def" line:

Code: Select all

   { imx219_mode7, NUM_ELEMENTS(imx219_mode7),  640,  480, 0, BAYER_ORDER_BGGR, 10, 0x2B, 2,  484, 17075 },

I did convert a frame captured with this new mode7 at 120fps with dcraw, here it is:
Image

For comparison the previous 90fps mode7 screenshot:
Image
--> Raspberry camera / gstreamer / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/6by9/raspiraw      https://github.com/Hermann-SW/raspiraw

Return to “Camera board”

Who is online

Users browsing this forum: No registered users and 18 guests