Tim Edwards | 44bab47 | 2020-10-04 22:09:54 -0400 | [diff] [blame] | 1 | A quick documentation of the Caravel memory map and operation |
| 2 | --------------------------------------------------------------- |
| 3 | |
| 4 | Caravel pinout: |
| 5 | --------------- |
| 6 | |
| 7 | vdd3v3 |
| 8 | vdd1v8 |
| 9 | vss |
| 10 | gpio 1 bit, mainly used for external LDO control of user power supply |
| 11 | clock Master clock input |
| 12 | resetb Master reset (sense inverted) input |
| 13 | flash_csb SPI flash controller chip select (sense inverted) |
| 14 | flash_clk SPI flash controller clock |
| 15 | flash_io0 SPI flash controller data out |
| 16 | flash_io1 SPI flash controller data in |
| 17 | mprj_io 32 bits general purpose programmable digital or analog I/O |
| 18 | |
| 19 | Special-use pins for the management SoC: |
| 20 | ---------------------------------------- |
| 21 | |
| 22 | On power-up, the "mprj_io" GPIO are under complete control of the managment |
| 23 | SoC. The first 8 user GPIO are special-purpose pads with dedicated functions |
| 24 | for the management SoC: |
| 25 | |
| 26 | mprj_io[0] JTAG I/O |
| 27 | mprj_io[1] SDO, housekeeping SPI |
| 28 | mprj_io[2] SDI, housekeeping SPI |
| 29 | mprj_io[3] CSB, housekeeping SPI |
| 30 | mprj_io[4] SCK, housekeeping SPI |
| 31 | mprj_io[5] Rx, UART |
| 32 | mprj_io[6] Tx, UART |
| 33 | mrpj_io[7] IRQ |
| 34 | |
| 35 | The next 4 user GPIO are designed to be used with an SPI flash controller in |
| 36 | the user space. They allow the four pins to be overridden by the housekeeping |
| 37 | SPI to access the SPI flash in pass-through mode. |
| 38 | |
| 39 | mprj_io[8] user flash CSB |
| 40 | mprj_io[9] user flash SCK |
| 41 | mprj_io[10] user flash IO0 |
| 42 | mprj_io[11] user flash IO1 |
| 43 | |
| 44 | The user may additionally use any available GPIO for the SPI flash IO2 and IO3 |
| 45 | lines; the pass-through mode only uses the basic 4-pin SPI mode. |
| 46 | |
| 47 | All of the special-use pins are configured through a memory-mapped region. But |
| 48 | to avoid a large number of wires in the user space to reach all of the GPIO |
| 49 | pad controls, each user GPIO pad has a corresponding local control block. The |
| 50 | control block holds the configuration data for the corresponding pad. This |
| 51 | configuration data is a mirror of the data in the memory-mapped region, and is |
| 52 | loaded by a "transfer" bit in another memory-mapped register. In addition to |
| 53 | all of the static control bits for the GPIO, each block contains a single bit |
| 54 | that specifies whether that pad is under the control of the user or the management |
| 55 | area. All pins are configured from the management area. However, the configuration |
| 56 | of static control bits leaves three dynamic signals: input, output, and output |
| 57 | enable. One set of these three signals is available to the user when the pad is |
| 58 | under user control. The other set of these three signals is available to the |
| 59 | management SoC. Again, to reduce wiring, only the two pads for JTAG and the |
| 60 | housekeeping SDO have all three pins under control of the SoC; the remaining |
| 61 | pads have a single wire to the management SoC which is either an input wire |
| 62 | or an output wire, depending on how the control signals for the pad are set. |
| 63 | |
| 64 | This setup gives a simplified view of the pad to the user: For digital |
| 65 | applications, the user can treat the pad as a simple bidirectional digital |
| 66 | pad with an output enable to switch between output and input functions. |
| 67 | The user can set the output enable line high or low for a static input or |
| 68 | output function. The user will also have access to the ESD-protected |
| 69 | pad connections for analog signals, and can connect to the VDDA domain |
| 70 | input digital signal if needed. |
| 71 | |
| 72 | Memory map: |
| 73 | ----------- |
| 74 | |
| 75 | The Caravel memory map is as follows: |
| 76 | |
| 77 | SRAM: 0000 0000 |
| 78 | |
| 79 | Flash: Config: 1000 0000 |
| 80 | |
| 81 | UART: Clock divider: 2000 0000 |
| 82 | Data: 2000 0004 |
| 83 | |
| 84 | GPIO: Data: 2100 0000 |
| 85 | Output enable: 2100 0004 |
| 86 | Pullup 2100 0008 |
| 87 | Pulldown 2100 000c |
| 88 | |
| 89 | Counter 1: Config: 2110 0000 |
| 90 | Value: 2110 0004 |
| 91 | Data: 2110 0008 |
| 92 | |
| 93 | Counter 2: Config: 2120 0000 |
| 94 | Value: 2120 0004 |
| 95 | Data: 2120 0008 |
| 96 | |
| 97 | SPI master: Config: 2130 0000 |
| 98 | Data: 2130 0004 |
| 99 | |
| 100 | Logic analyzer: Data 0: 2200 0000 |
| 101 | Data 1: 2200 0004 |
| 102 | Data 2: 2200 0008 |
| 103 | Data 3: 2200 000c |
| 104 | Enable 0: 2200 0010 |
| 105 | Enable 1: 2200 0014 |
| 106 | Enable 2: 2200 0018 |
| 107 | Enable 3: 2200 001c |
| 108 | |
| 109 | Project ctrl: Data: 2300 0000 |
| 110 | Transfer: 2300 0004 |
| 111 | I/O Config: 2300 0008 |
| 112 | to 2300 0084 |
| 113 | Power Config: 2300 0088 |
| 114 | to 2300 0104 |
| 115 | |
| 116 | Flash ctrl: Config: 2D00 0000 |
| 117 | |
| 118 | System: PLL out: 2F00 0000 |
| 119 | Trap out: 2F00 0004 |
| 120 | IRQ7 source: 2F00 0008 |
| 121 | |
| 122 | User area base: 3000 0000 |
| 123 | |
| 124 | Crossbar: QSPI control 8000 0000 |
| 125 | Storage area 9000 0000 |
| 126 | Any slave 1 a000 0000 |
| 127 | Any slave 2 b000 0000 |
| 128 | |
| 129 | Project I/O Control: |
| 130 | --------------------- |
| 131 | |
| 132 | Configuration bits per I/O (13 bits for each GPIO pad): |
| 133 | Global Default |
| 134 | Bits 12-10: digital mode (3 bits) 001 |
| 135 | Bit 9: voltage trip point select 0 |
| 136 | Bit 8: slow slew select 0 |
| 137 | Bit 7: analog bus polarity 0 |
| 138 | Bit 6: analog bus select 0 |
| 139 | Bit 5: analog bus enable 0 |
| 140 | Bit 4: IB mode select 0 |
| 141 | Bit 3: input disable 0 |
| 142 | Bit 2: holdover value 0 |
| 143 | Bit 1: output disable 1 |
| 144 | Bit 0: management control enable 1 |
| 145 | |
| 146 | Default I/O modes: |
| 147 | ------------------ |
| 148 | mprj_io[0] JTAG I/O 110 0 0 0 0 0 0 0 0 0 1 |
| 149 | mprj_io[1] SDO, housekeeping SPI 110 0 0 0 0 0 0 0 0 0 1 |
| 150 | all others: 001 0 0 0 0 0 0 0 0 1 1 |
| 151 | |
| 152 | |
| 153 | Standard GPIO output configuration: |
Tim Edwards | 89f0924 | 2020-10-05 15:17:34 -0400 | [diff] [blame^] | 154 | mprj_io[6] Tx, UART 110 0 0 0 0 0 0 1 0 0 1 |
Tim Edwards | 44bab47 | 2020-10-04 22:09:54 -0400 | [diff] [blame] | 155 | |
| 156 | Standard GPIO input configuration: |
| 157 | mprj_io[*] 001 0 0 0 0 0 0 0 0 1 1 |
| 158 | |
| 159 | Standard GPIO input configuration with pullup: |
| 160 | mprj_io[*] 010 0 0 0 0 0 0 0 0 1 1 |
| 161 | |
| 162 | Standard GPIO input configuration with pulldown: |
| 163 | mprj_io[*] 011 0 0 0 0 0 0 0 0 1 1 |
| 164 | |
| 165 | Specifically: |
| 166 | JTAG and SDO are set to output. The output enable configure bit |
| 167 | is a don't-care, since the output enable line is directly controlled |
| 168 | by the module (JTAG or housekeeping SPI, respectively). |
| 169 | |
| 170 | All other I/O are set as input mode only, with output disabled. |
| 171 | |
| 172 | Tx is set to input like the others; before enabling the UART |
| 173 | from a program in flash, the I/O must be set to an output configuration. |
| 174 | |
| 175 | Note that the standard input configurations with pull-up and pull-down |
| 176 | require that "out" be set 1 or 0, respectively; since the I/O are |
| 177 | designed with minimal wiring, there is only one wire for input and |
| 178 | output, so the wire is used for input in these cases, and special |
| 179 | signal handling is done locally to set the value of "out" equal to |
| 180 | ~dm[0]. This is a (minor) restriction on the available I/O modes. |
| 181 | |
| 182 | Other possible modes are open-drain (for I2C), weak drive strength |
| 183 | output (5k up + down), and analog mode (digital disabled) |