User Interface
This is the documentation page for the RPi_UI board.
Overview
Assembly instructions
Specifications
Possible Configurations
External resources
Datasheets
Additional software
Related projects
Pinout
The 26 pin gpio connector is described at elinux
The SPI connector has the same pinout as the atmel 6-pin ICSP connector and is documented here: SPI_connector_pinout.
The I2C connector is documented here: I2C_connector_pinout.
The UART connector is documented here: uart connector pinout.
The analog connector has the following pinout:
pin | function |
---|---|
1 | 5V |
2 | Analog in |
3 | GND |
LEDs
The only LED is a power indicator.
jumper settings
There is one 2x2 pin jumper (JP1), which controls which SPI bus (actually which SPI chip-select line) is routed to the AVRs slave-select pin, and which is routed to the reset pin (to enable reprogramming of the AVR):
Left pads/pins connected: SPI0 connected to Slave-Select
Right pads/pins connected: SPI1 connected to RESET
Bottom pads/pins connected: SPI0 connected to RESET
Top (near the LCD) pads/pins connected: SPI1 connected to Slave-Select
There is also one solder jumper, SJ1, which controls the supply voltage on the SPI, I2C, and UART connectors:
1-2: 5V (left)
2-3: 3V3 (right, near the PCB edge)
Protocol
To make the RPI_UI PCB do things, you need to send things over the SPI or I2C bus to the PCB. A comparison of the two protocols can be found here.
The general overview of the SPI protocol is here.
The software
Controlling the display works the same way as our SPI_LCD or I2C_LCD modules. Reading the pushbuttons is very much like the DIO module. The read and write ports are described below.
write ports
Some ports just set a single value. So writing more than one byte to such a port is redundant. Other ports are logically a stream of bytes. So writing more than one byte is encouraged.
The rpi_ui board defines several ports.
port | function |
---|---|
0x00 | display data. |
0x01 | write data as command to LCD. |
0x10 | any data clears the screen. |
0x11 | move the cursor to line l, position p. l is the top 3 bits p is the bottom 5 bits of the data. |
0x12 | set contrast. |
0x13 | set backlight. |
0x14 | reinit LCD. |
0x70 .. 0x71 | Select which i/o is coupled to which ADC channel |
0x80 | Set number of ADC channels to read |
0x81 | Set number of samples to add (we suggest using a power of 2) (two bytes) |
0x82 | Set ammounts of bits to shift accumulated sample value |
0xf0 | change address. |
read ports
The rpi_ui board supports several read ports:
port | function |
---|---|
0x01 | identification string. (terminated with 0). |
0x02 | read eeprom (serial number). |
0x20 | read button 1 (1 means NOT pushed, 1 means pushed) |
0x21 | read button 2 (1 means NOT pushed, 1 means pushed) |
0x22 | read button 3 (1 means NOT pushed, 1 means pushed) |
0x23 | read button 4 (1 means NOT pushed, 1 means pushed) |
0x24 | read button 5 (1 means NOT pushed, 1 means pushed) |
0x25 | read button 6 (1 means NOT pushed, 1 means pushed) |
0x30 | reports which buttons have been pushed since last read of this register If you keep a button pushed, it will read out as 1 multiple times |
0x31 | reports which buttons have been pushed since last read of this register (V1.2 and up) If you keep a button pushed, it will read out as 1 only once |
0x40 | read button 1 (1 means pushed, 1 means NOT pushed) (V1.1 and up) |
0x41 | read button 2 (1 means pushed, 1 means NOT pushed) (V1.1 and up) |
0x42 | read button 3 (1 means pushed, 1 means NOT pushed) (V1.1 and up) |
0x43 | read button 4 (1 means pushed, 1 means NOT pushed) (V1.1 and up) |
0x44 | read button 5 (1 means pushed, 1 means NOT pushed) (V1.1 and up) |
0x45 | read button 6 (1 means pushed, 1 means NOT pushed) (V1.1 and up) |
0x60.. 0x61 | Return analog value (2 bytes) |
0x68 .. 0x69 | Return added and bitshifted analog value (2 bytes) |
0x70 .. 0x71 | Return which i/o is coupled to which ADC channel |
0x80 | Return number of ADC channels to read |
0x81 | Return number of samples to add (two bytes) |
0x82 | Return ammounts of bits to shift accumulated sample value |
Using the analog inputs
Please see this chapter on the page explaining the DIO protocol. There are two major differences:
- The internal reference voltage needs to be configured in a different way
- The mapping of the analog inputs; please use the following table instead:
IO pin | value |
---|---|
temp | 0xC7 (Vref=1V1) OR 0x47 (Vref=Vcc=~5V) |
ext | 0xC6 (Vref=1V1) OR 0x46 (Vref=Vcc=~5V) |
Example
Setup the ADC (only needed once after reboot):
bw_tool -a 94 -w 70:c7 //Set ADC channel 0 to temperature sensor, and internal 1V1 reference bw_tool -a 94 -w 80:01 //Set number of channels to sample to 1
Read the value:
bw_tool -a 94 -R 60:s // Read the result, output in hex
Using the temperature sensor
The temperature sensor is a MCP9700. It's output voltage depends on the temperature. For more information, please see the MCP9700 datasheet.
An initialization and readout script are available on the Temperature sensor example page.
examples
read identification
read the identification string of the board.
data sent | data recieved | explanation |
---|---|---|
0x95 | xx | select destination with address 0x94 for READ. |
0x01 | xx | identify |
xx | 0x73 | 's' |
xx | 0x70 | 'p' |
xx | 0x69 | 'i' |
xx | ... | etc. |
Send text to display
Display the string "Hello World!" (only the first 5 bytes of the string shown).
data sent | data recieved | explanation |
---|---|---|
0x94 | xx | select destination with address 0x94 for WRITE |
0x00 | xx | datastream |
0x48 | xx | 'H' |
0x65 | xx | 'e' |
0x6c | xx | 'l' |
0x6c | xx | 'l' |
0x6f | xx | 'o' |
xx | ... | etc. |
set cursor position
move to line 1, character 5:
data sent | data recieved | explanation |
---|---|---|
0x94 | xx | select destination with address 0x94 for WRITE |
0x11 | xx | port 0x11 = set cursor position. |
0x25 | xx | 0x25 = 001 00101 = line 1 position 5. |
Default operation
Future hardware enhancements
Future software enhancements
Changelog
1.0
- Initial public release