Difference between revisions of "New image sensors for 10393"
From ElphelWiki
(→Developing a driver) |
(→in device tree) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
[[File:10393_cpu_fpga_i2c_records_table.png|thumb|700px|Fig.2 FPGA has a certain 256-line table (for all ports)]] | [[File:10393_cpu_fpga_i2c_records_table.png|thumb|700px|Fig.2 FPGA has a certain 256-line table (for all ports)]] | ||
− | ==== | + | ====Device tree==== |
* record for sensor, like: | * record for sensor, like: | ||
<font size=1>elphel393_mt9f002: elphel393-mt9f002@0 { | <font size=1>elphel393_mt9f002: elphel393-mt9f002@0 { | ||
Line 37: | Line 37: | ||
};</font> | };</font> | ||
− | * | + | ====Add a proper application==== |
− | * | + | * In '''autocampars.php''' |
+ | * Set application through 10389's serial or more preferably through /etc/elphel393/default_10389.xml in a 10389-less setup | ||
+ | ====Driver code==== | ||
* In ''linux-elphel/src/drivers/elphel/'' | * In ''linux-elphel/src/drivers/elphel/'' | ||
** Create mt9f002.h and mt9f002.c | ** Create mt9f002.h and mt9f002.c | ||
Line 47: | Line 49: | ||
** mt9f002.h - fill with registers addresses (from sensor's datasheet) and other constants | ** mt9f002.h - fill with registers addresses (from sensor's datasheet) and other constants | ||
** mt9f002.c: | ** mt9f002.c: | ||
− | mt9f002_par2addr table | + | <font size=1>mt9f002_par2addr table |
mt9f002_pages table | mt9f002_pages table | ||
mt9f002_ahead_tab - no need to edit in the beginning | mt9f002_ahead_tab - no need to edit in the beginning | ||
Line 61: | Line 63: | ||
mt9f002_pgm_limitfps func | mt9f002_pgm_limitfps func | ||
mt9f002_pgm_exposure func | mt9f002_pgm_exposure func | ||
− | mt9f002_pgm_triggermode func | + | mt9f002_pgm_triggermode func</font> |
[[Category:393]] | [[Category:393]] |
Latest revision as of 17:07, 16 April 2018
Contents
Description
This page describes development and testing of any new sensors for 10393 system boards. It covers a driver-less mode where python scripts are used to get the first images and the sensor driver structure.
Application notes
Driverless mode
- Read this article
Developing a driver
Device tree
- record for sensor, like:
elphel393_mt9f002: elphel393-mt9f002@0 { compatible = "elphel,elphel393-mt9f002-1.00"; };
- record for sensor i2c address, like:
elphel393_sensor_i2c: elphel393-sensor-i2c@0 { compatible = "elphel,elphel393-sensor-i2c-1.00"; /* Add known devices: name, slave address (7-bit), number of address bytes, number of data bytes, SCL frequency (kHz) */ elphel393-sensor-i2c,i2c_devices = "mt9f002 0x10 2 2 500", "mt9p006 0x48 1 2 500", "el10359 0x08 1 2 500", "el10359_32 0x08 1 4 500", "pca9500_eeprom 0x50 1 1 100", "sensor_eeprom 0x50 1 1 100", "sensor_temp 0x18 1 2 100", "cy22393 0x69 1 1 100"; };
- edit detected sensors:
elphel393_detect_sensors: elphel393-detect_sensors@0 { compatible = "elphel,elphel393-detect_sensors-1.00"; elphel393-detect_sensors,port-mux = "none none none none"; /* "none", "detect" or "mux10359" */ elphel393-detect_sensors,sensors = "mt9f002", // Line per port, may contain up to 4 sensors (3 with 10359) "mt9f002", "mt9f002", "mt9f002"; };
Add a proper application
- In autocampars.php
- Set application through 10389's serial or more preferably through /etc/elphel393/default_10389.xml in a 10389-less setup
Driver code
- In linux-elphel/src/drivers/elphel/
- Create mt9f002.h and mt9f002.c
- Add to Makefile:
obj-$(CONFIG_ELPHEL393) += mt9f002.o
- Edit pgm_functions.c
- mt9f002.h - fill with registers addresses (from sensor's datasheet) and other constants
- mt9f002.c:
mt9f002_par2addr table mt9f002_pages table mt9f002_ahead_tab - no need to edit in the beginning sensor_t structure - some fields are used, some - not mt9f002_inits - registers that must be initialized mt9f002_pgm_detectsensor func - remove mrst and read id via i2c, register other functions mt9f002_pgm_initsensor func - applies init i2c commands, cable phase adjustment, gain table and shadow regs mt9f002_pgm_sensorin func - this just set MT9F002_VACT_DELAY because of sensor's specifics mt9f002_pgm_window func - uses mt9f002_pgm_window_common mt9f002_pgm_window_safe func - uses mt9f002_pgm_window_common mt9f002_pgm_window_common func - change window, also sets horizontal blanking mt9f002_pgm_gains func mt9f002_pgm_limitfps func mt9f002_pgm_exposure func mt9f002_pgm_triggermode func