I am interested in "--shutter" option for raspiraw, so I needed to find out which I2C commands get send from GPU to camera. I used my Pi 2B like many times before for capturing I2C traffic to camera, connecting logic analyzer to tin soler balls on PP39 and PP40, and decoded the I2C traffic:
I remebered that adding "-ex off" had very good effects on reliable recreatable I2C sequences from GPU to camera and therefore used this modified command changing shutter speed for each frame at 49fps:
This is one set co I2C commands for a frame:
Code: Select all
6.522430500000000,I2C,Setup Write to [0x20] + ACK
6.522520500000000,I2C,0x01 + ACK
6.522610500000000,I2C,0x60 + ACK
6.522700500000000,I2C,0x04 + ACK
6.522790500000000,I2C,0x15 + ACK
6.522910500000000,I2C,Setup Write to [0x20] + ACK
6.523000500000000,I2C,0x01 + ACK
6.523090500000000,I2C,0x62 + ACK
6.523180500000000,I2C,0x0D + ACK
6.523270500000000,I2C,0xE7 + ACK
6.523390500000000,I2C,Setup Write to [0x20] + ACK
6.523480500000000,I2C,0x01 + ACK
6.523570500000000,I2C,0x5A + ACK
6.523660500000000,I2C,0x00 + ACK
6.523750500000000,I2C,0x65 + ACK
This is the other:
Code: Select all
6.542780500000000,I2C,Setup Write to [0x20] + ACK
6.542870500000000,I2C,0x01 + ACK
6.542960500000000,I2C,0x60 + ACK
6.543050500000000,I2C,0x04 + ACK
6.543140500000000,I2C,0x15 + ACK
6.543260500000000,I2C,Setup Write to [0x20] + ACK
6.543350500000000,I2C,0x01 + ACK
6.543440500000000,I2C,0x62 + ACK
6.543530500000000,I2C,0x0D + ACK
6.543620500000000,I2C,0xE7 + ACK
6.543740500000000,I2C,Setup Write to [0x20] + ACK
6.543830500000000,I2C,0x01 + ACK
6.543920500000000,I2C,0x5A + ACK
6.544010500000000,I2C,0x01 + ACK
6.544100500000000,I2C,0x99 + ACK
0160 (FRM_LENGTH_A) and 0162 (LINE_LENGTH_A) are always set to identical values and can be ignored for shutter time.
The difference is in 015A (COARSE_INTEGRATION_TIME_A):
0x0065 is 101, 0x0199 is 409, for values 2000/8000.
To be sure I ran same capture with 3000/5000 and got 0x0099 (153) and 0x00FF (255). So 409 corresponds to shutter time 8000.
For good factor determination I did other runs for higher shutter times and saw maximal 0x410 (1040) corresponding to just above 20000. I did a last run with 20000 and saw 0x0400 for 20000.
Summary for v2 camera:
Setting shutter time for X microseconds is done by wring X/20000*1024 to registers 015A/015B.
I connected v1 camera and did I2C decodings, these 3 registers change:
0x3500 EXPOSURE 0x00 RW Bit[7:4]: Not used Bit[3:0]: Exposure[19:16]
0x3501 EXPOSURE 0x00 RW Bit[7:0]: Exposure[15:8]
0x3502 EXPOSURE 0x20 RW Bit[7:0]: Exposure[7:0]
For sutter time 2000 I saw 0x0005F0 (1520), for 10000 I saw 0x001D50 (7504). The upper limit for v1 camera is just above 16600, and I saw 0x002F40 (12096) for 16000.
Summary for v1 camera:
Setting shutter time for X microseconds is done by writing X/16000*12096 to registers 350[0-2].