| 1 |
3 |
ultra_embe |
### USB 1.1 Host Controller
|
| 2 |
|
|
|
| 3 |
|
|
This IP core is a cutdown USB host controller which allows communications with full-speed (12mbps) USB devices.
|
| 4 |
|
|
|
| 5 |
|
|
The IP is accessed via an AXI4-Lite slave register interface for control, status and data.
|
| 6 |
|
|
|
| 7 |
|
|
Data to be sent or received is stored in some internal FIFOs. The data is accessed through the AXI4-Lite slave port. There is no DMA engine (e.g. a bus mastering interface) associated with this IP.
|
| 8 |
|
|
|
| 9 |
|
|
The core functions well, is very small, but is fairly inefficient in terms of CPU cycles required to perform USB transfers.
|
| 10 |
|
|
This core is not compliant with any standard USB host interface specification, e.g OHCI or EHCI.
|
| 11 |
|
|
|
| 12 |
|
|
##### Instantiation
|
| 13 |
|
|
Instance usbh_host and hookup to UTMI PHY interface and a AXI4-Lite master (e.g. from your CPU).
|
| 14 |
|
|
The core requires a 48MHz/60MHz clock input, which the AXI4-Lite and UTMI interfaces are expected to be synchronous to.
|
| 15 |
|
|
|
| 16 |
|
|
##### Limitations
|
| 17 |
|
|
* Only tested for USB-FS (Full Speed / 12Mbit/s) only.
|
| 18 |
|
|
* AXI4-L address and data must arrive in the same cycle.
|
| 19 |
|
|
|
| 20 |
|
|
##### Testing
|
| 21 |
|
|
|
| 22 |
|
|
Verified under simulation and on FPGA with various USB devices attached (hubs, mass storage, network devices).
|
| 23 |
|
|
|
| 24 |
|
|
##### References
|
| 25 |
|
|
* [USB 2.0 Specification](https://usb.org/developers/docs/usb20_docs)
|
| 26 |
|
|
* [UTMI Specification](https://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/usb2-transceiver-macrocell-interface-specification.pdf)
|
| 27 |
|
|
* [USB Made Simple](http://www.usbmadesimple.co.uk/)
|
| 28 |
|
|
* [UTMI to ULPI Conversion](https://github.com/ultraembedded/cores/tree/master/ulpi_wrapper)
|
| 29 |
|
|
|
| 30 |
|
|
##### Configuration
|
| 31 |
|
|
* SOF_THRESHOLD - Number of clock cycles per millisecond (default: 48000 for 48MHz)
|
| 32 |
|
|
* CLKS_PER_BIT - Number of clock cycles per FS bit (default: 4 for 48MHz)
|
| 33 |
|
|
|
| 34 |
|
|
##### Size / Performance
|
| 35 |
|
|
|
| 36 |
|
|
With the default configuration...
|
| 37 |
|
|
|
| 38 |
|
|
* the design contains 317 registers, 392 LUTs (Xilinx ISE - Spartan 6)
|
| 39 |
|
|
* synthesizes to more than the required 48MHz on a Xilinx Spartan 6 LX9 (speed -3)
|
| 40 |
|
|
|
| 41 |
|
|
##### Register Map
|
| 42 |
|
|
|
| 43 |
|
|
| Offset | Name | Description |
|
| 44 |
|
|
| ------ | ---- | ------------- |
|
| 45 |
|
|
| 0x00 | USB_CTRL | [RW] Control of USB reset, SOF and Tx FIFO flush |
|
| 46 |
|
|
| 0x04 | USB_STATUS | [R] Line state, Rx error status and frame time |
|
| 47 |
|
|
| 0x08 | USB_IRQ_ACK | [W] Acknowledge IRQ by setting relevant bit |
|
| 48 |
|
|
| 0x0c | USB_IRQ_STS | [R] Interrupt status |
|
| 49 |
|
|
| 0x10 | USB_IRQ_MASK | [RW] Interrupt mask |
|
| 50 |
|
|
| 0x14 | USB_XFER_DATA | [RW] Tx payload transfer length |
|
| 51 |
|
|
| 0x18 | USB_XFER_TOKEN | [RW] Transfer control info (direction, type) |
|
| 52 |
|
|
| 0x1c | USB_RX_STAT | [R] Transfer status (Rx length, error, idle) |
|
| 53 |
|
|
| 0x20 | USB_WR_DATA | [W] Tx FIFO address for write data |
|
| 54 |
|
|
| 0x20 | USB_RD_DATA | [R] Tx FIFO address for read data |
|
| 55 |
|
|
|
| 56 |
|
|
##### Register: USB_CTRL
|
| 57 |
|
|
|
| 58 |
|
|
| Bits | Name | Description |
|
| 59 |
|
|
| ---- | ---- | -------------- |
|
| 60 |
|
|
| 7 | PHY_DMPULLDOWN | UTMI PHY D+ Pulldown Enable |
|
| 61 |
|
|
| 6 | PHY_DPPULLDOWN | UTMI PHY D+ Pulldown Enable |
|
| 62 |
|
|
| 5 | PHY_TERMSELECT | UTMI PHY Termination Select |
|
| 63 |
|
|
| 4:3 | PHY_XCVRSELECT | UTMI PHY Transceiver Select |
|
| 64 |
|
|
| 2:1 | PHY_OPMODE | UTMI PHY Output Mode |
|
| 65 |
|
|
| 1 | TX_FLUSH | Flush Tx FIFO |
|
| 66 |
|
|
| 0 | ENABLE_SOF | Enable SOF (start of frame) packet generation |
|
| 67 |
|
|
|
| 68 |
|
|
##### Register: USB_STATUS
|
| 69 |
|
|
|
| 70 |
|
|
| Bits | Name | Description |
|
| 71 |
|
|
| ---- | ---- | -------------- |
|
| 72 |
|
|
| 31:16 | SOF_TIME | Current frame time (0 - 48000) |
|
| 73 |
|
|
| 2 | RX_ERROR | Rx error detected (UTMI). Clear on new xfer. |
|
| 74 |
|
|
| 1:0 | LINESTATE_BITS | Line state (1 = D-, 0 = D+) |
|
| 75 |
|
|
|
| 76 |
|
|
##### Register: USB_IRQ_ACK
|
| 77 |
|
|
|
| 78 |
|
|
| Bits | Name | Description |
|
| 79 |
|
|
| ---- | ---- | -------------- |
|
| 80 |
|
|
| 3 | DEVICE_DETECT | Interrupt on device detect (linestate != SE0). |
|
| 81 |
|
|
| 2 | ERR | Interrupt on error conditions. |
|
| 82 |
|
|
| 1 | DONE | Interrupt on transfer completion. |
|
| 83 |
|
|
| 0 | SOF | Interrupt on start of frame. |
|
| 84 |
|
|
|
| 85 |
|
|
##### Register: USB_IRQ_STS
|
| 86 |
|
|
|
| 87 |
|
|
| Bits | Name | Description |
|
| 88 |
|
|
| ---- | ---- | -------------- |
|
| 89 |
|
|
| 3 | DEVICE_DETECT | Interrupt on device detect (linestate != SE0). |
|
| 90 |
|
|
| 2 | ERR | Interrupt on error conditions. |
|
| 91 |
|
|
| 1 | DONE | Interrupt on transfer completion. |
|
| 92 |
|
|
| 0 | SOF | Interrupt on start of frame. |
|
| 93 |
|
|
|
| 94 |
|
|
##### Register: USB_IRQ_MASK
|
| 95 |
|
|
|
| 96 |
|
|
| Bits | Name | Description |
|
| 97 |
|
|
| ---- | ---- | -------------- |
|
| 98 |
|
|
| 3 | DEVICE_DETECT | Interrupt on device detect (linestate != SE0). |
|
| 99 |
|
|
| 2 | ERR | Interrupt on error conditions. |
|
| 100 |
|
|
| 1 | DONE | Interrupt on transfer completion. |
|
| 101 |
|
|
| 0 | SOF | Interrupt on start of frame. |
|
| 102 |
|
|
|
| 103 |
|
|
##### Register: USB_XFER_DATA
|
| 104 |
|
|
|
| 105 |
|
|
| Bits | Name | Description |
|
| 106 |
|
|
| ---- | ---- | -------------- |
|
| 107 |
|
|
| 15:0 | TX_LEN | Tx transfer data length |
|
| 108 |
|
|
|
| 109 |
|
|
##### Register: USB_XFER_TOKEN
|
| 110 |
|
|
|
| 111 |
|
|
| Bits | Name | Description |
|
| 112 |
|
|
| ---- | ---- | -------------- |
|
| 113 |
|
|
| 31 | START | Transfer start request |
|
| 114 |
|
|
| 30 | IN | IN transfer (1) or OUT transfer (0) |
|
| 115 |
|
|
| 29 | ACK | Send ACK in response to IN data |
|
| 116 |
|
|
| 28 | PID_DATAX | DATA1 (1) or DATA0 (0) |
|
| 117 |
|
|
| 23:16 | PID_BITS | Token PID (SETUP=0x2d, OUT=0xE1 or IN=0x69) |
|
| 118 |
|
|
| 15:9 | DEV_ADDR | Device address |
|
| 119 |
|
|
| 8:5 | EP_ADDR | Endpoint address |
|
| 120 |
|
|
|
| 121 |
|
|
##### Register: USB_RX_STAT
|
| 122 |
|
|
|
| 123 |
|
|
| Bits | Name | Description |
|
| 124 |
|
|
| ---- | ---- | -------------- |
|
| 125 |
|
|
| 31 | START_PEND | Transfer start pending |
|
| 126 |
|
|
| 30 | CRC_ERR | CRC error detected |
|
| 127 |
|
|
| 29 | RESP_TIMEOUT | Response timeout detected (no response) |
|
| 128 |
|
|
| 28 | IDLE | SIE idle |
|
| 129 |
|
|
| 23:16 | RESP_BITS | Received response PID |
|
| 130 |
|
|
| 15:0 | COUNT_BITS | Received data count |
|
| 131 |
|
|
|
| 132 |
|
|
##### Register: USB_WR_DATA
|
| 133 |
|
|
|
| 134 |
|
|
| Bits | Name | Description |
|
| 135 |
|
|
| ---- | ---- | -------------- |
|
| 136 |
|
|
| 7:0 | DATA | Date byte |
|
| 137 |
|
|
|
| 138 |
|
|
##### Register: USB_RD_DATA
|
| 139 |
|
|
|
| 140 |
|
|
| Bits | Name | Description |
|
| 141 |
|
|
| ---- | ---- | -------------- |
|
| 142 |
|
|
| 7:0 | DATA | Date byte |
|
| 143 |
|
|
|