tinyCLUNX33
System on Module with CrosslinkU-NX
|
This app note presents the details of the tinyVision.ai MIPI2UVC core. This core is designed for the Lattice Semiconductor CrosslinkU-NX33 FPGA only. There are 2 package options available for the FPGA and this core is compatible with both options.
The Stream2UVC
IP is an IP core that facilitates the transfer of video data from an FPGA to a host system via USB, presenting the data as a USB Video Class (UVC) stream. This module provides multiple independent video streams and interfaces with various subsystems including USB, Wishbone for configuration and control, interrupt outputs, and AXI Stream interfaces for data transmission.
The core accepts video data through one or more independent AXI Stream interfaces and converts them into UVC-compliant USB packets utilizing the Lattice Semiconductor Hard USB core.
The core is designed such that data pushed into the internal FIFOs appears at the host as a UVC stream with minimal delays. While we talk about this as a MIPI2UVC core, the design is a general purpose data mover engine that transports bits from a 64 bit FIFO in the FPGA to the host.
The core includes:
NOTE: An external processor is required to handle the complex USB enumeration process and negotiation during UVC initiation. The actual data never touches the processor itself and flows directly from the input FIFO's to the USB hard IP in the FPGA. As a result, the processor is idle after the USB negotiations are complete and fully available to the user.
The core can be used for briding USB to almost any image sensor. We have seen applications including:
Signal | Direction | Width | Description |
---|---|---|---|
clk | Input | 1 | System clock signal, recommend a minimum processor clock of 80MHz to meet USB latency limits during enumeration. |
reset | Input | 1 | System reset signal (active high, sync'ed to clk ) |
usb_clk | Input | 1 | USB clock signal, 60MHz, can be derived from IO or a PLL output |
usb_reset | Input | 1 | USB reset signal (active high, sync'ed to usb_clk ) |
There is no sequencing requirement between the two resets.
The core provides multiple Wishbone interfaces for configuration and control:
The core requires configuration and control to function properly. The core consumes a 28-bit address space and is designed to map into the 0xb000_0000 to 0xbfff_fffc
space in a processor. Note that we do not implement byte level access to registers within the USB core and all registers are assumed to be accessed as 32 bit data words. An implication is that the lower 2 bits of the Wishbone are not used.
Signal | Direction | Width | Description |
---|---|---|---|
wb_m2s_wb0_cyc | Input | 1 | Cycle signal for CSR Wishbone master |
wb_m2s_wb0_stb | Input | 1 | Strobe signal for CSR Wishbone master |
wb_m2s_wb0_we | Input | 1 | Write enable signal for CSR Wishbone master |
wb_m2s_wb0_adr | Input | 32 | Address bus for CSR Wishbone master |
wb_m2s_wb0_dat | Input | 32 | Data bus for CSR Wishbone master |
wb_m2s_wb0_sel | Input | 4 | Byte select signals for CSR Wishbone master |
wb_s2m_wb0_ack | Output | 1 | Acknowledge signal from CSR Wishbone slave |
wb_s2m_wb0_dat | Output | 32 | Data bus from CSR Wishbone slave |
Each stream core also provides a subset of the Wishbone address space which can be used to map registers from the user logic that is related to the stream. Typical example of such usage is the ISP associated with the particular streeam. This mapping makes the driver development modular especially when the different streams are similar in their characteristics eg. multiple RGB cameras.
Signal | Direction | Width | Description |
---|---|---|---|
wb_m2s_csr[0,1]_cyc | Output | 1 | Cycle signal for secondary CSR Wishbone master |
wb_m2s_csr[0,1]_stb | Output | 1 | Strobe signal for secondary CSR Wishbone master |
wb_m2s_csr[0,1]_we | Output | 1 | Write enable signal for secondary CSR Wishbone master |
wb_m2s_csr[0,1]_adr | Output | 32 | Address bus for secondary CSR Wishbone master |
wb_m2s_csr[0,1]_dat | Output | 32 | Data bus for secondary CSR Wishbone master |
wb_m2s_csr[0,1]_sel | Output | 4 | Byte select signals for secondary CSR Wishbone master |
wb_s2m_csr[0,1]_ack | Input | 1 | Acknowledge signal from secondary CSR Wishbone slave |
wb_s2m_csr[0,1]_dat | Input | 32 | Data bus from secondary CSR Wishbone slave |
The core provides multiple independent AXI Stream interfaces for video data input. Each interface follows the standard AXI stream protocol.
Signal | Direction | Width | Description |
---|---|---|---|
streamIns_0_valid | Input | 1 | Valid signal for AXI Stream input 0 |
streamIns_0_ready | Output | 1 | Ready signal for AXI Stream input 0 |
streamIns_0_last | Input | 1 | Last signal for AXI Stream input 0 (end of frame) |
streamIns_0_data | Input | 64 | Data bus for AXI Stream input 0 |
numBytes_0 | Output | 24 | Number of bytes processed in stream 0 |
The core requires a set of pins to be connected directly to the FPGA IO. Please place these pins on the right pads for the FPGA. Not doing this correctly will cause Map errors. Please refer to the provided pin constraints file for a sample configuration that works.
Signal | Direction | Width | Description |
---|---|---|---|
usbIO_VBUS | Inout | 1 | USB VBUS line (power detection) |
usbIO_REFINCLKEXTP | Input | 1 | USB reference clock input (60MHz) |
usbIO_REFINCLKEXTM | Input | 1 | USB reference clock input () |
usbIO_RESEXTUSB2 | Inout | 1 | USB external reset line |
usbIO_DP | Inout | 1 | USB 2 data plus line (D+) |
usbIO_DM | Inout | 1 | USB 2 data minus line (D-) |
usbIO_RXM | Input | 1 | USB 3 receive minus line (USB 3.0) |
usbIO_RXP | Input | 1 | USB 3 receive plus line (USB 3.0) |
usbIO_TXM | Output | 1 | USB 3 transmit minus line (USB 3.0) |
usbIO_TXP | Output | 1 | USB 3 transmit plus line (USB 3.0) |
The interrupt outputs from the core should be connected to the interrupt controller of the SoC. Interrupts are active high, level sensitive and held high until the interrupt source is cleared by the processor.
Signal | Direction | Width | Description |
---|---|---|---|
irq | Output | 1 | Interrupt from the RTL sorrounding the USB hard IP |
usb23_irq | Output | 1 | USB hard IP interrupt output |
The Wishbone interface is designed to be connected to a processor hosting Zephyr RTOS with a dedicated driver for the RTL. The driver provides:
Please refer to the the Zephyr application note for more details.
clk
.valid
, data
, last
are set to 0
and ready
is left open). Wishbone ports shall have ack
, data
set low. This allows synthesis to optimize away most of the unused logic. For even smaller designs, you can use the single stream version of the core.IP Catalog
, then the Install a User IP
icon.ipk
file and create a new instance of the IP.NOTE: You can select either the single stream or dual stream IP when you customize the IP. Please note that the generated IP consumes the only instance of Hard USB IP in the FPGA so you cannot instantiate more than one core per FPGA.
sales@tinyvision.ai
for more details.sales@tinyvision.ai
for more details.The following table shows the area of the USB IP core for different configurations (Map resource usage).
Configuration | PFU Registers | EBRs | LRAM |
---|---|---|---|
UVC, single Stream | 2244 | 11 | 2 |
UVC, dual Stream | 3753 | 13 | 2 |
The FPGA with sorrounding power and clock circuitry has been measured to consume approximately 200mW at 5V while transferring 3.4Gbps over the USB3 link. Power does drop significantly at lower bandwidths.
Please contact tinyVision.ai if power is critical to your application.
The MIPI2UVC core provides several memory-mapped regions accessible through the Wishbone interfaces. The specifics of these interfaces such as registers are black-boxed and exposed via the Zephyr driver that is also available.
Region | Base Address | Mask | Size | Access | Description |
---|---|---|---|---|---|
USB Core | 0xb0000000 | 0xff000000 | 16MB | CPU, USB | USB hard IP core configuration and control registers |
AXI RAM | 0xb1000000 | 0xff000000 | 16MB | CPU, Data | Memory-mapped interface to the AXI shared RAM |
CSR: First stream | 0xb2000000 | 0xfff00000 | 1MB | CPU | Control and Status Registers for primary stream |
CSR: Second stream | 0xb2100000 | 0xfff00000 | 1MB | CPU | Control and Status Registers for secondary stream |
USB Manager: First stream | 0xb4000000 | 0xfffffc00 | 1KB | CPU, Regs | USB manager configuration registers |
USB Manager Regs: Second stream | 0xb4000400 | 0xfffffc00 | 1KB | CPU, Regs | USB manager configuration registers |
Data Mover Core | 0xb4009000 | 0xfffffc00 | 1KB | CPU | Data mover control registers |
IRQ | 0xbf000000 | 0xfffffc00 | 1KB | CPU | Interrupt controller registers |
Notes:
nocache
attribute for these memory regions to avoid the common mistake of caching data meant for IOwb_csr
block provides an LMMI
interface to communicate with various Lattice cores such as the MIPI Rx DPHY. This is mapped in the wb_csr
block at an offset of 0x400
. For example, the CSI block for stream 0 will be mapped at registers starting at 0xb200_0400
.The private repository of code that contains the IPK
also contains detailed implementations of the core for a single and dual stream 1920 x 1080 x 30fps camera stream using the IMX219 sensors. Please refer to the sample code for details.
RTL examples feature:
Please refer to this page for tips on debugging common issues with Video.
Version | Description |
---|---|
1.0.0 | Initial release, no JTAG debug |
1.0.1 | Fixed multiple bugs, added formal verification |
1.0.2 | Fixed LRAM bug and using LRAM to reduce the number of EBRs |
1.0.3 | Fixed issues with stream instability |
1.0.4 | Major rewrite of the internals of the USB IP core to address instability issues |