Configuring Aptina MT9P031 using i2c-tools
Introduction
This page shows how to access the MT9P031 registers using i2c-tool in order to read and/or write them.
How to know where your sensor is?
If you didn't know in which i2c address your sensor is you can find it easily by following the next steps:
1. Don't connect your camera module to the board and start it.
2. Once it started run the following command in your board's terminal:
i2cdetect -l
This command will show you any I2C bus available. In our case it will outputs something like this:
i2c-1 i2c DaVinci I2C adapter I2C adapter
This tell us we have one I2C bus which ID is i2c-1.
3. Once you got the I2C bus name you can get a map of the I2C devices connected to it by running
i2cdetect -y <numerical_id>
where numerical_id is the number that ends your I2C bus's ID. In our case we can run i2cdetect -y 1 and it will outputs the following map:
0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- 08 -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
4. Turn off you board, connect the camera module and repeat the process until get the I2C bus map. You will get something like this:
0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- 08 -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
We can see now the presence of the camera sensor at the address 0x48, we need this address in order to tell the i2c-tools which device we want to access.