|
1 | 1 | Nitro μACM |
2 | 2 | ========== |
3 | 3 |
|
| 4 | +The Nitro μACM core is a small implementation of a USB CDC ACM device |
| 5 | +entirely in FPGA fabric using only FPGA IOs (and an external 1.5kohm |
| 6 | +resistor from the `usb_pu` to the USB DP line). |
| 7 | + |
| 8 | +Features: |
| 9 | + |
| 10 | + - Entirely synchronous design, running in a single clock domain at 48 MHz |
| 11 | + - For convenience, a lightweight clock-domain crossing helper is provided |
| 12 | + in the `examples/` directory if your user logic needs to run at a |
| 13 | + different rate. |
| 14 | + |
| 15 | + - Simple data interface similar to AXI-stream (`data`/`last`/`valid`/`ready`) |
| 16 | + |
| 17 | + - Flexible packet flushing (on-demand, immediate, after-timeout) depending |
| 18 | + on your application requirements. |
| 19 | + |
| 20 | + - Exposes a DFU-Runtime interface to integrate nicely if you're using a DFU |
| 21 | + bootloader to configure your FPGA. |
| 22 | + - This allows the host to programmatically request the reset of the fpga |
| 23 | + to its bootloader mode. |
| 24 | + - Includes all the requires `WinUSB` descriptors to work out-of-the-box |
| 25 | + under Win10+ without any user intervention configuring drivers. |
| 26 | + |
| 27 | + - Customizable descriptors (PID/VID/Strings/...) |
| 28 | + |
| 29 | + - Designed for easy "drop-in" integration |
| 30 | + - It generates a single source file you can use as a black box component |
| 31 | + - You can either build it yourself from this repo, or use the |
| 32 | + `no2muacm-bin` repository or one of the tagged release tarball. |
| 33 | + |
| 34 | + |
| 35 | +Example: |
| 36 | +-------- |
| 37 | + |
| 38 | +Refer to the `example/` directory to see how to use the core on some real boards. |
| 39 | + |
| 40 | + |
| 41 | +Building: |
| 42 | +--------- |
| 43 | + |
| 44 | +Currently the core is only setup for `iCE40` builds. Other FPGA targets will be |
| 45 | +coming soon. Feel free to open an issue if you have a particular need. |
| 46 | + |
| 47 | +To build the core you will need the corresponding OSS toolchain for your target |
| 48 | +and a RISC-V compiler (default is using `riscv-none-embed-` prefix. Change with |
| 49 | +`CROSS` environment variable). |
| 50 | + |
| 51 | +```bash |
| 52 | +$ cd gateware |
| 53 | +$ make |
| 54 | +``` |
| 55 | + |
| 56 | +This will create a `build/` directory with both a `muacm.v` and `muacm.ilang` |
| 57 | +(select whichever you prefer) that you can integrate as a single source file |
| 58 | +in your own project. |
| 59 | + |
| 60 | +To integrate the core in your own project you can either: |
| 61 | + |
| 62 | + - Just add this pre-built source as-is in your project for minimum hassle. |
| 63 | + |
| 64 | + - Add this repository as a submodule and call the `make` step from your own |
| 65 | + build system. |
| 66 | + |
| 67 | + - Add the `no2muacm-bin` repository as a submodule which should always contain |
| 68 | + pre-built version of the latest release of this core. |
| 69 | + |
| 70 | + |
| 71 | +Customization: |
| 72 | +-------------- |
| 73 | + |
| 74 | +You can customize several aspects of this core. Some of them can even be |
| 75 | +changed after synthesis in the pre-built core directly (useful if you plan |
| 76 | +to use `no2muacm-bin` releases. |
| 77 | + |
| 78 | +To customize prior to building, the most relevant file is `firmware/usb_desc.c` |
| 79 | +which contains all the USB descriptors that will be included and should be |
| 80 | +self-explanatory. |
| 81 | + |
| 82 | +To customize the pre-built netlist, a special python tool called |
| 83 | +`muacm_customize.py` is provided in `utils/`. Refer to the `--help` to see |
| 84 | +how to use it. This will allow direct patching of VID/PID/Strings inside |
| 85 | +the netlist. Note that strings are limited to 16 chars in this case (since |
| 86 | +space is pre-reserved during build). |
| 87 | + |
| 88 | + |
| 89 | +Clocking: |
| 90 | +--------- |
| 91 | + |
| 92 | +As mentionned in the "Features" above, the core runs entirely at 48 MHz. |
| 93 | + |
| 94 | +The requirements on the clock are pretty wide, the USB specification only requires |
| 95 | +it to be within 2500 ppm. And the clock-recovery mechanism used here is capable |
| 96 | +of decoding packets with much wider clock range. For instance, this core has been |
| 97 | +used sucessfully with the _iCE40_ `SB_HFOSC` which is 48 MHz +- 10%. YMMV though. |
| 98 | + |
| 99 | + |
| 100 | +Data interface: |
| 101 | +--------------- |
| 102 | + |
| 103 | +The data interface is synchronous to the clock of the μACM module |
| 104 | +and is essentially a pair of AXI Streaming interfaces, one for |
| 105 | +RX and one for TX. |
| 106 | + |
| 107 | + - `data` is the 8 bit data to/from the host |
| 108 | + |
| 109 | + - `last` is the packet delineation marker. For `out` (i.e. from host to |
| 110 | + FPGA) it indicates the USB packets boundary as received from the host. |
| 111 | + For `in`, it can be used to force sending short packets. |
| 112 | + |
| 113 | + - `valid` and `ready` are the handshake signals. Data transfer happens |
| 114 | + when both signals are high on the same cycle. |
| 115 | + |
| 116 | +The `in` interface also has two additional control signals that are |
| 117 | +independent from the streaming interface : |
| 118 | + |
| 119 | + - `in_flush_now`: Indicates that whatever pending data is still in buffers |
| 120 | + should be sent to the host ASAP. |
| 121 | + |
| 122 | + - `in_flush_time`: Indicates that any pending data can be sent to the host |
| 123 | + after some reasonable timeout (to avoid data staying in buffer waiting to |
| 124 | + fill a full USB packet). |
4 | 125 |
|
5 | 126 |
|
6 | 127 | License |
|
0 commit comments