|
| 1 | +# SuperKey Hardware |
| 2 | + |
| 3 | +This page describes the SuperKey's hardware. |
| 4 | + |
| 5 | +## Microcontroller |
| 6 | + |
| 7 | +The SuperKey uses an [ATmega1284P microcontroller](https://www.microchip.com/en-us/product/ATmega1284p), currently |
| 8 | +produced by [Microchip Technology](https://www.microchip.com/). The datasheet for the ATmega1284P is available at |
| 9 | +[this link](https://ww1.microchip.com/downloads/en/DeviceDoc/ATmega164A_PA-324A_PA-644A_PA-1284_P_Data-Sheet-40002070B.pdf). |
| 10 | +The microcontroller uses a [dual inline package (DIP)](https://en.wikipedia.org/wiki/Dual_in-line_package) |
| 11 | +configuration, since this is the easiest type of integrated circuit for hobbyists to work with. |
| 12 | + |
| 13 | +### Clock |
| 14 | + |
| 15 | +The device uses a crystal oscillator with a frequency of 16 MHz as its primary clock inputs. This is connected to the |
| 16 | +`XTAL1` and `XTAL2` pins as shown in the schematic. |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +### Fuses |
| 21 | + |
| 22 | +The microcontroller fuse configuration was calculated using [this site](https://www.engbedded.com/fusecalc/). The fuses |
| 23 | +are set for the following options: |
| 24 | + |
| 25 | +- External Crystal Oscillator |
| 26 | + - Frequency 8.0+ MHz |
| 27 | + - Start-up time 16K clocks + 0 ms |
| 28 | +- Enable SPI programming |
| 29 | +- Enable JTAG |
| 30 | +- Enable brown-out detection at 2.7 V |
| 31 | + |
| 32 | +This leads to the following fuse bytes: |
| 33 | + |
| 34 | +- Low: `0xDF` |
| 35 | +- High: `0x99` |
| 36 | +- Extended: `0xFD` |
| 37 | + |
| 38 | +The fuses can be programmed with the following `avrdude` command: |
| 39 | + |
| 40 | +``` |
| 41 | +avrdude -c avrispmkii -P usb -p m1284p -U lfuse:w:0xdf:m -U hfuse:w:0x99:m -U efuse:w:0xfd:m |
| 42 | +``` |
| 43 | + |
| 44 | +### Pinout |
| 45 | + |
| 46 | +The pinout for the ATmega1284P is shown below: |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | +### Pin Assignments |
| 51 | + |
| 52 | +The current pin assignments are shown in the table below. Pins which are not listed are currently unassigned. |
| 53 | + |
| 54 | +| Pin | Function | Description | Notes | |
| 55 | +|-----|----------|----------------------------|---------------------------| |
| 56 | +| 6 | `MOSI` | SPI Controller Out | Only used for programming | |
| 57 | +| 7 | `MISO` | SPI Controller In | Only used for programming | |
| 58 | +| 8 | `SCK` | SPI Clock | Only used for programming | |
| 59 | +| 9 | `RESET` | Reset Device | | |
| 60 | +| 10 | `VCC` | Power | | |
| 61 | +| 11 | `GND` | Ground | | |
| 62 | +| 12 | `XTAL2` | Crystal Oscillator Input 2 | | |
| 63 | +| 13 | `XTAL1` | Crystal Oscillator Input 1 | | |
| 64 | +| 14 | `RXD0` | Interface Port UART RX | | |
| 65 | +| 15 | `TXD0` | Interface Port UART TX | | |
| 66 | +| 16 | `RXD1` | Debug Port UART RX | | |
| 67 | +| 17 | `TXD1` | Debug Port UART TX | | |
| 68 | +| 19 | `OC1A` | Buzzer Output | | |
| 69 | +| 20 | `PD6` | Key LED | Active high | |
| 70 | +| 21 | `PD7` | Status LED | Active high | |
| 71 | +| 30 | `AVCC` | ADC Power | ADC is currently unused | |
| 72 | +| 31 | `GND` | Ground | | |
| 73 | +| 32 | `AREF` | ADC Reference Voltage | ADC is currently unused | |
| 74 | +| 33 | `PA7` | Output TRS Ring | | |
| 75 | +| 34 | `PA6` | Output TRS Tip | | |
| 76 | +| 35 | `PA5` | Input TRS 2 Ring | | |
| 77 | +| 36 | `PA4` | Input TRS 2 Tip | | |
| 78 | +| 37 | `PA3` | Input TRS 1 Ring | | |
| 79 | +| 38 | `PA2` | Input TRS 1 Tip | | |
| 80 | +| 39 | `PA1` | Input TRS 0 Ring | | |
| 81 | +| 40 | `PA0` | Input TRS 0 Tip | | |
| 82 | + |
| 83 | +## Firmware Upload |
| 84 | + |
| 85 | +The executable is uploaded to the MCU using [`avrdude`](https://www.nongnu.org/avrdude/) and an |
| 86 | +[AVRISP mkII programmer](https://a.co/d/59zSwb5). |
| 87 | + |
| 88 | +``` |
| 89 | +avrdude -c avrispmkii -P usb -p m1284p -U flash:w:superkey.ihex -D |
| 90 | +``` |
0 commit comments