15.3.1.3 Configuring MSS GPIOs as Input, Output, Tristate, and Bi-directional

There are four modes of MSS GPIO, which can be configured using Libero SoC:

  • Input
  • Output
  • Bi-directional
  • Tristate

To configure a GPIO as an interrupt, configure GPIO as an input in Libero SoC. Enable the interrupt in SoftConsole using MSS GPIO Application Program Interfaces (APIs). See 15.3.2.1 Use Model 1: Configuring GPIOs to Act as Interrupt to Cortex-M3 Processor.

To configure a GPIO to simultaneously connect with fabric, select the Advanced Options and Fabric check boxes in Libero SoC, as shown in the following figure.

Figure 15-8. Configuring GPIOs as Input, Output, Tristate, or Bi-directional

Connectivity Preview

GPIOs have access to IO_A or IO_B MSIOs. If an MSIO is used by any shared peripheral, GPIOs cannot access those particular MSIOs. GPIOs can be connected directly to the fabric by selecting FABRIC_A or FABRIC_B.

GPIOs connecting to MSIOs can also be shared with fabric using the Advanced Options of the MSS GPIO configurator.

The following figure shows a graphical view of the current connections for the highlighted GPIO signal.

Figure 15-9. Connectivity Preview

Step 3

The configured GPIO signals are shown in the following figure.

Figure 15-10. GPIO Signals

Step 4

To generate a component, click the Generate Component shortcut in MSS configurator or select SmartDesign > Generate Component . The firmware driver folder and SoftConsole workspace are included in the design project.

Step 5

Click Generate Bitstream under Program Design to complete the *.fdb file generation.

Step 6

Double click Export Firmware under Handoff Design for Firmware Development in the Libero SoC design flow window to generate the SoftConsole Firmware Project. The SoftConsole folder contains the mss_gpio firmware driver. The firmware driver mss_gpio (mss_gpio.h and mss_gpio.c), which provides a set of functions for controlling the MSS GPIOs, can be downloaded from the Microchip Firmware Catalog.

Table 15-3. MSS GPIO APIs
Category API Description and Usage
Initialization MSS_GPIO_Init Used for initializing the GPIO byte-wide reset state
Configuration MSS_GPIO_config Used to configure GPIO as input, output, tristate, or bidirectional
Reading and setting MSS_GPIO_get_inputoutputs Sets the GPIO input state
MSS_GPIO_get_outputs Gets the GPIO input state
MSS_GPIO_set_outputs Sets the GPIO output state
MSS_GPIO_set_outputs Gets the GPIO output state
Interrupt control MSS_GPIO_disable_irq Disables the GPIO interrupt feature
MSS_GPIO_enable_irq Enables the GPIO interrupt feature
MSS_GPIO_clear_irq Clears the interrupt on GPIO
Important: The MSS GPIO supports full behavioral simulation models. See SmartFusion2 MSS BFM Simulation User Guide for more information.