Mizar32/GPIO

      Introduction

      GPIO means General Purporse Input/Output and is the generic name for all the pins of the AVR32UC3A microcontroller. Every pin of the microcontroller is a GPIO pin except for the power supply pins, the pin that resets the processor and the USB JTAG signal connections. This includes the connections to the SDRAM and every other input or output signal.

      Each of the GPIO pins can be programmed to have one of three functions, and the three functions are different for every pin. When the Mizar32 is turned on, it is deaf and blind and the first thing that the on-board software must do is to program the correct function for each of the GPIO pins that are necessary for it to be able to talk to the rest of the world.

      For example, eLua does the following when it starts up:

      • it programs the pins that are connected to the oscillator crystals to function as oscillator inputs. This increases its processing speed from 115kHz (its internal oscillator) to 66MHz (the external oscillator). It also programs the pins connected to the 32768Hz crystal as oscillator inputs so that it can measure time accurately;
      • it programs the pins connected to the SDRAM memory to work as SDRAM memory pins so that, as well as the 64Kbyte (Models A and B) or 32Kbyte (Model C) internal RAM, it can also access the 32Mbyte SDRAM memory chip;
      • if you have configured the eLua console to be on the serial port, it programs UART0's RX and TX pins to talk RS232;
      • if your eLua firmware includes MMC/SD card support, the pins of the second SPI port, SPI1, are programmed to talk the MMC/SD card.

      The GPIO pins for all other devices are programmed to perform their function the first time you call them from Lua. If you are not using some device you are free to use its GPIO pins as simple input/output pins: see the PIO section for further details on how to do this.

      Pin functions

      On the Mizar32, the following functions are assigned to the GPIO pins:

      Port A

      PIN SIGNAL Description Bus pin
      PA00 UART0_RX Right bus serial port BUS4 pin 3
      PA01 UART0_TX BUS4 pin 4
      PA02 GPIO2 Bus GPIO, 4mA max, VGA SRAM /HOLD pin BUS5 pin 11
      PA03 UART0_RTS Right bus serial port BUS4 pin 5
      PA04 UART0_CTS BUS4 pin 6
      PA05 UART1_RX Left bus serial port BUS3 pin 3
      PA06 UART1_TX BUS3 pin 4
      PA07 GPIO7 Bus GPIO, 4mA max BUS5 pin 12
      PA08 UART1_RTS Left bus serial port BUS3 pin 10
      PA09 UART1_CTS BUS3 pin 9
      PA10 SPI0_CS0 Left bus SPI BUS1 pin 12
      PA11 SPI0_MISO BUS1 pin 13
      PA12 SPI0_MOSI BUS1 pin 14
      PA13 SPI0_SCK BUS1 pin 15
      PA14 SPI1_CS0 SD card chip select None
      PA15 SPI1_SCK Right bus SPI/SD card clock BUS4 pin 9
      PA16 SPI1_MOSI Right bus SPI/SD card data in (host->card) BUS4 pin 10
      PA17 SPI1_MISO Right bus SPI/SD card data out (card->host) BUS4 pin 11
      PA18 SPI1_CS1 "FREE" None
      PA19 SPI1_CS2 Right bus SPI chip select BUS4 pin 12
      PA20 EXT_INT  ? BUS5 pin 13
      PA21 ADC0 ADC BUS5 pin 5
      PA22 ADC1 BUS5 pin 6
      PA23 ADC2 BUS5 pin 7
      PA24 ETHERNET Ethernet interrupt BUS2 pin 3
      PA25 ADC4 ADC BUS6 pin 4
      PA26 ADC5 BUS6 pin 5
      PA27 ADC6 BUS6 pin 6
      PA28 ADC7 BUS6 pin 7
      PA29 SDA I2C BUS2 pin 10
      PA30 SCL BUS2 pin 11
      ↑Jump back a section

      Port B

      PIN SIGNAL Description Bus pin
      PB00 REF_CLK Ethernet BUS1 pin 3
      PB01 TX_EN BUS1 pin 4
      PB02 TX0 BUS1 pin 5
      PB03 TX1 BUS1 pin 6
      PB04 X None
      PB05 RX0 BUS2 pin 5
      PB06 RX1 BUS2 pin 6
      PB07 RX_ER BUS2 pin 7
      PB08 MDC BUS2 pin 4
      PB09 MDIO BUS2 pin 8
      PB10 SDCK SDRAM None
      PB11 SDCKE None
      PB12 RASn None
      PB13 CASn None
      PB14 SDWEn None
      PB15 RX_DV Ethernet BUS1 pin 7
      PB16 SDA10 SDRAM A10 None
      PB17 GPIO49 Bus GPIO, 4mA max BUS5 pin 8
      PB18 GPIO50/PWM6 Bus GPIO, 4mA max/PWM channel 6 BUS5 pin 9
      PB19 PWM0 PWM BUS4 pin 7
      PB20 PWM1 BUS4 pin 8
      PB21 PWM2 None
      PB22 PWM3 BUS6 pin 1
      PB23 UART1_DCD Left bus serial port BUS3 pin 5
      PB24 UART1_DSR BUS3 pin 6
      PB25 UART1_DTR BUS3 pin 7
      PB26 UART1_RI BUS3 pin 8
      PB27 PWM4 PWM channel 4 BUS6 pin 2
      PB28 PWM5 BUS6 pin 3
      PB29 GPIO61/LED On-board LED (0=lit) None
      PB30 GPIO62 Bus GPIO, 4mA max BUS6 pin 9
      PB31 GPIO63 BUS6 pin 10
      ↑Jump back a section

      Port C

      PIN SIGNAL Description
      PC00 Xin32 32768Hz crystal "X2" (*)
      PC01 Xout32
      PC02 Xin0 12MHz crystal "X1"
      PC03 Xout0
      PC04 Xin1 Not used
      PC05 Xout1
      • ) On circuit pads C47 before Mizar32 v1.3.2
      ↑Jump back a section

      Port X

      PIN SIGNAL Description Bus pin
      PX00 D10 SDRAM None
      PX01 D9
      PX02 D8
      PX03 D7
      PX04 D6
      PX05 D5
      PX06 D4
      PX07 D3
      PX08 D2
      PX09 D1
      PX10 D0
      PX11 DQM1
      PX12 X
      PX13 X
      PX14 CS1n
      PX15 X
      PX16 GPIO88/BUTTON Bus GPIO/Push button on main board (low when pressed) BUS6 pin 13
      PX17 A17 SDRAM BA1 None
      PX18 A16 SDRAM BA0
      PX19 GPIO85 Bus GPIO, 4mA max BUS6 pin 12
      PX20 A14 SDRAM A12 None
      PX21 A13 SDRAM A11
      PX22 GPIO82 Bus GPIO, 4mA max (SDRAM A10 is on PB16) BUS6 pin 11
      PX23 A11 SDRAM A9 None
      PX24 A10 SDRAM A8
      PX25 A9 SDRAM A7
      PX26 A8 SDRAM A6
      PX27 A7 SDRAM A5
      PX28 A6 SDRAM A4
      PX29 A5 SDRAM A3
      PX30 A4 SDRAM A2
      PX31 A3 SDRAM A1
      PX32 A2 SDRAM A0
      PX33 GPIO71 Bus GPIO, 4mA max BUS5 pin 10
      PX34 DQM0 SDRAM None
      PX35 D15
      PX36 D14
      PX37 D13
      PX38 D12
      PX39 D11

      Legend

      • X = Pin is not connected to anything
      • Foo/Bar = signal is used for more than one thing

      Bus renaming In Mizar32 v1.3.2, the bus connectors were renamed

      Old New Also known as
      P3 BUS1 BUS_HALF_LEFT_UP
      P4 BUS2 BUS_HALF_LEFT_DOWN
      P2 BUS3 BUS_HALF_LEFT_EXT
      P5 BUS4 BUS_HALF_RIGHT_UP
      P6 BUS5 BUS_HALF_RIGHT_DOWN
      P7 BUS6 BUS_HALF_RIGHT_EXT

      eLua view

      The eLua module pio provides names for these pins:

       pio.PA_00 .. pio.PA_30
       pio.PB_00 .. pio.PB_31
       pio.PC_00 .. pio.PC_05
       pio.PX_00 .. pio.PX_39
      

      Further reading

      • The PIO section explains further how these pins are used.
      • There is a summary table of the possible functions that can be assigned to each GPIO pin in the Atmel AVR32UC3A Datasheet in section 12.7 "Peripherals: Peripheral Multiplexing on I/O lines", table 12-9.
      • The last part of the file in the AVR32 GNU toolchain /usr/avr32/include/avr32/uc3a0128.h gives a complete definition of what functions can be assigned to each pin.
      ↑Jump back a section
      Last modified on 23 August 2012, at 22:25