User Tools

Site Tools


code:fx3_vr_cmd

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_vr_cmd [2020/05/14 22:21]
Igor Yefmov
code:fx3_vr_cmd [2020/05/14 22:24] (current)
Line 2: Line 2:
  
 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 =====
 ^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|''​0x00''​-''​0x9F''​| | | | | |Think of this as "​system address space"​| |Reserved|''​0x00''​-''​0x9F''​| | | | | |Think of this as "​system address space"​|
 +
 +===== 0xA0-0xA7 =====
 +^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''​)|
 +|Reserved|''​0xA1''​| | | | | | |
 +|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|
 +|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 |
 +|Reserved for future I²C bridge |''​0xA6''​| | | | | | |
 +|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 =====
 +^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|
 +|Reserved|''​0xA9''​| | | | | | |
 +
 +===== 0xAA-0xAF - versioning and reprogramming =====
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^
 +|Erase SPI Flash|''​0xAA''​| | |W/O| | |Any write to this location invalidates the FX3 SPI Flash and causes the FX3 to reset itself to a bootloader mode for reprogramming|
 +|FX3 version|''​0xAB''​| | |R/​O|''​4''​|''​31:​29''​ Vendor ID\\ ''​28:​24''​ HW_CFG_ID\\ ''​23:​16''​ Product ID\\ ''​15:​11''​ Release type\\ ''​10:​0''​ Build number|Get detailed version information of the FX3, for more details refer to [[#FX3 Version Info]]|
 +|FPGA version|''​0xAC''​| | |R/​O|''​4''​|''​31:​29''​ Vendor ID\\ ''​28:​24''​ HW_CFG_ID\\ ''​23:​16''​ Product ID\\ ''​15:​11''​ Release type\\ ''​10:​0''​ Build number|Get detailed version information of the FPGA, for more details refer to [[#FPGA Version Info]]|
 +|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|
 +|SPI Flash write enable|''​0xAF''​| | |W/O| | |Reconfigure the FX3 IOMatrix to disable GPIF and enable SPI|
 +
 +==== FPGA config status - SPI codes ====
 +^ Bit name ^ Description ^
 +|''​15''​ Program %%SwitchWord%% OK| |
 +|''​14''​ Verify OK| Verification succeeded |
 +|''​13''​ Program OK| Programming completed successfully |
 +|''​12''​ Erase OK| SPI erase was successful |
 +|''​11''​ Erase %%SwitchWord%% OK| |
 +|''​10''​ Check ID OK| |
 +|''​9''​ Initialize OK| |
 +|''​8''​ Config started| Config operation has started |
 +|''​7''​ CRC error| |
 +|''​6''​ Timeout error| |
 +|''​5''​ Program error| Error while programming the SPI |
 +|''​4''​ Erase error| Encountered an error while erasing SPI |
 +|''​3''​ %%IdCode%% error| |
 +|''​2''​ Config error| Configuration operation errored out |
 +|''​1''​ Config done| Configuration operation is complete |
 +|''​0''​ Config not busy|Set to ''​1''​ while the config is not busy|
 +
 +===== 0xB0-0xCF =====
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^
 +|Reserved|''​0xB0''​-''​0xCF''​| | | | | | |
 +
 +===== 0xD0-0xD7 - Auto exposure configuration =====
 +^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 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|
 +|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)|
 +|Reserved|''​0xD5''​-''​0xD7''​| | | | | | |
 +
 +===== 0xD8-0xDE - Auto white balance configuration =====
 +^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 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|
 +|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''​| | | | | | |
 +
 +===== 0xDF - Auto-functions'​ timing =====
 +^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)|
 +
 +===== 0xE0-0xFF =====
 +^Name ^Offset ^wIndex ^wValue ^Access type ^Byte length ^Return buffer bits ^Notes ^
 +|FX3 reset|''​0xE0''​| | |R/W| | |Cypress vendor command to soft reset FX3|
 +|Reserved|''​0xE1''​-''​0xFF''​| | | | | | |
 +
  
/home/adminsub2r/public_html/dokuwiki/data/pages/code/fx3_vr_cmd.txt · Last modified: 2020/05/14 22:24 (external edit)