AN2261 APPLICATION NOTE

Similar documents
AN2667 Application note

AN4321 Application note

Description SPC564A-DISP. March 2014 DocID Rev 3 1/5

Main components USB charging controller with integrated power switch

STM32 embedded target for MATLAB and Simulink release 3.1. Summary for STM32 embedded target for MATLAB and Simulink release 3.1:

ST10F271B/E, ST10F272B/E Errata sheet

AN4274 Application note

ST21NFCB. Near field communication controller. Features. RF communications. Hardware features. Communication interfaces. Electrical characteristics

STEVAL-SPBT4ATV3. USB dongle for the Bluetooth class 1 SPBT2632C1A.AT2 module. Features. Description

LD A very low drop adjustable positive voltage regulator. Description. Features

AN4440 Application note

AN2672 Application note

STEVAL-CCM002V1. TFT-LCD panel demonstration board based on the STM32 as LCD controller. Features. Description

AN4113 Application note

AN4308 Application note

AN2676 Application note

AN2061 APPLICATION NOTE

STEVAL-PCC010V1. ST802RT1A Ethernet PHY demonstration board with STM32F107 controller add-on board. Features. Description

ST33F1M, ST33F1M0, ST33F896, ST33F768, ST33F640, ST33F512

AN3996 Application Note

EMIF03-SIM06F3. 3-line IPAD, EMI filter including ESD protection. Description. Features. Application. Complies with the following standards:

ECMF02-3F3. Common mode filter with ESD protection. Features. Description. Applications. Complies with the following standard:

UM1719 User manual. The STPM3x evaluation software. Introduction

STM32-MP3NL/DEC. STM32 audio engine MP3 decoder library. Description. Features

AN1335 APPLICATION NOTE

AN4464 Application note

AN626 Application note

AN2143 Application note

AN2825 Application Note

EV-VNQ5E050AK VNQ5E050AK evaluation board

AN3279 Application Note

Description of STM8 LIN software package (STSW-STM8A-LIN) release 4.1. Table 1. Release information. STM8 LIN package

AN2470 Application note TS4871 low voltage audio power amplifier Evaluation board user guidelines Features Description

UM0792 User manual. Demonstration firmware for the DMX-512 communication protocol transmitter based on the STM32F103Zx.

ST19NP18-TPM-I2C Trusted Platform Module (TPM) with I²C Interface Features

UM1572 User manual. STEVAL-IPE020V1: ST energy meter application based on the Android platform. Introduction

AN2855 Application note

UM0693 User manual. 1 Introduction. STM8L101-EVAL demonstration firmware

UM0401 User manual. User manual for eight bit port expander STMPE801 demonstration board. Introduction

AN2737 Application note Basic in-application programming example using the STM8 I 2 C and SPI peripherals Introduction

AN3348 Application note

STM3210B-SK/KEIL STR91X-SK/KEI, STR7-SK/KEIL

UM1488 User manual. STPMC1 evaluation software. Introduction

AN3965 Application note

OSPlus USB Extension. OSPlus USB 2.0 extension. Description. Features. Application. TCP/IP stack NexGenOS NexGenIP VFS. FAT Ext2 LVM Device layer

AN3354 Application note

STTS V memory module temperature sensor. Features

STM8 I 2 C optimized examples

STM32-SK/KEIL STR91X-SK/KEI, STR7-SK/KEIL

STEVAL-IDW001V1. Wi-Fi daughterboard for STM32F0DISCOVERY. Description. Features

STEVAL-VNH5019A. Motor driver evaluation board based on VNH5019A. Description. Features

STM8-SK/RAIS STM8-D/RAIS ST7-SK/RAIS ST7-D/RAIS

EVAL6235PD. L6235 three-phase brushless DC motor driver demonstration board. Features. Description

AN3154 Application note

This document describes the hardware architecture of the board, how to configure the jumpers and to enable specific functions.

STEVAL-IHM028V1. 2 kw 3-phase motor control demonstration board featuring the IGBT intelligent power module STGIPS20K60. Features.

STA bit single chip baseband controller for GPS and telematic applications. Features

STM3220G-SK/KEI. Keil starter kit for STM32F2 series microcontrollers (STM32F207IG MCU) Features. Description

AN2673 Application note

AN3980 Application note

AN2734 Application note S-Touch design procedure Introduction

AN3964 Application note

STLC2500D. Bluetooth V2.1 "Lisbon" + EDR. Features. Description

AN2430 Application note

SOT23-6L ESDALCL6-2SC6

AN2240 Application note

AN2474 Application note

Obsolete Product(s) - Obsolete Product(s)

ST33F1M. Smartcard MCU with 32-bit ARM SecurCore SC300 CPU and 1.25 Mbytes high-density Flash memory. Features. Hardware features.

STM32-SK/RAIS,STR91X-SK/RAI,STR7-SK/RAIS STM32-D/RAIS,STR9-D/RAIS,STR7-D/RAIS

AN3250 Application note

AN2202 Application note

STICE CF/Stice_Connect AD/Stice_Connect AS/Stice_Connect

AN2557 Application note

ST19WR08 Dual Contactless Smartcard MCU With RF UART, IART & 8 Kbytes EEPROM Features Contactless specific features

Main components 1 A, high efficiency adjustable single inductor dual mode buckboost DC-DC converter

AN2361 Application note

UM1677 User manual. Getting started with STM32F030 Value Line Discovery development tools. Introduction

Obsolete Product(s) - Obsolete Product(s)

AN3423 Application note

STEVAL-ILL055V1: 11 W offline LED drive with high power factor based on HVLED815PF (EU input range) Figure 1. STEVAL-ILL055V1

EMIF01-SMIC01F2 IPAD. Single line EMI filter including ESD protection. Main application. Description. Benefits. Pin configuration (Bump side view)

EMIF02-SPK02F2. 2-line IPAD, EMI filter and ESD protection. Features. Application. Description. Complies with the following standards

AN2408 Application note

EMIF02-MIC01F2 2-line IPAD, EMI filter including ESD protection Features Application Description Complies with the standards:

AN2592 Application note

SMP75. Trisil for telecom equipment protection. Features. Description. Applications. Benefits

Getting started with DfuSe USB device firmware upgrade STMicroelectronics extension

UM1084 User manual. CR95HF development software user guide. Introduction. Reference documents

AN4290 Application note

STMicroelectronics. STxP70-4 assembler. User manual Rev A. October

How to interpret the LPS331AP pressure and temperature readings. Main components mbar absolute barometer with digital output

AN3001 Application note

AN2792 Application note

AN3362 Application note

AN2618 Application note

AN2594 Application note

TN0132 Technical note

AN2781 Application note

b. Typical values, independent of external clock frequency and supply voltage. a. TCG website:

Transcription:

APPLICATION NOTE GPIO ports configuration in ST30 devices INTRODUCTION The General Purpose IO (GPIO) Ports of ST30 devices are programmable by software in several modes:, Output, Alternate Function,, Output pushpull, Bidirectional weak push-pull and High impedance. It is possible to manage Analog input as well. This document describes best practice for GPIO ports configuration. Rev 2 September 2013 1/18 www.st.com 1

Contents 1 Introduction.................................................. 4 1.1 Functional description........................................... 4 1.2 Port configuration.............................................. 5 1.2.1 configuration.............................................. 5 1.2.2 Bidirectional configuration........................................ 6 1.2.3 Output configuration............................................ 6 1.2.4 Alternate Function configuration................................... 7 1.2.5 Analog input configuration........................................ 7 1.3 Port configuration procedure...................................... 8 1.3.1 Recommended configuration sequence............................. 8 1.3.2 From Alternate push-pull......................................... 9 1.3.3 From Alternate Function open drain................................ 9 1.3.4 From Output push-pull.......................................... 10 1.3.5 From........................................ 11 1.3.6 From /Output............................................. 12 1.3.7 From................................................... 13 1.3.8 From............................................. 14 1.4 Registers description.......................................... 15 1.4.1 Port Configuration Register 0 (PC0)............................... 15 1.4.2 Port Configuration Register 1 (PC1)............................... 16 1.4.3 Port Configuration Register 2 (PC2)............................... 16 2 Revision history.............................................. 17 2/18

List of tables Table 1. Port configuration summary................................................. 5 3/18

1 Introduction AN2261 1 Introduction The ST30 micro controller has up to seven 16-bit General Purpose I/O Ports. These ports are programmable by software in several modes:, Output, Alternate Function, Output open drain, Output push-pull, Bidirectional weak push-pull and High impedance. It is possible to manage Analog input as well. Main features of the GPIO ports are listed hereafter: /Output Alternate Function TTL Output push-pull Output weak push-pull Full software programmability 1.1 Functional description Figure 1 shows the basic structure of a General Purpose IO Port bit. A writing access to the IO Data register always loads the written data in the Output Latch. Any read access to the data register returns the content of the Latch. Depending upon the pin configuration the Latch either captures the physical signal level of the IO pin or holds the value of the Output Latch. Figure 1. Basic structure of an I/O port bit Alternate Function (IN) I/O PORT REGISTER INPUT LATCH OUTPUT LATCH TTL Alternate Function (OUT) Push-Pull Tristate Open Drain Weak Push-Pull I/O PIN The General Purpose IO Port has three configuration registers (PC0, PC1 and PC2) and one IO Data register (PD). 4/18

1 Introduction All the allowed port configurations, set by programming of the configuration registers are summarized in Table 1, where the index (n) is a generic IO bit. Table 1. Port configuration summary Register Analog Reserved Output Output Open Drain Output Push Pull Alternate Function Open Drain Alternate Function Push Pull PC0(n) 0 1 0 1 0 1 0 1 PC1(n) 0 0 1 1 0 0 1 1 PC2(n) 0 0 0 0 1 1 1 1 The number of available IO bits depends upon the package, the number of Alternate Function lines is directly related to the number of implemented peripherals. Please, refer to the datasheet for details. The configuration of the GPIO port at Reset depends from each specific device. Please, refer to the device s datasheet for default values. 1.2 Port configuration This paragraph illustrates in details the characteristic and functionality of each port mode. 1.2.1 configuration When the IO Port is programmed as : The Output Buffer is forced tristate The data present on the IO pin is sampled into the Latch every clock cycle A reading access to the Data register gets the value in the Latch. Figure 2 shows the Configuration of the IO Port bit. Figure 2. configuration Alternate Function (IN) I/O PORT DATA REGISTER INPUT LATCH OUTPUT LATCH TTL Tristate I/O PIN Alternate Function (OUT) 5/18

1 Introduction AN2261 1.2.2 Bidirectional configuration When the IO Port is programmed as Bidirectional: The Output Buffer is turned on in weak push-pull configuration The data in the Output Latch drives the IO pin A reading access to the IO Data register gets the Latch value. Figure 3 shows the Bidirectional Configuration of the IO Port. Figure 3. Bidirectional configuration Alternate Function (IN) I/O PORT DATA REGISTER INPUT LATCH OUTPUT LATCH Weak Push-Pull I/O PIN Alternate Function (OUT) 1.2.3 Output configuration When the IO Port is programmed as Output: The Output Buffer is turned on in open drain or push-pull configuration The data in the Output Latch drives the IO pin A reading access to the IO Data register gets the Output Latch value. Figure 4 shows the Output configuration of the IO Port bit. Figure 4. Output configuration Alternate Function (IN) I/O PORT DATA REGISTER INPUT LATCH OUTPUT LATCH Open Drain Push-Pull I/O PIN Alternate Function (OUT) 6/18

1 Introduction 1.2.4 Alternate Function configuration When the IO Port is programmed as Alternate Function: The Output Buffer is turned on in open drain or push-pull configuration The Output Buffer is driven by the signal coming from the peripheral (alternate function out) The data present on the IO pin is sampled into the Latch every clock cycle A reading access to the Data register gets the value in the Latch. Note: This pin configuration is Alternate Function Output. An alternate function input like UART_RX or capture must be always configured as.the reason for this is that an input signal can be distributed to all resources simultaneously, while an output signal must multiplexed among several sources (Output Latch, peripheral block, etc.) to avoid signal level conflicts. Figure 5 shows the Alternate Function configuration of the IO Port bit. Figure 5. Alternate Function configuration Alternate Function (IN) I/O PORT DATA REGISTER INPUT LATCH OUTPUT LATCH Open Drain Push-Pull I/O PIN Alternate Function (OUT) 1.2.5 Analog input configuration When the IO Port is programmed as Analog input configuration: The Output Buffer is forced tristate The Buffer is disabled (the Alternate Function is forced to a constant value) The can be input to an Analog peripheral. A reading access to the IO Data register gets the Output Latch value. 7/18

1 Introduction AN2261 Figure 6 shows the Analog input configuration of the IO Port bit. Figure 6. Analog input configuration I/O PORT DATA REGISTER INPUT LATCH OUTPUT LATCH Tristate I/O PIN Alternate Function (OUT) 1.3 Port configuration procedure In order to configure the port up to three (read-modify-) write accesses could be needed to change the actual pin configuration to the targeted one. Since these accesses can only be performed sequentially, intermediate configurations could result. To avoid undesired intermediate configurations and possible glitches, the following sequences are recommended. 1.3.1 Recommended configuration sequence It appears that the safest sequence for writing the Port Configuration registers in most situations is: PC2 - PC1 - PC0 The exceptions to this would be in the following transitions: 1. /Output to 2. /Output to Output push-pull 3. /Output to Alternate Function open drain 4. to 5. to Alternate Function open drain In all of these cases the safest sequence for writing the PC registers is: PC0 - PC1 - PC2 Note: It is possible to have a level change on a pin when transitioning between open drain and pushpull output modes. The resulting output level may be determined by the state of the GPIO Output, Alternate Function Output and/or external pull-up/down (if any). The user needs to be aware of the state of an output when changing the pin configuration. 8/18

1 Introduction 1.3.2 From Alternate push-pull If the port is set to Alternate Push pull, use the following sequences to change mode. Alternate push-pull to /Output IN Alternate push-pull to /Output IN Alternate push-pull to /Output /Output Alternate push-pull to Output push-pull Alternate push-pull to Output Push pull Output push-pull Alternate push-pull to Alternate Function open drain Alternate Function open drain 1.3.3 From Alternate Function open drain If the port is set to Alternate Function open drain, use the following sequences to change mode. Alternate Function Open-Drain to Reserved 9/18

1 Introduction AN2261 Alternate Function Open-Drain to Reserved IN Alternate Function Open-Drain to /Output Reserved /Output Alternate Function Open-Drain to Alternate Function Open-Drain to Output push-pull Output push-pull Alternate Function Open-Drain to Alternate Function push-pull Alternate Function push-pull 1.3.4 From Output push-pull If the port is set to Output Push pull, use the following sequences to change mode. Output push-pull to Output push-pull to Output push-pull to Output /Output 10/18

1 Introduction Output push-pull to Output push-pull to Alternate Function open drain Alternate Function push-pull Alternate Function open drain Output push-pull to Alternate Function push-pull Alternate Function push-pull 1.3.5 From If the port is set to Output Open-Drain, use the following sequences to change mode. to to IN to /Output Reserved /Output to Output push-pull Output push-pull to Alternate Function open drain Alternate Function open drain 11/18

1 Introduction AN2261 to Alternate Function push-pull Alternate Function open drain Alternate Function push-pull 1.3.6 From /Output If the port is set to /Output, use the following sequences to change mode. /Output to /Output to Output to Alternate Function push-pull (1) Output Push pull (2) 1. Glitch possible if alternate function is a test function 2. Glitch possible if OUTPUT = 1 with no external pull-up Alternatively, the following sequence can be used: Reserved /Output to Output push-pull Alternate Function push-pull (1) Output push-pull 1. Glitch possible if alternate function is a test function Alternatively, the following sequence can be used: Output push-pull 12/18

1 Introduction /Output to Alternate Function open drain Alternate Function push-pull (1) Alternate Function open drain 1. Glitch possible if alternate function is a test function, and If OUTPUT = 1 with no external pull-up Alternatively, the following sequence can be used:, 1.3.7 From Reserved Alternate Function open drain /Output to Alternate Function push-pull Alternate Function push-pull If the port is set to, use the following sequences to change mode. to to /Output /Output to OUTOPP (1) 1. Glitch possible if OUTPUT = 1 with no external pull-up Alternatively, the following sequence can be used: 13/18

1 Introduction AN2261 to Output push-pull 1.3.8 From Output push-pull to Alternate Function open drain Output push-pull (1) Alternate Function push-pull (2) (3) 1. Glitch possible if OUTPUT differs from ALT OUTPUT value 2. Glitch possible if OUTPUT = 1 with no external pull-up 3. Glitch possible is alternate function is a test function Alternatively, the following sequence can be used: Reserved Alternate Function open drain to Alternate Function push-pull Output push-pull Alternate Function push-pull If the port is set to, use the following sequences to change mode. to to /Output Reserved /Output to 14/18

1 Introduction to Output push-pull Output push-pull to Alternate Function open drain Alternate Function open drain to Alternate Function push-pull Alternate Function open drain Alternate Function push-pull 1.4 Registers description For the base address of the Port configuration register, please, refer to the device s User Manual. Note: GPIO Port registers can not be accessed by byte. 1.4.1 Port Configuration Register 0 (PC0) Address Offset: 00h Reset value: Refer to the device Architecture Overview section of the device s datasheet. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 C015 C014 C013 C012 C011 C010 C09 C08 C07 C06 C05 C04 C03 C02 C01 C00 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw Bit 15:0 C0[15:0]: Port Configuration bits. See Table 1 to configure the IO Port. 15/18

1 Introduction AN2261 1.4.2 Port Configuration Register 1 (PC1) Address Offset: 04h Reset value: Refer to the device Architecture Overview section of the device s datasheet. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 C115 C114 C113 C112 C111 C110 C19 C18 C17 C16 C15 C14 C13 C12 C11 C10 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw Bit 15:0 C1[15:0]: Port Configuration bits. See Table 1 to configure the IO Port. 1.4.3 Port Configuration Register 2 (PC2) Address Offset: 08h Reset value: Refer to the device Architecture Overview section of the device s datasheet. 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 C215 C214 C213 C212 C211 C210 C29 C28 C27 C26 C25 C24 C23 C22 C21 C20 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw Bit 15:0 C2[15:0]: Port Configuration bits. See Table 1 to configure the IO Port. 16/18

2 Revision history 2 Revision history Date Revision Changes 08-Nov-2005 1 Initial release. 25-Sep-2013 2 Updated disclaimer. 17/18

Please Read Carefully: Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries ( ST ) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice. All ST products are sold pursuant to ST s terms and conditions of sale. Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein. UNLESS OTHERWISE SET FORTH IN ST S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN: (A) SAFETY CRITICAL APPLICATIONS SUCH AS LIFE SUPPORTING, ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS; (B) AERONAUTIC APPLICATIONS; (C) AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS, AND/OR (D) AEROSPACE APPLICATIONS OR ENVIRONMENTS. WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE, THE PURCHASER SHALL USE PRODUCTS AT PURCHASER S SOLE RISK, EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE, UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR AUTOMOTIVE, AUTOMOTIVE SAFETY OR MEDICAL INDUSTRY DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS. PRODUCTS FORMALLY ESCC, QML OR JAN QUALIFIED ARE DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY. Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST. ST and the ST logo are trademarks or registered trademarks of ST in various countries. Information in this document supersedes and replaces all information previously supplied. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners. 2013 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan - Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com 18/18 DocId 11791