AN4646 Application note



Similar documents
AN3332 Application note

AN2604 Application note

STM32 F-2 series High-performance Cortex-M3 MCUs

AN3252 Application note

AN3998 Application note

AN4571 Application note

Hello, and welcome to this presentation of the STM32L4 reset and clock controller.

32F072BDISCOVERY. Discovery kit for STM32F072xx microcontrollers. Features. Description

AN3265 Application note

AN2680 Application note

Single LNB supply and control IC DiSEqC 1.X compliant with EXTM based on the LNBH29 in a QFN16 (4x4) Description

AN2389 Application note

ES_LPC4357/53/37/33. Errata sheet LPC4357/53/37/33. Document information

AN3354 Application note

STM32F4DISCOVERY. Discovery kit with STM32F407VG MCU. Features. Description

DAC Digital To Analog Converter

Atmel Norway XMEGA Introduction

AN4195 Application note

Software Real Time Clock Implementation on MC9S08LG32

AN3997 Application note

DSL03. Low capacitance TVS for high speed lines such as xdsl. Description. Features. Complies with the following standards

AN2824 Application note

PAC52XX Clock Control Firmware Design

Single Phase Two-Channel Interleaved PFC Operating in CrM

STLQ ma, ultra low quiescent current linear voltage regulator. Description. Features. Application

Description. Table 1. Device summary. Order code Temperature range Package Packaging Marking

USER GUIDE EDBG. Description

AVR1321: Using the Atmel AVR XMEGA 32-bit Real Time Counter and Battery Backup System. 8-bit Microcontrollers. Application Note.

AN LPC1700 timer triggered memory to GPIO data transfer. Document information. LPC1700, GPIO, DMA, Timer0, Sleep Mode

APPLICATION NOTE. Atmel AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Atmel AVR 8-bit Microcontroller. Introduction.

TS555. Low-power single CMOS timer. Description. Features. The TS555 is a single CMOS timer with very low consumption:

STM32F411xC STM32F411xE

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

AN4296 Application note

How To Use A Watt Saver On A Microcontroller (Watt Saver) On A Cell Phone Or Mp3 Player

AN3155 Application note

UM1676 User manual. Getting started with.net Micro Framework on the STM32F429 Discovery kit. Introduction

32F769IDISCOVERY. Discovery kit with STM32F769NI MCU. Features

Chapter 13. PIC Family Microcontroller

STEVAL-IEG001V2. Smart real-time vehicle tracking system. Features

ARM Cortex STM series

AN3371 Application note

AN2658 Application note

STM32L. Ultra-low-power Cortex -M3 devices

STPS5L60. Power Schottky rectifier. Description. Features

UM1680 User manual. Getting started with STM32F429 Discovery software development tools. Introduction

AN3990 Application note

LM337. Three-terminal adjustable negative voltage regulators. Features. Description

STM32F103x8 STM32F103xB

AN4368 Application note

UM1613 User manual. 16-pin smartcard interface ST8034P demonstration board. Introduction

AN4156 Application note

AN3270 Application note

AVR131: Using the AVR s High-speed PWM. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

EVAL6491HB. Demonstration board for L6491 gate driver with smartsd. Description. Features

AVR1301: Using the XMEGA DAC. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Description. Table 1. Device summary

AVR319: Using the USI module for SPI communication. 8-bit Microcontrollers. Application Note. Features. Introduction

VADC Versatile Analog to Digital Converter. XMC Microcontrollers August 2014

SPC5-CRYP-LIB. SPC5 Software Cryptography Library. Description. Features. SHA-512 Random engine based on DRBG-AES-128

Solar Energy Conversion using MIAC. by Tharowat Mohamed Ali, May 2011

Description. IO and RF AGC. ASIC controller and power management. Carrier recovery loop. GPIO switch matrix. Lock indicator and monitoring DVBS2 FEC

Description SO-8. Table 1. Device summary. Order codes. SO-8 (tape and reel) TO-92 (Bag) TO-92 (Ammopack) TO-92 (tape and reel)

APPLICATION NOTE Atmel AT02509: In House Unit with Bluetooth Low Energy Module Hardware User Guide 8-bit Atmel Microcontroller Features Description

M24LRxx/CR95HF application software installation guide

STDP2690. Advanced DisplayPort to DisplayPort (dual mode) converter. Features. Applications

UM1969 User manual. Getting started with STM32F746G discovery software development tools. Introduction

AVR125: ADC of tinyavr in Single Ended Mode. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Tutorial for MPLAB Starter Kit for PIC18F

DDSL01. Secondary protection for DSL lines. Features. Description

AN LPC1700 RTC hardware auto calibration. Document information. RTC, Hardware Auto Calibration, LPC1700, Graphic LCD

SPC5-FLASHER. Flash management tool for SPC56xx family. Description. Features

STIEC45-xxAS, STIEC45-xxACS

AN2557 Application note

DevKit1207 Evaluation Kit

STSW-IDW002. Hands-On Training for SPWF01SC and SPWF01SA Wi-Fi modules. Features. Description

Lab Experiment 1: The LPC 2148 Education Board

AND8336. Design Examples of On Board Dual Supply Voltage Logic Translators. Prepared by: Jim Lepkowski ON Semiconductor.

SMARTCARD XPRO. Preface. SMART ARM-based Microcontrollers USER GUIDE

UM1724 User manual. STM32 Nucleo boards. Introduction

AVR32788: AVR 32 How to use the SSC in I2S mode. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

Flexible Active Shutter Control Interface using the MC1323x

AN3327 Application note

AVR127: Understanding ADC Parameters. Introduction. Features. Atmel 8-bit and 32-bit Microcontrollers APPLICATION NOTE

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

Selecting the Right MCU Can Squeeze Nanoamps out of Your Next Internet of Things Application

Freescale Semiconductor, Inc. Product Brief Integrated Portable System Processor DragonBall ΤΜ

AN3110 Application note

EVL185W-LEDTV. 185 W power supply with PFC and standby supply for LED TV based on the L6564, L6599A and Viper27L. Features.

STM32L151x6/8/B STM32L152x6/8/B

50 ohm nominal input / conjugate match balun to nrf CEAA/CDAB/CFAC and nrf51422-ceaa/cdab/cfac. Benefits. Description

Application Note. 8-bit Microcontrollers. AVR270: USB Mouse Demonstration

Single Phase Two-Channel Interleaved PFC Operating in CrM Using the MC56F82xxx Family of Digital Signal Controllers

AVR134: Real Time Clock (RTC) using the Asynchronous Timer. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

76-77 GHz RF Transmitter Front-end for W-band Radar Applications

TN0023 Technical note

AN974 APPLICATION NOTE

Transcription:

Application note Peripheral interconnections on STM32F401 and STM32F411 lines Introduction On top of the highest performance and the lowest power consumption of the STM32F4 family, STM32F401/411 peripherals can communicate autonomously, without any intervention from the CPU, via a network known as peripheral interconnect matrix. This STM32F401/411 feature enhances CPU real-time performance while substantially reducing its energy consumption. The present document first describes the peripheral interconnect matrix features and then provides an overview on the peripheral interconnections and on how to configure them depending on your application. This description is completed by a detailed application example. This application note must be read in conjunction with STM32F401 line reference manual (RM0383) and STM32F411 line reference manual (RM0368). Both documents are available from http://www.st.com/stm32. Table 1. Applicable products Type Microcontrollers Product lines STM32F401 STM32F411 March 2015 DocID027369 Rev 1 1/17 www.st.com 1

Contents AN4646 Contents 1 Module overview........................................... 5 2 Peripheral interconnect matrix................................ 7 2.1 Timers block............................................... 8 2.1.1 From TIM to TIM........................................... 8 2.1.2 From TIM to ADC........................................... 9 2.1.3 From TIM to DMA.......................................... 9 2.2 Analog block.............................................. 10 2.2.1 From temperature sensor to ADC1............................ 10 2.2.2 From Analog block to DMA.................................. 10 2.3 Clocks block............................................... 10 2.3.1 From CSS to TIM.......................................... 10 2.3.2 From LSE, LSI, RTC to TIM.................................. 10 2.4 System block...............................................11 2.4.1 From VBAT, VREFINT to ADC................................ 11 2.4.2 From EXTI to analog block.................................. 11 2.5 Communication interfaces.....................................11 2.5.1 From USB block to TIM..................................... 11 2.5.2 From Communication interfaces to DMA........................ 12 2.6 DMA block................................................ 12 3 Application example........................................ 13 3.1 Hardware description........................................ 13 3.2 Software description......................................... 13 4 Conclusion................................................ 15 5 Revision history........................................... 16 2/17 DocID027369 Rev 1

List of tables List of tables Table 1. Applicable products....................................................... 1 Table 2. STM32F401/411 peripheral interconnect matrix.................................. 7 Table 3. Peripheral interconnect configuration detail.................................... 14 Table 4. Document revision history................................................. 16 DocID027369 Rev 1 3/17 3

List of figures AN4646 List of figures Figure 1. STM32F401/411 peripheral interconnection overview............................. 6 Figure 2. Master/Slave timer overview................................................. 9 Figure 3. Master TIM/Slave ADC overview............................................. 9 Figure 4. SOF connectivity......................................................... 11 Figure 5. Application overview...................................................... 13 4/17 DocID027369 Rev 1

Module overview 1 Module overview Several peripherals can be directly interconnected and configured to send/respond to event signals that can be internally routed to/from other peripherals in the device. The STM32F401/411 autonomous peripherals include: Timers that can either be internally connected to each other or connected to the DMA or to the analog block. Analog block that can receive events from a timer or send events to the DMA. Clocks block that can send events to timers. System block that can send events to the analog block. Communication interfaces that can send events to the timers or to the DMA. An overview of STM32F401/411 peripheral interconnections is given in Figure 1: STM32F401/411 peripheral interconnection overview. DocID027369 Rev 1 5/17 16

6/17 DocID027369 Rev 1 Figure 1. STM32F401/411 peripheral interconnection overview Module overview AN4646

Peripheral interconnect matrix 2 Peripheral interconnect matrix STM32F401/411 peripherals are interconnected through the peripheral interconnect matrix that allows to directly connect one peripheral to another without waking up the CPU. These interconnections can operate in Run, Sleep or Stop modes, depending on peripherals. Peripherals that respond to events are referred to as users while peripherals that send events are referred to as generators. Table 2. STM32F401/411 peripheral interconnect matrix (1) Users Generators Timers DMA Analog TIM 1 TIM 2 TIM 3 TIM 4 TIM 5 TIM 11 DMA1 DMA2 ADC1 TIM1 - X X X - - - X X TIM2 X - X X X - X - X Timers TIM3 X X - X X - X - X TIM4 X X X - X - X - X TIM5 X - X - - - X - X Analog ADC1 - - - - - - - X - VSENSE - - - - - - - - X LSI - - - - X - - - - Clocks LSE - - - - X - - - - RTC - - - - X X - - - CSS X - - - - - - - - DocID027369 Rev 1 7/17 16

Peripheral interconnect matrix AN4646 Table 2. STM32F401/411 peripheral interconnect matrix (1) (continued) Users Generators Timers DMA Analog TIM 1 TIM 2 TIM 3 TIM 4 TIM 5 TIM 11 DMA1 DMA2 ADC1 OTG FS - X - - - - - - - SPI1/I2S1 - - - - - - - X - SPI2/I2S2 - - - - - - X - - SPI3/I2S3 - - - - - - X - - SPI4/I2S4 - - - - - - - X - Communication interfaces SPI5/I2S5 - - - - - - - X - I2C1 - - - - - - X - - I2C2 - - - - - - X - - I2C3 - - - - - - X - - USART1 - - - - - - - X - USART2 - - - - - - X - - USART6 - - - - - - - X - SDIO - - - - - - - X - VBAT - - - - - - - - X System VREFINT - - - - - - - - X EXTI - - - - - - - - X 1. In gray, the peripherals that are available only on STM32F411 line. 2.1 Timers block 2.1.1 From TIM to TIM Some timers are linked together internally for timer synchronization or chaining. When one timer (TIMx) is configured in Master mode, it can reset, start, stop or clock the counter of any other timer configured in Slave mode (TIMy). The master output is TIMx_TRGO signal. This output is configured as a timer event through TIMx_CR2 register. It is sent to TIMy_ITR0/ITR1/ITR2/ITR3 inputs. Figure 2: Master/Slave timer overview gives an overview of the trigger selection and the master mode selection blocks. 8/17 DocID027369 Rev 1

Peripheral interconnect matrix Figure 2. Master/Slave timer overview A description of this feature is provided in the Timer synchronization section on RM0368 and RM0383 reference manuals, while all the possible master/slave connections are described in the TIMx internal trigger connection tables. 2.1.2 From TIM to ADC Some timers can be used to generate an ADC trigger event. The timer output can be either TIMx_TRGO signal or TIMx_CHx event. It is input to ADC EXTSEL[3:0] and JEXTSEL [3:0] signals. Figure 3: Master TIM/Slave ADC overview gives an overview of the trigger selection and master mode selection blocks. Figure 3. Master TIM/Slave ADC overview ADC synchronization is described in the Conversion on external trigger and trigger polarity section of RM0368 and RM0383 reference manuals. The connection between timers and ADCs regular and injected channels is described in External trigger for regular channels and External trigger for injected channels tables. 2.1.3 From TIM to DMA Refer to Section 2.6: DMA block. DocID027369 Rev 1 9/17 16

Peripheral interconnect matrix AN4646 2.2 Analog block The analog block includes: the ADC block (ADC1) the temperature sensor block. 2.2.1 From temperature sensor to ADC1 On STM32F401/411 devices, the temperature sensor is internally connected to ADC1_IN18 input channel. It is used to convert the sensor output voltage into a digital value. The Temperature sensor reference manual section describes the connection between sensor and ADC as well as the procedure to read the converted value. 2.2.2 From Analog block to DMA Refer to Section 2.6: DMA block. 2.3 Clocks block The clock block includes: the LSE clock the LSI clock the clock security system (CSS) the real-time clock (RTC) 2.3.1 From CSS to TIM The CSS can generate system errors. In this case a clock failure event is sent to TIM1 break inputs. The purpose of the break function is to protect the power switches driven by PWM signals generated by the timer. The list of possible break sources is given in the Using the break function (TIM1) reference manual section. 2.3.2 From LSE, LSI, RTC to TIM External clock (LSE), internal clock (LSI) and RTC wakeup interrupt can be input to generalpurpose timer (TIM5 channel 4/TIM11 channel 1). This feature is described in the following sections of RM0368 and RM0383 reference manuals: Internal/external clock measurement using TIM5/TIM11 TIM5 option register (TIM5_OR) TIM11 option register 1 (TIM11_OR). 10/17 DocID027369 Rev 1

Peripheral interconnect matrix 2.4 System block The system blocks include: Internal reference voltage (V REFINT ) V BAT supply voltage External interrupt/event controller (EXTI). 2.4.1 From VBAT, VREFINT to ADC The V BAT channel is connected to ADC1_IN18 channel. It can be converted either as an injected or as a regular channel. V REFINT is connected to ADC1_IN17. Refer to the following reference manual sections for a description of the interconnection between V BAT, V REFINT and ADC: Channel selection Battery charge monitoring. 2.4.2 From EXTI to analog block An external interrupt/event (EXTI) can be used to generate an ADC trigger event or to start DAC conversion. ADC synchronization is described in the Conversion on external trigger and trigger polarity section of the reference manuals. 2.5 Communication interfaces 2.5.1 From USB block to TIM The USB OTG_FS SOF pulse signal can trigger TIM2 general-purpose timer. Figure 4. SOF connectivity DocID027369 Rev 1 11/17 16

Peripheral interconnect matrix AN4646 The interconnection between USB and TIM2 is described in the SOF trigger section of RM0368 and RM0383 reference manuals. 2.5.2 From Communication interfaces to DMA Refer to Section 2.6: DMA block. 2.6 DMA block Each stream is associated with a DMA request that can be selected out of 8 possible channel requests. This selection is controlled by the CHSEL [2:0] bits of the DMA_SxCR register. The 8 requests from the peripherals (TIM, ADC, SPI, I2C, etc.) are independently connected to each channel and their connection depends on the product implementation. This interconnection is explained in the following tables of RM0368 and RM0383 reference manuals: DMA1 request mapping DMA2 request mapping. 12/17 DocID027369 Rev 1

Application example 3 Application example This application example demonstrate how to use the peripheral interconnect matrix on STM32F401/411 lines and shows how to synchronize TIM peripherals in parallel mode. This firmware is based on STM32F4xx HAL drivers which is part of STM32CubeF4. 3.1 Hardware description Three timers are used in this example: TIM1 is configured as master timer: PWM mode is enabled TIM2 update event is used as trigger output. TIM2 and TIM3 are slaves for TIM1 PWM mode is enabled ITR0(TIM1) is used as trigger input for both slave timers. Figure 5. Application overview 1. The generator (TIM1) is shown in yellow, while the user blocks (TIM2 and TIM3) are highlighted in gray. 3.2 Software description TIM1 counter clock is 84 MHz. TIM1 master timer is running at TIM1 frequency: TIM1 frequency = TIM1 counter clock/ (TIM1 period + 1) = 328.125 KHz The duty cycle is equal to TIM2_CCR1/ (TIM2_ARR + 1) = 25%. DocID027369 Rev 1 13/17 16

Application example AN4646 TIM2 slave timer is running at: (TIM1 frequency)/ (TIM2 period + 1) = 32.815 KHz The duty cycle is equal to TIM2_CCR1/ (TIM2_ARR + 1) = 30% TIM3 slave timer is running at: (TIM1 frequency)/ (TIM3 period + 1) = 65.630 KHz The duty cycle is equal to: TIM3_CCR1/ (TIM3_ARR + 1) = 60% Table 3: Peripheral interconnect configuration detail gives code examples to configure TIM1, TIM2 and TIM3 as described above. Table 3. Peripheral interconnect configuration detail Interconnect Example Comments TIM1 master timer TIM2 slave timer TIM3 slave timer smasterconfig.masteroutputtrigger = TIM_TRGO_UPDATE smasterconfig.masterslavemode = TIM_MASTERSLAVEMODE_ENABLE; HAL_TIMEx_MasterConfigSynchronization(&htim1, &smasterconfig); sslaveconfig.slavemode = TIM_SLAVEMODE_GATED; sslaveconfig.inputtrigger = TIM_TS_ITR0; HAL_TIM_SlaveConfigSynchronization(&htim2, &sslaveconfig); smasterconfig.masteroutputtrigger = TIM_TRGO_RESET; smasterconfig.masterslavemode=tim_masterslavemode_dis ABLE; HAL_TIMEx_MasterConfigSynchronization(&htim2, &smasterconfig); sslaveconfig.slavemode = TIM_SLAVEMODE_GATED; sslaveconfig.inputtrigger = TIM_TS_ITR0; HAL_TIM_SlaveConfigSynchronization(&htim3, &sslaveconfig); smasterconfig.masteroutputtrigger = TIM_TRGO_RESET; smasterconfig.masterslavemode=tim_masterslavemode_dis ABLE; HAL_TIMEx_MasterConfigSynchronization(&htim2, &smasterconfig); Configures TIM2 Update event as Trigger Output Configures ITR0 as trigger input for both slaves. Enables the Gated mode so that the start/stop of slave counters is controlled by the master trigger output signal (update event). 14/17 DocID027369 Rev 1

Conclusion 4 Conclusion This application note complements STM32F401/411 datasheets and reference manuals by introducing the Peripheral interconnect matrix. It also gives a detailed description of a basic example that can be a used as a starting point to develop your own application. DocID027369 Rev 1 15/17 16

Revision history AN4646 5 Revision history Table 4. Document revision history Date Revision Changes 19-Mar-2015 1 Initial release. 16/17 DocID027369 Rev 1

IMPORTANT NOTICE PLEASE READ CAREFULLY STMicroelectronics NV and its subsidiaries ( ST ) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST s terms and conditions of sale in place at the time of order acknowledgement. Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of Purchasers products. No license, express or implied, to any intellectual property right is granted by ST herein. Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product. ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners. Information in this document supersedes and replaces information previously supplied in any prior versions of this document. 2015 STMicroelectronics All rights reserved DocID027369 Rev 1 17/17 17