Difference between revisions of "Driverless mode 393"

From ElphelWiki
Jump to: navigation, search
(Example: 1600x1200 window)
(pre (editing files on the boot SD card))
 
(4 intermediate revisions by the same user not shown)
Line 4: Line 4:
  
 
==Instructions==
 
==Instructions==
===pre===
+
===pre (editing files on the boot SD card)===
* to load bitstream for MT9F002 appropriate changes need to be made to:
+
* Remove 10389 board if installed (otherwise will have to rewrite eeprom)
** device tree
+
* To load bitstream for MT9F002 appropriate changes need to be made to:
 +
** (not necessary, can skip) device tree
 
  <font size=2>set sensors to '''mt9f002''' in ''elphel393-detect_sensors,sensors'' entry</font>
 
  <font size=2>set sensors to '''mt9f002''' in ''elphel393-detect_sensors,sensors'' entry</font>
 
** /etc/elphel393/default_10389.xml for setup w/o 10389 or 10389's eeprom otherwise write '''MT9F002''' as application
 
** /etc/elphel393/default_10389.xml for setup w/o 10389 or 10389's eeprom otherwise write '''MT9F002''' as application
 +
Application name must be already added to '''/usr/local/autocampars.php'''
 
* Disable driver
 
* Disable driver
 
  <font size=2>root@elphel393~# touch /etc/elphel393/disable_driver
 
  <font size=2>root@elphel393~# touch /etc/elphel393/disable_driver
Line 84: Line 86:
 
* copy (from an ssh session in another terminal)
 
* copy (from an ssh session in another terminal)
 
  <font size=2>scp /usr/local/verilog/sensor_dump ip@host:/path/1600x1200_8bit.raw</font>
 
  <font size=2>scp /usr/local/verilog/sensor_dump ip@host:/path/1600x1200_8bit.raw</font>
 +
* open:
 +
<font size=2>Use imagej: File > Import > Raw...</font>
 
====16-bit raw====
 
====16-bit raw====
 
* setup
 
* setup
Line 104: Line 108:
 
* copy (from an ssh session in another terminal)
 
* copy (from an ssh session in another terminal)
 
  <font size=2>scp /usr/local/verilog/sensor_dump ip@host:/path/1600x1200_16bit.raw</font>
 
  <font size=2>scp /usr/local/verilog/sensor_dump ip@host:/path/1600x1200_16bit.raw</font>
 +
* open:
 +
<font size=2>Use imagej: File > Import > Raw...</font>
  
 
===Example: other window sizes===
 
===Example: other window sizes===
 
* Download and run [https://git.elphel.com/Elphel/x393/blob/master/py393/mt9f002_window_generator.py mt9f002_window_generator.py]
 
* Download and run [https://git.elphel.com/Elphel/x393/blob/master/py393/mt9f002_window_generator.py mt9f002_window_generator.py]
 
* Then edit the code snippets for 1600x1200 according to the new window size
 
* Then edit the code snippets for 1600x1200 according to the new window size
 +
* If getting raw sensor data 8-bit and 16-bit the membridge buffer is 4MB, so calculate accordingly:
 +
for 8-bit : '''WxH < 4M'''
 +
for 16-bit: '''WxH < 2M'''
 +
If not then - the buffer is circular which will result in overwriting of the beginning of the image
  
 
[[Category:393]]
 
[[Category:393]]

Latest revision as of 12:11, 23 April 2019

Description

Instructions on how to disable sensor driver and get images from image sensor (for MT9F002 sensor)


Instructions

pre (editing files on the boot SD card)

  • Remove 10389 board if installed (otherwise will have to rewrite eeprom)
  • To load bitstream for MT9F002 appropriate changes need to be made to:
    • (not necessary, can skip) device tree
set sensors to mt9f002 in elphel393-detect_sensors,sensors entry
    • /etc/elphel393/default_10389.xml for setup w/o 10389 or 10389's eeprom otherwise write MT9F002 as application
Application name must be already added to /usr/local/autocampars.php
  • Disable driver
root@elphel393~# touch /etc/elphel393/disable_driver
# then reboot

init

  • start python session:
root@elphel393~# cd /usr/local/verilog/; test_mcntrl.py @hargs-after
  • init (if the driver is not disabled the i2c writes will not work):
setup_all_sensors True None 0x1 False 4384 3280

write_sensor_i2c 0 1 0 0x31c08000 # hispi timing
write_sensor_i2c 0 1 0 0x030600b4 # pll multiplier
write_sensor_i2c 0 1 0 0x31c68400 # hispi control status
write_sensor_i2c 0 1 0 0x306e9280 # datapath select
write_sensor_i2c 0 1 0 0x301a001c # reset and start streaming

hispi_phases_adjust 0

write_sensor_i2c 0 1 0 0x301a001c # reset and start streaming

setup_all_sensors True None 0x1 False 4384 3280
compressor_control all None None None None None 2
program_gamma all 0 0.57 0.04

write_sensor_i2c 0 1 0 0x3028000a # global gain
write_sensor_i2c 0 1 0 0x302c000d # some gain
write_sensor_i2c 0 1 0 0x302e0010 # some gain
write_sensor_i2c 0 1 0 0x30120080 # coarse exposure

jpeg_acquire_write

#write_sensor_i2c 0 1 0 0x301a0018 # put to standby
  • inspect image:
http://192.168.0.9/img.jpeg

Example: 1600x1200 window

8-bit compress to jpeg

  • setup:
write_sensor_i2c 0 1 0 0x3002001e
write_sensor_i2c 0 1 0 0x300604f5
write_sensor_i2c 0 1 0 0x034e04d8
write_sensor_i2c 0 1 0 0x300a056a
write_sensor_i2c 0 1 0 0x30040090
write_sensor_i2c 0 1 0 0x300806cf
write_sensor_i2c 0 1 0 0x034c0640
write_sensor_i2c 0 1 0 0x300c04c8

setup_all_sensors True None 0x1 False 1600 1200
compressor_control all None None None None None 2

write_sensor_i2c 0 1 0 0x301a001c
# wait
write_sensor_i2c 0 1 0 0x301a0018

jpeg_acquire_write
  • inspect:
refresh http://192.168.0.9/img.jpeg

8-bit raw

  • setup
same as above, no need to repeat if already done
  • capture (copy-pasting the code below with comments will work)
setup_all_sensors True None 0x1 False 1600 1200

write_sensor_i2c 0 1 0 0x301a001c
# wait
write_sensor_i2c 0 1 0 0x301a0018

# notice membridge_start (under Setting membridge for sensor 0)
# it can be different: 0x2e000000 or 0x2dc00000

membridge_start
mem_save "/usr/local/verilog/sensor_dump" 0x2e000000 0x400000
  • copy (from an ssh session in another terminal)
scp /usr/local/verilog/sensor_dump ip@host:/path/1600x1200_8bit.raw
  • open:
Use imagej: File > Import > Raw...

16-bit raw

  • setup
same as above, no need to repeat if already done
  • capture (copy-pasting the code below with comments will work)
# Notice that the window width in 16 bit mode is 2x
setup_all_sensors True 18 0x1 False 3200 1200
set_sensor_mode 0 1 1 True True
enable_memcntrl_en_dis 12 True

write_sensor_i2c 0 1 0 0x301a001c
# wait
write_sensor_i2c 0 1 0 0x301a0018
 
# notice membridge_start (under Setting membridge for sensor 0)
# it can be different: 0x2e000000 or 0x2dc00000

membridge_start
mem_save "/usr/local/verilog/sensor_dump" 0x2e000000 0x400000
  • copy (from an ssh session in another terminal)
scp /usr/local/verilog/sensor_dump ip@host:/path/1600x1200_16bit.raw
  • open:
Use imagej: File > Import > Raw...

Example: other window sizes

  • Download and run mt9f002_window_generator.py
  • Then edit the code snippets for 1600x1200 according to the new window size
  • If getting raw sensor data 8-bit and 16-bit the membridge buffer is 4MB, so calculate accordingly:
for 8-bit : WxH < 4M
for 16-bit: WxH < 2M
If not then - the buffer is circular which will result in overwriting of the beginning of the image