Difference between revisions of "New image sensors for 10393"

From ElphelWiki
Jump to: navigation, search
(Created page with "==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 f...")
 
(in device tree)
 
(5 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
* Read [[Driverless_mode_393|this article]]
 
* Read [[Driverless_mode_393|this article]]
 
===Developing a driver===
 
===Developing a driver===
{|
+
[[File:10393 sensor driver structure.png|thumb|700px|Fig.1 Sensor driver]]
|[[File:10393 sensor driver structure.png|thumb|700px|Fig.1 Sensor driver]]
+
[[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)]]
 
|}
 
  
* In device tree:
+
====Device tree====
** record for sensor, like:
+
* record for sensor, like:
    elphel393_mt9f002: elphel393-mt9f002@0 {
+
<font size=1>elphel393_mt9f002: elphel393-mt9f002@0 {
        compatible = "elphel,elphel393-mt9f002-1.00";
+
    compatible = "elphel,elphel393-mt9f002-1.00";
    };
+
};</font>
** record for sensor i2c address, like:
+
* record for sensor i2c address, like:
    elphel393_sensor_i2c: elphel393-sensor-i2c@0 {
+
<font size=1>elphel393_sensor_i2c: elphel393-sensor-i2c@0 {
                compatible = "elphel,elphel393-sensor-i2c-1.00";
+
    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) */
+
    /* 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",
+
    elphel393-sensor-i2c,i2c_devices = "mt9f002        0x10 2 2 500",
                                                  "mt9p006        0x48 1 2 500",
+
                                        "mt9p006        0x48 1 2 500",
                                                  "el10359        0x08 1 2 500",
+
                                        "el10359        0x08 1 2 500",
                                                  "el10359_32    0x08 1 4 500",
+
                                        "el10359_32    0x08 1 4 500",
                                                  "pca9500_eeprom 0x50 1 1 100",
+
                                        "pca9500_eeprom 0x50 1 1 100",
                                                  "sensor_eeprom  0x50 1 1 100",
+
                                        "sensor_eeprom  0x50 1 1 100",
                                                  "sensor_temp    0x18 1 2 100",
+
                                        "sensor_temp    0x18 1 2 100",
                                                  "cy22393        0x69 1 1 100";
+
                                        "cy22393        0x69 1 1 100";
    } ;
+
};</font>
 +
* edit detected sensors:
 +
<font size=1>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";
 +
};</font>
  
** edit detected sensors:
+
====Add a proper application====
    elphel393_detect_sensors: elphel393-detect_sensors@0 {
+
* In '''autocampars.php'''
        compatible = "elphel,elphel393-detect_sensors-1.00";
+
* Set application through 10389's serial or more preferably through /etc/elphel393/default_10389.xml in a 10389-less setup
        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";
 
    };
 
 
 
* edit '''autocampars.php''' - add a proper application
 
* 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
 
** Add to Makefile:
 
** Add to Makefile:
  obj-$(CONFIG_ELPHEL393)           += mt9f002.o
+
  <font size=1>obj-$(CONFIG_ELPHEL393) += mt9f002.o</font>
 
** Edit pgm_functions.c
 
** Edit pgm_functions.c
 
** 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 66: 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 18:07, 16 April 2018

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

Developing a driver

Fig.1 Sensor driver
Fig.2 FPGA has a certain 256-line table (for all ports)

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