
A small microcontroller on one 20 MHz clock:
-mnano5), no CSRs, with
CSR-less interrupts (custom-0 irq.* instructions and MRET). It fetches and loads over a 4-bit bus.ua[0], read over an 8-bit AXI4-Lite port, with a
conversion-done interrupt. Its debug outputs are on uo[7:3], and ui[7] starts a conversion without the CPU
(below).rst_n goes through a 2-flop synchronizer; everything leaves reset on the same clock edge.
| Address | Register |
|---|---|
| 0x0000_0000 - | PSRAM (16-bit addresses) |
| 0xFFFF_FF80 - FFBF | FPGA island: CFG (write a bitstream nibble), CTRL, TO / FROM (data port) |
| 0xFFFF_FFC0 - FFDF | ADC: CTRL (even addresses), DATA (odd) |
| 0xFFFF_FFE0 | UART: bit 0 = TX line |
| 0xFFFF_FFF0 / FFF4 | Timer: CNT (read), CMP (write) |
| 0xFFFF_FFF8 | Interrupt controller: enables |
SCK is clk gated: one SCK pulse per clock cycle of a transaction, none outside. The chip changes CS#, IO and its IO
drive at the rising edge; the emulator samples on SCK's falling edge.
riscv32-nano5-elf-gcc -mnano5 (crt0 with the three interrupt vectors) into the PSRAM
emulator on uio[5:0].ui[0] (RX) / uo[0] (TX).rst_n low; the program runs from address 0.ua[0] and read the result through the ADC's registers.The ADC's observation outputs go to the pins (uo[7] through a flop, one clk cycle late); sample them at the rising
edge of clk (dbg_busy and eoc are decoded from the ADC's step counter and can glitch between edges).
| Pin | Signal |
|---|---|
uo[3] |
dbg_start: one-cycle pulse when a conversion starts |
uo[4] |
sdo_valid: the serial result bit on uo[6] is valid |
uo[5] |
eoc: end of conversion (one cycle) |
uo[6] |
sdo: serial result |
uo[7] |
dbg_busy (conversion running) when ui[3] = 0, dbg_outp (the comparator's other rail, buffered) when ui[3] = 1, registered: one clk cycle late |
ui[7] |
external START: 1 starts a conversion while the ADC is idle (OR'ed with the AXI START; through a 2-flop synchronizer) |
A conversion can be run from the board alone: pulse ui[7], then take sdo in each cycle where sdo_valid is 1
(8 bits, MSB first); eoc follows. Keep ui[7] at 0 while a program uses the ADC.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | UART RX | UART TX | PSRAM IO0 |
| 1 | FPGA pad_in[0] | FPGA pad_out[0] | PSRAM IO1 |
| 2 | FPGA pad_in[1] | FPGA pad_out[1] | PSRAM IO2 |
| 3 | ADC debug select (uo[7]) | ADC dbg_start | PSRAM IO3 |
| 4 | ADC sdo_valid | PSRAM CS# | |
| 5 | ADC eoc | PSRAM SCK | |
| 6 | ADC sdo | FPGA pad_io[0] | |
| 7 | ADC external start | ADC dbg_busy / dbg_outp (1 clk late) | FPGA pad_io[1] |
ua | PCB Pin | Internal index | Description |
|---|---|---|---|
| 0 | C | 0 | ADC input |