User Tools

Site Tools


code:fx3_hvci_and_fpga_i_c_commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
code:fx3_hvci_and_fpga_i_c_commands [2019/11/13 00:27]
Igor Yefmov [0xA8-0xA9 - sysinfo and debugging]
code:fx3_hvci_and_fpga_i_c_commands [2020/12/17 00:25] (current)
Igor Yefmov [0xFB-0xFF - Reserved for debug APIs]
Line 13: Line 13:
     S2R::I2C fx3;     S2R::I2C fx3;
     fx3.open(0);     fx3.open(0);
-    fx3.vrCmd(0xDF, S2R::FX3::write, 6000, 0);+    fx3.vrCmd(S2R::FX3::af_au_period, S2R::FX3::write, 6000, 0);
 } }
  
Line 44: Line 44:
 ---- ----
  
-====== FX3 Host Vendor Command Reference ====== +====== FX3 API Reference ======
 The following tables provide information on how to access the camera's functionality for ''FX3 Host Vendor Command Interface''. The address space is split into smaller chunks, grouped by common functionality: The following tables provide information on how to access the camera's functionality for ''FX3 Host Vendor Command Interface''. The address space is split into smaller chunks, grouped by common functionality:
 ===== 0x00-0x9F ===== ===== 0x00-0x9F =====
Line 54: Line 53:
 ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^
 |Bootloader check|''0xA0''| | |R/W| | |Check if a bootloader is running, the result is in the command's status code (success/failure interpreted as ''true''/''false'')| |Bootloader check|''0xA0''| | |R/W| | |Check if a bootloader is running, the result is in the command's status code (success/failure interpreted as ''true''/''false'')|
-|Reserved|''0xA1''| | | | | | |+|MS OS Descr.|''0xA1''|bits ''3:0'' - see notes | |R/O|''174''|MS OS Platform Descriptor|For details on the structure and valid parameters' values refer to Microsoft's documentation for [[https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-os-2-0-descriptors-specification|Microsoft OS 2.0 Descriptors Specification]]\\ The 4 LSB of the ''wIndex'' field are the descriptor's index. Valid values are:\\ ''7'' - MS OS 2.0 descriptor\\ ''8'' - MS OS 2.0 set alternative enumeration (currently not supported)|
 |Run DPC calibration|''0xA2''| |DPC Threshold|W/O| | |Start the dynamic DPC calibration with the given DPC Threshold in range [0..255]| |Run DPC calibration|''0xA2''| |DPC Threshold|W/O| | |Start the dynamic DPC calibration with the given DPC Threshold in range [0..255]|
-|Reconfig FGPA|''0xA3''| | |W/O| | |Writing anything into this register causes the FPGA to reconfigure itself from SPI Flash|+|Reserved|''0xA3''| | | | | | |
 |FPGA I²C Bridge|''0xA4''|FPGA register offset|FPGA data (write)|R/W|''0'' or ''1''|''7:0'' - FPGA data|FPGA write returns 0 byte buffer, FPGA read returns 1 byte buffer. Read/write is requested via control endpoint's direction attribute being set to ''DIR_FROM_DEVICE''/''DIR_TO_DEVICE''.\\ For details on individual commands refer to [[#FPGA I²C bridge|FPGA I²C bridge]]| |FPGA I²C Bridge|''0xA4''|FPGA register offset|FPGA data (write)|R/W|''0'' or ''1''|''7:0'' - FPGA data|FPGA write returns 0 byte buffer, FPGA read returns 1 byte buffer. Read/write is requested via control endpoint's direction attribute being set to ''DIR_FROM_DEVICE''/''DIR_TO_DEVICE''.\\ For details on individual commands refer to [[#FPGA I²C bridge|FPGA I²C bridge]]|
 |Sensor I²C bridge (8-bit configuration registers)|''0xA5''| Sensor register | ''mask'' and ''data'' (if writing) - see Notes column for details |R/W|''0'' or ''1''| ''7:0'' - sensor register's data | ''mask'' - an 8-bit MSB that specifies which bits to affect during a write operation - only the bits that are set in ''mask'' will be affected by bits in ''data''. Setting ''mask'' to ''0'' ultimately turns a write operation into a read one as no bits are getting modified\\ ''data'' - an 8-bit LSB that specifies the new data to write into sensor's register. The write only affects the bits that are set in ''mask''\\ Read operation returns an 8-bit register's value\\ Read/write is requested via control endpoint's direction attribute being set to ''DIR_FROM_DEVICE''/''DIR_TO_DEVICE''.\\ For details on each sensor's register's function refer to the sensor's specification | |Sensor I²C bridge (8-bit configuration registers)|''0xA5''| Sensor register | ''mask'' and ''data'' (if writing) - see Notes column for details |R/W|''0'' or ''1''| ''7:0'' - sensor register's data | ''mask'' - an 8-bit MSB that specifies which bits to affect during a write operation - only the bits that are set in ''mask'' will be affected by bits in ''data''. Setting ''mask'' to ''0'' ultimately turns a write operation into a read one as no bits are getting modified\\ ''data'' - an 8-bit LSB that specifies the new data to write into sensor's register. The write only affects the bits that are set in ''mask''\\ Read operation returns an 8-bit register's value\\ Read/write is requested via control endpoint's direction attribute being set to ''DIR_FROM_DEVICE''/''DIR_TO_DEVICE''.\\ For details on each sensor's register's function refer to the sensor's specification |
Line 62: Line 61:
 |RAW Mode Select|''0xA7''| | |R/W| 1 |''7:1'' - Reserved\\ ''0'' - RAW Mode  |Select RAW Mode ('1') or Processed Video ('0')\\ **N.B.** This has been moved here from ''0xA5'' in FX3 version 46| |RAW Mode Select|''0xA7''| | |R/W| 1 |''7:1'' - Reserved\\ ''0'' - RAW Mode  |Select RAW Mode ('1') or Processed Video ('0')\\ **N.B.** This has been moved here from ''0xA5'' in FX3 version 46|
  
-===== 0xA8-0xA9 - sysinfo and debugging =====+===== 0xA8-0xA9 - sysinfo =====
 ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^
 |Sysinfo|''0xA8''|data structure version (currently only ''1'' is supported) | bitmask of additional checks to perform:\\ ''0'' - check memory integrity\\ ''1'' - check DMA integrity\\ ''2''-''7'': reserved |R/O|V1: ''30''| **Supported features** (byte #5)\\ ''0'' - USB3\\ ''1'' - OTG (USB 2.0 host mode)\\ ''2'' - 512KB RAM\\ ''3'' - I2S\\ ''4'' - GPIF (under 32bits)\\ ''5'' - GPIF32\\ **Configured features** (byte #6)\\ ''0'' - I²C\\ ''1'' - I2S\\ ''2'' - UART\\ ''3'' - SPI\\ ''4'' - PIB on/off\\ ''5'' - DLL status\\ ''6'' - LPP on/off |Get various internal system info on the guts of the RTOS and the firmware running on FX3. Returned bytes:\\ **Version 1** (FX3 #52):\\ 0 - uint32_t: system uptime in ms ticks\\ 4 - uint8_t: Cypress part number\\ 5 - uint8_t: supported features\\ 6 - uint8_t: configured features\\ 7 - uint8_t: USB speed (0, 1, 2, 3 for: disconnected, FS, HS, SS)\\ 8 - uint32_t: memory alloc() count\\ 12 - uint32_t: memory free() count\\ 16 - uint32_t: DMA alloc() count\\ 20 - uint32_t: DMA free() count\\ 24 - uint16_t: PHY error count\\ 26 - uint16_t: LINK error count\\ 28 - uint8_t: status of memory corruption check\\ 29 - uint8_t: status of DMA corruption check| |Sysinfo|''0xA8''|data structure version (currently only ''1'' is supported) | bitmask of additional checks to perform:\\ ''0'' - check memory integrity\\ ''1'' - check DMA integrity\\ ''2''-''7'': reserved |R/O|V1: ''30''| **Supported features** (byte #5)\\ ''0'' - USB3\\ ''1'' - OTG (USB 2.0 host mode)\\ ''2'' - 512KB RAM\\ ''3'' - I2S\\ ''4'' - GPIF (under 32bits)\\ ''5'' - GPIF32\\ **Configured features** (byte #6)\\ ''0'' - I²C\\ ''1'' - I2S\\ ''2'' - UART\\ ''3'' - SPI\\ ''4'' - PIB on/off\\ ''5'' - DLL status\\ ''6'' - LPP on/off |Get various internal system info on the guts of the RTOS and the firmware running on FX3. Returned bytes:\\ **Version 1** (FX3 #52):\\ 0 - uint32_t: system uptime in ms ticks\\ 4 - uint8_t: Cypress part number\\ 5 - uint8_t: supported features\\ 6 - uint8_t: configured features\\ 7 - uint8_t: USB speed (0, 1, 2, 3 for: disconnected, FS, HS, SS)\\ 8 - uint32_t: memory alloc() count\\ 12 - uint32_t: memory free() count\\ 16 - uint32_t: DMA alloc() count\\ 20 - uint32_t: DMA free() count\\ 24 - uint16_t: PHY error count\\ 26 - uint16_t: LINK error count\\ 28 - uint8_t: status of memory corruption check\\ 29 - uint8_t: status of DMA corruption check|
Line 74: Line 73:
 |FPGA config. ctrl.|''0xAD''| | |W/O| | |Any write to this location will put the FPGA into configuration mode| |FPGA config. ctrl.|''0xAD''| | |W/O| | |Any write to this location will put the FPGA into configuration mode|
 |FPGA config. status - SPI codes|''0xAE''| | |R/O|''2''| see [[#FPGA config status - SPI codes|below]] for details |Retrieve detailed status of the FPGA configuration operation| |FPGA config. status - SPI codes|''0xAE''| | |R/O|''2''| see [[#FPGA config status - SPI codes|below]] for details |Retrieve detailed status of the FPGA configuration operation|
-|SPI Flash write enable|''0xAF''| | |W/O| | |Reconfigure the FX3 IOMatrix to disable GPIF and enable SPI|+|SPI Flash write enable|''0xAF''| | |W/O| | |Reconfigure the FX3 IOMatrix to disable GPIF and enable SPI to be re-written|
  
 ==== FPGA config status - SPI codes ==== ==== FPGA config status - SPI codes ====
Line 95: Line 94:
 |''0'' Config not busy|Set to ''1'' while the config is not busy| |''0'' Config not busy|Set to ''1'' while the config is not busy|
  
-===== 0xB0-0xCF =====+===== 0xB0 - FPS control =====
 ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^
-|Reserved|''0xB0''-''0xCF''| | | | | | |+|FPS|''0xB0''| | |R/W|4|float32 FPS|FPS value is in IEEE float32 format, x86 LE and is exchanged in data phase of the USB control request (both IN and OUT)| 
 +===== 0xB1 Bulk color grading ===== 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|Bulk color grading|''0xB1''|''7:4'' - table\\ ''3:0'' - starting index|''7:4'' - version\\ ''4:0'' - count|R/W|''count x 2''| |Currently only version ''1'' is supported.\\ The //table// is a value from this list:\\ ''000'' - Hue vs. Hue (''14'' bits)\\ ''001'' - Hue vs. Saturation (''12 bits'')\\ ''010'' - Lightness vs. Saturation (''12'' bits)\\ ''011'' - Saturation vs. Saturation (''12'' bits)((scheduled for later))\\ ''100'' - Lightness vs. Lightness (''12'' bits)\\  ''101'' - Hue vs. Lightness (''12'' bits)((scheduled for later))\\ ''110-111'' - reserved\\ //Starting index// is a 0-based offset of the first written/read color grading value\\ //Version// is currently ''1''\\ //Count// - how many entries to write/read\\ The buffer is exchanged in data phase of the USB control request (both IN/OUT)| 
 +===== 0xB2 - Color correction matrix (a.k.a. CCM or CMX) ===== 
 +See [[isp:ccm|Color correction matrix]] article in this Wiki's ISP section for more details. 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|Color correction matrix|''0xB2''| | |R/W|32|packed C-array ''int16_t[4][4]''|That data buffer could also be defined as ''int16_t[16]'' or as ''byte*'' for the same exact memory layout on LE systems| 
 +===== 0xB3-0xBF ===== 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|Reserved|''0xB3''| | | | 
 +|Reserved|''0xB4''| | | | 
 +|Reserved|''0xB5''| | | | 
 +|Reserved|''0xB6''| | | | 
 +|Reserved|''0xB7''| | | | 
 +|Reserved|''0xB8''| | | | 
 +|Reserved|''0xB9''| | | | 
 +|Reserved|''0xBA''| | | | 
 +|Reserved|''0xBB''| | | | 
 +|Reserved|''0xBC''| | | | 
 +|Reserved|''0xBD''| | | | 
 +|Reserved|''0xBE''| | | | 
 +|Reserved|''0xBF''| | | | 
 + 
 +===== 0xC0-0xC1 ===== 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|Reserved|''0xC0''| | | | | | | 
 +|Reserved|''0xC1''| | | | | | | 
 +===== 0xC2-0xC4 - SPI flash management ===== 
 +The SPI flash memory (either ''128''MB or ''256''MB) is partitioned into 65KB sectors, each comprised of ''256'' pages. Each page is ''256'' bytes long. 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|SPI flash write page|''0xC2''|''16:0'' page address| |W/O|<4K|page's content|write a page of SPI flash (same command as Cypress' examples)| 
 +|SPI flash read page|''0xC3''|''16:0'' page address| |R/O|<4K|page's content|read a page of SPI flash (same command as Cypress' examples)| 
 +|SPI flash sector erase/poll|''0xC4''|''7:0'' - sector|''0'' - poll\\ ''1'' - erase |R/W| | |either erase a SPI flash sector, or poll SPI busy status (same command as Cypress' examples)\\ \\ sector's byte address is computed by multiplying //wIndex// by ''65536''\\ \\ For Erase SPI flash sector function:\\  - //wValue// = ''0x0001''\\  - //wIndex// = SPI flash sector address\\  - //wLength// = ''0x0000''\\ No data phase associated with this command\\ \\ For Check SPI busy status function:\\  - //wValue// = ''0x0000''\\  - //wIndex// = ''0x0000''\\  - //wLength// = ''0x0001''\\ Data phase indicates flash busy status:\\  - ''0x00'' means SPI flash has finished write/erase operation\\  - non-zero value means that SPI flash is still busy processing previous write/erase command.| 
 +===== 0xC5-0xCB ===== 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|Reserved|''0xC5''| | | | | | | 
 +|Reserved|''0xC6''| | | | | | | 
 +|Reserved|''0xC7''| | | | | | | 
 +|Reserved|''0xC8''| | | | | | | 
 +|Reserved|''0xC9''| | | | | | | 
 +|Reserved|''0xCA''| | | | | | | 
 +|Reserved|''0xCB''| | | | | | | 
 +===== 0xCC - FPGA temperature sensor ===== 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|FPGA core temperature|''0xCC''| | |R/O| | |FPGA temperature read from the on-board sensor (not implemented yet)| 
 +===== 0xCD-0xCF ===== 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|Reserved|''0xCD''| | | | | | | 
 +|Reserved|''0xCE''| | | | | | | 
 +|Reserved|''0xCF''| | | | | | |
  
 ===== 0xD0-0xD7 - Auto exposure configuration ===== ===== 0xD0-0xD7 - Auto exposure configuration =====
 ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^
 |AE Setpoint|''0xD0''| |AE Setpoint|R/W|''0'' or ''1'' |''7:0'' AE Setpoint|Target Auto Exposure Luminance Setpoint [0..255]\\ Default: ''105''\\ This controls the "average luminance" of the whole frame that we are trying to achieve. The higher the value the brighter the result is going to be| |AE Setpoint|''0xD0''| |AE Setpoint|R/W|''0'' or ''1'' |''7:0'' AE Setpoint|Target Auto Exposure Luminance Setpoint [0..255]\\ Default: ''105''\\ This controls the "average luminance" of the whole frame that we are trying to achieve. The higher the value the brighter the result is going to be|
-|AE Hysteresis|''0xD1''| |AE Hysteresis|R/W|''0'' or ''2'' |''15:0'' AE Hysteresis|Auto Exposure Hysteresis Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''3.0''\\ This controls how far can we diverge from the set target luminance before we begin the correction. In other words the higher this value the further we allow the luminance to drift away from the target before correcting it| +|**deprecated** AE Hysteresis|''0xD1''| |AE Hysteresis|R/W|''0'' or ''2'' |''15:0'' AE Hysteresis|Auto Exposure Hysteresis Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''3.0''\\ This controls how far can we diverge from the set target luminance before we begin the correction. In other words the higher this value the further we allow the luminance to drift away from the target before correcting it| 
-|AE Error Tolerance|''0xD2''| |AE Err Tol|R/W|''0'' or ''2'' |''15:0'' AE Err Tol|Auto Exposure Error Tolerance Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''1.0''\\ Specifies the "close enough" tolerance at which point the correction can be stopped. Normally this value is (at least somewhat) lower than the AE Hysteresis| +|**deprecated** AE Error Tolerance|''0xD2''| |AE Err Tol|R/W|''0'' or ''2'' |''15:0'' AE Err Tol|Auto Exposure Error Tolerance Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''1.0''\\ Specifies the "close enough" tolerance at which point the correction can be stopped. Normally this value is (at least somewhat) lower than the AE Hysteresis| 
-|AE Exposure Scaling|''0xD3''| |AE Exp Scale|R/W|''0'' or ''2'' |''15:0'' AE Exp Scale|Auto Exposure Exposure Scaling Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''100.0''\\ Controls the speed (stepping) at which the correction is happening. Higher values will result in large brightness jumps and a value too high may cause an oscillation while a value that is too low will cause the correction process to be too slow and seamingly unresponsive| +|**deprecated** AE Exposure Scaling|''0xD3''| |AE Exp Scale|R/W|''0'' or ''2'' |''15:0'' AE Exp Scale|Auto Exposure Exposure Scaling Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''100.0''\\ Controls the speed (stepping) at which the correction is happening. Higher values will result in large brightness jumps and a value too high may cause an oscillation while a value that is too low will cause the correction process to be too slow and seamingly unresponsive| 
-|AE C Gain Divisor|''0xD4''| |AE C Gain Divisor|R/W|''0'' or ''2'' |''15:0'' AE C Gain Divisor|Auto Exposure C Gain Divisor Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''4.0''\\ Value between 0 and 255 that is inversely proportional to the rate at which the C gain is adjusted in response to exposure errors.  (i.e. the larger the value, the slower C gain will adjust)| +|**deprecated** AE C Gain Divisor|''0xD4''| |AE C Gain Divisor|R/W|''0'' or ''2'' |''15:0'' AE C Gain Divisor|Auto Exposure C Gain Divisor Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''4.0''\\ Value between 0 and 255 that is inversely proportional to the rate at which the C gain is adjusted in response to exposure errors.  (i.e. the larger the value, the slower C gain will adjust)| 
-|Reserved|''0xD5''-''0xD7''| | | | | | |+|Reserved|''0xD5''| | | | | | | 
 +|Reserved|''0xD6''| | | | | | | 
 +|Reserved|''0xD7''| | | | | | |
  
 ===== 0xD8-0xDE - Auto white balance configuration ===== ===== 0xD8-0xDE - Auto white balance configuration =====
 ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^
 |AWB Setpoint|''0xD8''| |AWB Setpoint|R/W|''0'' or ''2'' |''15:0'' AWB Setpoint|Auto White Balance G Gain Setpoint [0..2047]\\ Default ''1024''\\ The pinned value for Green Gain that is used as the basis for the rest of the white balance adjustments. Only change this value if you need to make your picture brighter and you have exhausted both the Exposure and the Global Gain options| |AWB Setpoint|''0xD8''| |AWB Setpoint|R/W|''0'' or ''2'' |''15:0'' AWB Setpoint|Auto White Balance G Gain Setpoint [0..2047]\\ Default ''1024''\\ The pinned value for Green Gain that is used as the basis for the rest of the white balance adjustments. Only change this value if you need to make your picture brighter and you have exhausted both the Exposure and the Global Gain options|
-|AWB Hysteresis|''0xD9''| |AWB Hysteresis|R/W|''0'' or ''2'' |''15:0'' AWB Hysteresis|Auto White Balance Hysteresis Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''3.0''\\ How far can the error drift before we start adjusting it| +|**deprecated** AWB Hysteresis|''0xD9''| |AWB Hysteresis|R/W|''0'' or ''2'' |''15:0'' AWB Hysteresis|Auto White Balance Hysteresis Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''3.0''\\ How far can the error drift before we start adjusting it| 
-|AWB Error Tolerance|''0xDA''| |AWB Err Tol|R/W|''0'' or ''2'' |''15:0'' AWB Err Tol|Auto White Balance Error Tolerance Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''1.0''\\ A.k.a. "good enough" approximation - controls when we stop the correction process, having achieved a "close enough" result. Generally this setting is at least somewhat lower than the AWB Hysteresis value| +|**deprecated** AWB Error Tolerance|''0xDA''| |AWB Err Tol|R/W|''0'' or ''2'' |''15:0'' AWB Err Tol|Auto White Balance Error Tolerance Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''1.0''\\ A.k.a. "good enough" approximation - controls when we stop the correction process, having achieved a "close enough" result. Generally this setting is at least somewhat lower than the AWB Hysteresis value| 
-|AWB Adjustment Scaling|''0xDB''| |AWB Adj Scale|R/W|''0'' or ''2'' |''15:0'' AWB Adj Scale|Auto White Balance Adjustment Scaling Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''4.0''\\ Value between ''0'' and ''255'' that is inversely proportional to the rate at which the R and B gains are adjusted in response to white balance errors.  (i.e. the larger the value, the slower R and B gains will adjust)| +|**deprecated** AWB Adjustment Scaling|''0xDB''| |AWB Adj Scale|R/W|''0'' or ''2'' |''15:0'' AWB Adj Scale|Auto White Balance Adjustment Scaling Value [[numberFormats#ufix_8.8|UFIX 8.8]]\\ Default ''4.0''\\ Value between ''0'' and ''255'' that is inversely proportional to the rate at which the R and B gains are adjusted in response to white balance errors.  (i.e. the larger the value, the slower R and B gains will adjust)| 
-|Reserved|''0xDC''-''0xDE''| | | | | | |+|Reserved|''0xDC''| | | | | | | 
 +|Reserved|''0xDD''| | | | | | | 
 +|Reserved|''0xDE''| | | | | | |
  
 ===== 0xDF - Auto-functions' timing ===== ===== 0xDF - Auto-functions' timing =====
 ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^
-|Auto Update Period|''0xDF''| |Auto Update Period|R/W|''0'' or ''2'' |''15:0'' Auto Update Period|Auto Update Period [0..65535])\\ Default ''3000''\\ Determines how long we wait before trying to apply a new update for both exposure and white balance (when auto functions are enabled).  This is an asynchronous update rate (i.e. not an absolute time, but larger values should mean slower updates)|+|Auto Update Period|''0xDF''| |Auto Update Period|R/W|''0'' or ''2'' |''15:0'' Auto Update Period|Auto Update Period [0..65535])\\ Default ''12''\\ Determines how long we wait before trying to apply a new update for both exposure and white balance (when auto functions are enabled), as well as other up-keep operations, like pushing data over I²C bus.\\ This is an asynchronous update rate.\\ A value of ''3'' is approximately ''25''ms|
  
-===== 0xE0-0xFF =====+===== 0xE0 - FX3 reset =====
 ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ ^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^
-|FX3 reset|''0xE0''| | |R/W| | |Cypress vendor command to soft reset FX3| +|FX3 reset|''0xE0''| | |W/O| | |Cypress vendor command to soft reset FX3| 
-|Reserved|''0xE1''-''0xFF''| | | | | | |+ 
 +===== 0xE1-0xEF ===== 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|Reserved|''0xE1''| | | | 
 +|Reserved|''0xE2''| | | | 
 +|Reserved|''0xE3''| | | | 
 +|Reserved|''0xE4''| | | | 
 +|Reserved|''0xE5''| | | | 
 +|Reserved|''0xE6''| | | | 
 +|Reserved|''0xE7''| | | | 
 +|Reserved|''0xE8''| | | | 
 +|Reserved|''0xE9''| | | | 
 +|Reserved|''0xEA''| | | | 
 +|Reserved|''0xEB''| | | | 
 +|Reserved|''0xEC''| | | | 
 +|Reserved|''0xED''| | | | 
 +|Reserved|''0xEE''| | | | 
 +|Reserved|''0xEF''| | | | 
 + 
 +===== 0xF0-0xF9 ===== 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|Reserved|''0xF0''| | | | 
 +|Reserved|''0xF1''| | | | 
 +|Reserved|''0xF2''| | | | 
 +|Reserved|''0xF3''| | | | 
 +|Reserved|''0xF4''| | | | 
 +|Reserved|''0xF5''| | | | 
 +|Reserved|''0xF6''| | | | 
 +|Reserved|''0xF7''| | | | 
 +|Reserved|''0xF8''| | | | 
 +|Reserved|''0xF9''| | | | 
 + 
 + 
 +===== 0xFA - [Debug] Get internal struct ===== 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|Get internal struct|''0xFA''|command (see below)|struct to return|R/O|varies by command (see below)|struct's byte buffer|See below for details| 
 + 
 +List of commands supported by this API: 
 +^Cmd (wIndex) ^Meaning ^ 
 +|''0''|a 2-byte descriptive text label's length (not including the C-style null-terminator)| 
 +|''1''|descriptive text label (up to 4096 bytes **without** a C-style null-terminator)| 
 +|''2''|a 2-byte size of the structure in bytes| 
 +|''3''|structure's byte buffer| 
 + 
 +As of FX3 version ''58'' the following internal structures are supported: 
 +^Index (wValue) ^ Details ^ 
 +|''0''|reserved (unused)| 
 +|''1''|USB device descriptor 2.0| 
 +|''2''|USB device descriptor 3.0| 
 +|''3''|USB Device Qualifier descriptor| 
 +|''4''|USB BOS (Binary Object Store) descriptor| 
 +|''5''|Full-Speed (2.0) USB Configuration descriptor| 
 +|''6''|High-Speed (2.0) USB Configuration descriptor| 
 +|''7''|Super-Speed (3.0) USB Configuration descriptor| 
 +|''8''|MS OS Platform Capability descriptor version 2.0| 
 + 
 +===== 0xFB-0xFF - Reserved for debug APIs ===== 
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^ 
 +|Reserved|''0xFB''| | | | | | | 
 +|Reserved|''0xFC''| | | | | | | 
 +|Reserved|''0xFD''| | | | | | | 
 +|Reserved|''0xFE''| | | | | | | 
 +|Reserved|''0xFF''| | | | | | |
  
  
  
-====== FPGA I²C bridge ======+====== FPGA I²C bridge (registers' map) ======
 The following tables provide information on how to access the camera's functionality for an FPGA I²C bridge. The following tables provide information on how to access the camera's functionality for an FPGA I²C bridge.
  
Line 149: Line 264:
 |FPGA control|''0x06''|R/W| |Global control of the FPGA's functionality| |FPGA control|''0x06''|R/W| |Global control of the FPGA's functionality|
 |:::|:::|:::|''7'' FPGA config enable|If bit ''7'' is set, the GPIF becomes read only and waits for an update bitstream| |:::|:::|:::|''7'' FPGA config enable|If bit ''7'' is set, the GPIF becomes read only and waits for an update bitstream|
-|:::|:::|:::|''6'' Reserved| |+|:::|:::|:::|''6'' on-board fan(FPGA-72+) ''1'' turns the on-board fan on, ''0'' turns it off |
 |:::|:::|:::|''5'' RAW Mode|Setting bit ''5'' and clearing bit ''0x06::2'' will enable RAW mode output (4K Only)| |:::|:::|:::|''5'' RAW Mode|Setting bit ''5'' and clearing bit ''0x06::2'' will enable RAW mode output (4K Only)|
 |:::|:::|:::|''4'' Video Format|Bit ''4'' selects between NV12 ('1') and YUY2 ('0') output formats | |:::|:::|:::|''4'' Video Format|Bit ''4'' selects between NV12 ('1') and YUY2 ('0') output formats |
Line 169: Line 284:
 ===== 0x0E-0x0F - Noise Reduction ===== ===== 0x0E-0x0F - Noise Reduction =====
  
-==== pre-68 (SUB2r-lib will continue supporting this until end of August 2019) ==== 
-^Name ^Offset ^Access ^Bit mapping ^Notes ^ 
-|NR Control|''0x0E''|R/W|''7:1'' Reserved| | 
-|:::|:::|:::|''0'' NR Enable| '1' => NR enabled, '0' => NR disabled| 
-|NR Threshold|''0x0F''|R/W|''7:0'' NR Threshold|Noise level threshold in range [0..255]| 
- 
-==== starting with version 68 ==== 
 ^Name ^Offset ^Access ^Bit mapping ^Notes ^ ^Name ^Offset ^Access ^Bit mapping ^Notes ^
 |Chroma NR Control|''0x0E''|R/W|''7'' Reserved, must be ''0''\\ ''6:0'' value| Chroma (color or an \(H\) component of the \(H/S/L\) pixel data) noise reduction in range \([0\%..100\%]\) mapped into \([0..127]\). Setting this to ''0'' effectively turns the chroma denoising off | |Chroma NR Control|''0x0E''|R/W|''7'' Reserved, must be ''0''\\ ''6:0'' value| Chroma (color or an \(H\) component of the \(H/S/L\) pixel data) noise reduction in range \([0\%..100\%]\) mapped into \([0..127]\). Setting this to ''0'' effectively turns the chroma denoising off |
Line 270: Line 378:
 |switch|''0xC0''|W| |Controls what information is being read/written by accessing the next set of registers (''0xC2..0xC3'')| |switch|''0xC0''|W| |Controls what information is being read/written by accessing the next set of registers (''0xC2..0xC3'')|
 |:::|:::|:::|''7:5'' table switch|''000'' - Hue vs. Hue (''14'' bits)\\ ''001'' - Hue vs. Saturation (''12 bits'')\\ ''010'' - Lightness vs. Saturation (''12'' bits)\\ ''011'' - Saturation vs. Saturation (''12'' bits)((scheduled for later))\\ ''100'' - Lightness vs. Lightness (''12'' bits)\\  ''101'' - Hue vs. Lightness (''12'' bits)((scheduled for later))\\ ''110-111'' - reserved| |:::|:::|:::|''7:5'' table switch|''000'' - Hue vs. Hue (''14'' bits)\\ ''001'' - Hue vs. Saturation (''12 bits'')\\ ''010'' - Lightness vs. Saturation (''12'' bits)\\ ''011'' - Saturation vs. Saturation (''12'' bits)((scheduled for later))\\ ''100'' - Lightness vs. Lightness (''12'' bits)\\  ''101'' - Hue vs. Lightness (''12'' bits)((scheduled for later))\\ ''110-111'' - reserved|
-|:::|:::|:::|''4:1'' index MSB|Reserved for 4 MSB of the 12-bit index into tables|+|:::|:::|:::|''4:1'' page|Reserved for a page number in the table, currently is always set to ''0''|
 |:::|:::|:::|''0'' access mode| the only valid value right now is ''0'', which is "normal mode", in which all the subsequent access to the registers in this API block are governed by the values in ''0xC0'' and ''0xC1''\\ ''1'' would be used for "bulk access" where after a read or write access to register ''0xC2'' the "Index" value will auto-increment by one so that the next pair will access the subsequent table slot| |:::|:::|:::|''0'' access mode| the only valid value right now is ''0'', which is "normal mode", in which all the subsequent access to the registers in this API block are governed by the values in ''0xC0'' and ''0xC1''\\ ''1'' would be used for "bulk access" where after a read or write access to register ''0xC2'' the "Index" value will auto-increment by one so that the next pair will access the subsequent table slot|
-|Index LSB|''0xC1''|W|''7:0'' index LSB| 8 LSB bits of the 12-bit index into a table (we only use 6 bits today and the rest are ignored)|+|Index LSB|''0xC1''|W|''7:0'' index LSB| index into a page in the table (we only use 6 bits today and the rest are ignored)|
 |Value L|''0xC2''|R/W|''7:0'' LSB| 16 bits split into 8 LSB and 8 MSB\\  - for a "Hue vs. Hue" table the 14 bits signed value is in range ''[-8192..+8192]'' which maps linearly into a Hue angle range ''-180°..+180°''\\  - for a "Hue vs. Saturation" table (as well as for similar tables %%LvS%% and %%SvS%%) the 12 bit unsigned value in range ''[0..+1280]'' maps linearly into a Saturation range ''[0%..1000%]'' where ''100%'' is the neutral position and ''0%'' produces a greyscale image\\  - for a "Lightness vs. Lightness" table (as well as for similar table %%HvL%%) the 12 bit unsigned value in range ''[0..+4095]'' maps linearly into a Lightness range ''[0..255]'' where ''0'' is pitch black and ''255'' is the maximum possible pixel luminosity value| |Value L|''0xC2''|R/W|''7:0'' LSB| 16 bits split into 8 LSB and 8 MSB\\  - for a "Hue vs. Hue" table the 14 bits signed value is in range ''[-8192..+8192]'' which maps linearly into a Hue angle range ''-180°..+180°''\\  - for a "Hue vs. Saturation" table (as well as for similar tables %%LvS%% and %%SvS%%) the 12 bit unsigned value in range ''[0..+1280]'' maps linearly into a Saturation range ''[0%..1000%]'' where ''100%'' is the neutral position and ''0%'' produces a greyscale image\\  - for a "Lightness vs. Lightness" table (as well as for similar table %%HvL%%) the 12 bit unsigned value in range ''[0..+4095]'' maps linearly into a Lightness range ''[0..255]'' where ''0'' is pitch black and ''255'' is the maximum possible pixel luminosity value|
 |Value H|''0xC3''|R/W|''7:0'' MSB|:::| |Value H|''0xC3''|R/W|''7:0'' MSB|:::|
Line 278: Line 386:
  
  
-===== 0xD0-0xFF Reserved ===== +===== 0xD0-0xEF Color Correction Matrix (a.k.a. CCM or CMX) ===== 
-This is where future API will landStay tuned ;-)+See [[isp:ccm|Color correction matrix]] article in this Wiki's ISP section for more details. 
 +^Name ^Offset ^Access ^Bit mapping ^Notes ^ 
 +|CCM_00_L|''0xD0''|R/W|''7:0'' LSB|\(CCM_{00}\)
 +|CCM_00_H|''0xD1''|R/W|''7:0'' MSB|:::| 
 +|CCM_01_L|''0xD2''|R/W|''7:0'' LSB|\(CCM_{01}\)| 
 +|CCM_01_H|''0xD3''|R/W|''7:0'' MSB|:::| 
 +|CCM_02_L|''0xD4''|R/W|''7:0'' LSB|\(CCM_{02}\)| 
 +|CCM_02_H|''0xD5''|R/W|''7:0'' MSB|:::| 
 +|CCM_03_L|''0xD6''|R/W|''7:0'' LSB|\(CCM_{03}\)| 
 +|CCM_03_H|''0xD7''|R/W|''7:0'' MSB|:::| 
 +|CCM_10_L|''0xD8''|R/W|''7:0'' LSB|\(CCM_{10}\)| 
 +|CCM_10_H|''0xD9''|R/W|''7:0'' MSB|:::| 
 +|CCM_11_L|''0xDA''|R/W|''7:0'' LSB|\(CCM_{11}\)| 
 +|CCM_11_H|''0xDB''|R/W|''7:0'' MSB|:::| 
 +|CCM_12_L|''0xDC''|R/W|''7:0'' LSB|\(CCM_{12}\)| 
 +|CCM_12_H|''0xDD''|R/W|''7:0'' MSB|:::| 
 +|CCM_13_L|''0xDE''|R/W|''7:0'' LSB|\(CCM_{13}\)| 
 +|CCM_13_H|''0xDF''|R/W|''7:0'' MSB|:::| 
 +|CCM_20_L|''0xE0''|R/W|''7:0'' LSB|\(CCM_{20}\)| 
 +|CCM_20_H|''0xE1''|R/W|''7:0'' MSB|:::| 
 +|CCM_21_L|''0xE2''|R/W|''7:0'' LSB|\(CCM_{21}\)| 
 +|CCM_21_H|''0xE3''|R/W|''7:0'' MSB|:::| 
 +|CCM_22_L|''0xE4''|R/W|''7:0'' LSB|\(CCM_{22}\)| 
 +|CCM_22_H|''0xE5''|R/W|''7:0'' MSB|:::| 
 +|CCM_23_L|''0xE6''|R/W|''7:0'' LSB|\(CCM_{23}\)| 
 +|CCM_23_H|''0xE7''|R/W|''7:0'' MSB|:::| 
 +|CCM_30_L|''0xE8''|R/W|''7:0'' LSB|\(CCM_{30}\)| 
 +|CCM_30_H|''0xE9''|R/W|''7:0'' MSB|:::| 
 +|CCM_31_L|''0xEA''|R/W|''7:0'' LSB|\(CCM_{31}\)| 
 +|CCM_31_H|''0xEB''|R/W|''7:0'' MSB|:::| 
 +|CCM_32_L|''0xEC''|R/W|''7:0'' LSB|\(CCM_{32}\)| 
 +|CCM_32_H|''0xED''|R/W|''7:0'' MSB|:::| 
 +|CCM_33_L|''0xEE''|R/W|''7:0'' LSB|\(CCM_{33}\)| 
 +|CCM_33_H|''0xEF''|R/W|''7:0'' MSB|:::| 
 + 
 +===== 0xF0-0xFF ===== 
 +^Name ^Offset ^Access ^Bit mapping ^Notes ^ 
 +|Reserved|''0xF0''| | | | 
 +|Reserved|''0xF1''| | | | 
 +|Reserved|''0xF2''| | | | 
 +|Reserved|''0xF3''| | | | 
 +|Reserved|''0xF4''| | | | 
 +|Reserved|''0xF5''| | | | 
 +|Reserved|''0xF6''| | | | 
 +|Reserved|''0xF7''| | | | 
 +|Reserved|''0xF8''| | | | 
 +|Reserved|''0xF9''| | | | 
 +|Reserved|''0xFA''| | | | 
 +|Reserved|''0xFB''| | | | 
 +|Reserved|''0xFC''| | | | 
 +|Reserved|''0xFD''| | | | 
 +|Reserved|''0xFE''| | | | 
 +|Reserved|''0xFF''| | | |
  
 ====== FX3 Version Info ====== ====== FX3 Version Info ======
/home/adminsub2r/public_html/dokuwiki/data/attic/code/fx3_hvci_and_fpga_i_c_commands.1573604852.txt.gz · Last modified: 2019/11/13 00:27 by Igor Yefmov