Professional Documents
Culture Documents
Peripheral Overview
Agenda
Stellaris LM4F General Specifications Features of ARM Cortex-M4F Other System Features
Low Power Features Watchdog Timers
Analog
LDO Voltage Regulator 3 Analog Comparators 2 x 12-bit ADC Up to 24 channel 1 MSPS Temp Sensor
Connectivity features:
CAN, USB H/D/OTG, SPI, I2C, UARTs
Serial Interfaces
8 UARTs 4 SSI/SPI USB Full Speed Host / Device / OTG 2 CAN 6 I2 C
Motion Control
2 Quadrature Encoder Inputs 16 PWM Outputs
Timer Comparators
System
Clocks, Reset System Control Systick Timer 12 Timer/PWM/CCP
6 each 32-bit or 2x16-bit 6 each 64-bit or 2x32-bit
2 Watchdog Timers
PWM Generator PWM Generator
Solid roadmap
Higher speeds Larger memory Ultra-low power
Dead-Band Generator
Battery-Backed Hibernate
Internal Memory
256 KB single-cycle Flash memory up to 40 MHz; a prefetch buffer improves performance above 40 MHz 32 KB single-cycle SRAM with bit-banding Internal ROM loaded with StellarisWare software:
Stellaris Peripheral Driver Library Stellaris Boot Loader Advanced Encryption Standard (AES) cryptography tables Cyclic Redundancy Check (CRC) error detection functionality
2KB EEPROM
Stellaris architecture
JTAG/SWD ARM Cortextm-M4F (80 MHz) FPU DCode bus NVIC MPU ROM System Control and Clocks (W/ Precls. Osc.) Flash (256 KB)
LM4F232H5QD
DMA Advanced High-Performance Bus (AHB) EEPROM (2K) GPIOs (105) USB OTG (FS PHY) Ssi (4)
Watchdog Timers (2) Hibernation Module Advanced Peripheral Bus (APB) General- Purpose Timers (12) UART (8) I2C (6) CAN Controllers (2) ADC Channels (24) ANALOG PERIPHERALS SERIAL PERIPHERALS SYSTEM PERIPHERALS
QEI (2)
Interrupt on transfer completion, with a separate interrupt per channel Main processer is always given priority for bus access Multiple transfer modes:
Basic Auto Ping-pong, for continuous data flow to/from peripherals Scatter-gather, from a programmable list of arbitrary transfers initiated from a single request
DMA Request
Basic Transfers move data from one location to another as long as the request remains active, and there is still data to transfer. This works well for peripherals which normally keep their requests active for the duration of the transfer. Auto Transfers work similarly, but finish the transfer, even if the request is removed. This is typically used for software requests, so the request does not have to remain active for the entire duration.
9
2
Buffers A B C D
Primary Ctrl Struct A Periph
Buffers A B C D Complete
Periph
Periph
Primary control struct performs its transfer while alternate struct is idle (or being loaded with the next transfer).
Primary control struct sends an interrupt to the processor to declare its transfer complete.
3
Primary Ctrl Struct C Periph
4
Buffers A B C D
Primary Ctrl Struct C Periph
Buffers A B C D Complete
Periph
Periph
Alternate control struct performs its transfer, while primary control struct is loaded with the next transfer.
Alternate control struct sends an interrupt to the processor to declare its transfer complete, and the cycle starts over from step 1.
10
Scatter-Gather
S/G Struct Source: A Destination: F 1 Primary Ctrl Struct Source: S/G Dest: Ctrl Struct 2 Control: S/G
B
1 2 Source: B Destination: F 3 Source: C Destination: F Source: D Destination: F Source: E Destination: F 4 Alternate Ctrl Struct Source: Destination: Control: S/G
F
4 3
C
5
E
The primary control structure performs DMA transfers to put DMA tasks from the task list into the Alternate control structure in sequence. The alternate control structure then performs each DMA task one by one. This allows many transfers to happen together, even if the relevant memory is not contiguous.
11
12
Deep Sleep Turns off the system clock, PLL, and flash memory Enables a Wake-up Interrupt Controller (WIC), which will bring the processor out of deep sleep if an interrupt is received
13
Hibernation Module
The Hibernation module manages removal and restoration of power as a means for reducing power consumption. It can completely remove power from all parts of the chip except itself. Includes a 32-bit real-time seconds counter with 1/32,768 second resolution for timed wake up Dedicated pin for an external wakeup trigger GPIO pin state may be retained, and 16 32-bit words of non volatile memory may store the system state during hibernation Programmable interrupts for RTC match, external wake, and low battery events Runs on a separate clock and power source
14
Normal Operation
Peripherals
Processor WIC
Hibernation Module
Processor and peripherals are powered; sleep, deep sleep, and hibernate-related features are turned off.
15
Sleep Mode
Peripherals
Processor WIC
Hibernation Module
The processor enters a low-power state, and stops executing instructions until a sufficiently important interrupt is received.
16
Peripherals
Processor WIC
Hibernation Module
Processor enters a very low-power state, and some features (such as Systick) are shut off completely. The Wakeup Interrupt Controller (WIC) intercepts important interrupts, and wakes the processor if necessary.
17
Hibernate
Peripherals
Processor WIC
Hibernation Module
Power to the majority of the chip, including the processor and all peripherals, is shut off. The Hibernation module continues to operate using its own power source and clock until the wakeup condition is met.
18
Watchdog Timers
Two 32-bit countdown timers, capable of generating maskable or nonmaskable interrupts on roll-over. One Watchdog timer is clocked by the system clock. The other runs from the PIOSC Configuration may be locked to prevent inadvertent changes to the watchdog settings. User-enabled stalling for software debugging. May be used to generate a system reset when the processor fails to clear the interrupt Possible uses:
Recovering from software errors Recover from external devices failing or not behaving as expected. Reset and continue operation if the main crystal is damaged or removed.
19
20
Run Mode
IDD_RUN= 32mA
This mode provides normal operation of the processor and currently enabled peripherals (i.e. the ones that are enabled in RCGC registers). The microcontroller actively executes code with maximum performance. The system clock can be any of the available clock sources including the PLL.
21
Sleep Mode
IDD_SLEEP= 10mA
Sleep mode is used to lower the overall power consumption by turning off the clock to the processor and memory (Flash & SRAM). The active peripherals (i.e. the ones that are enabled in SCGC/ RCGC registers) are clocked at the same frequency as the system clock. The system clock has the same clock source & frequency as that during run mode. Application: This mode is used in applications where processor neednt be running code, but peripherals are still required to function at system clock speed.
SLEEP MODE
Processor executes a Wait for Interrupt (WFI), or Wait for Event (WFE) or Sleepon-Exit (upon completing execution of exception handler if SLEEPEXIT bit in SYSCTRL register is set)
Processor (NVIC) detects an interrupt, or depending upon the mechanism that caused it to enter the sleep mode i.e. WFI/WFE/Sleep-on-Exit.
Application: This mode is used in applications where processor neednt be running code, and peripherals are required to function at a speed lower than run-mode system speed.
1.25 to 350 s
If SLEEPDEEP bit in SYSCTRL & processor executes a Wait for Interrupt (WFI)/ Wait for Event (WFE) or Sleep-on-Exit (upon completing execution of exception handler if SLEEPEXIT bit in SYSCTRL register is set)
Wake-Up Interrupt Controller (WIC) wakes up the processor upon detecting an interrupt if DEEPSLEEP bit SCR register is set.
Entering into Deep Sleep Mode and waking up from Deep Sleep Mode
23
Hibernation Mode
IHIB= 1.6 A
Hibernation mode provides the lowest power configuration available on Stellaris microcontrollers. This mode allows users to completely power down the core and peripherals while only maintaining power to the Hibernation module. Hibernation module is a dedicated hardware that: Allows managing removal and restoration of power to the processor. Can be independently powered by an external battery or an aux. power supply. Allows power to be restored upon assertion of an external signal, or at a certain time (using RTC). Application: Used in battery-powered/ hand-held applications where the system can be put into a lowest-power state while saving some state information.
24
Deep Sleep Hibernate Hibernate Hibernate Mode (VDD3ON) (RTC) (no RTC)
TBD
5 A
1.7 A
1.6 A
3.3 V
3.3 V
3.3 V
3.3 V
0V
0V
N.A.
N.A.
N.A. 30 kHz
3V Off Off
3V Off Off
3V Off Off
Not Clocked Not Clocked Not Clocked Not Clocked Not Clocked All Off N.A. All Off N.A. All Off N.A. All Off N.A. All Off N.A.
Current Consumption in Different Power Modes
25
TBD
Code
26
External input that brings the processor out of hibernation mode Power source for Hibernation module, can be an external power supply or a battery
When the device is in hibernation mode, HIB signal is asserted. The device wakes-up from hibernation in following cases:
When WAKE pin is asserted, or When RTC match occurs, or When low battery is detected.
Upon wake up, HIB signal is de-asserted and an internal POR signal is issued. tWAKE_TO_HIB
HIBERNATION
tLDO_RAMP
TTPOR
~500 s
HIBREQ=1, or VDD removal RTC match/ WAKE assertion/ HIB signal is de-asserted Low battery detection
Entering into hibernation and waking up from hibernation
28
Power Control
Dynamic power source determination
Supply voltage of Hibernation module is the higher of VDD or VBAT.
32.768 kHz
32.768 kHz
GNDX
GNDX
32.768 kHz
NC
Battery Management
Low Battery Detection
Optionally, hibernation can be prevented during low battery condition i.e. the module can be configured so that it does not go into hibernation mode if the battery voltage drops below this threshold. The module can monitor the voltage level of the external battery and detect when the voltage drops below VLOWBAT (1.9V, 2.1V, 2.3V or 2.5V). VLOWBAT threshold is configured using VBATSEL bit in HIBCTL register. Battery voltage is monitored while in hibernation, and the microcontroller can also be configured to wake from hibernation if the battery voltage goes below the threshold using the BATWKEN bit in the HIBCTL register.
The Hibernation module draws power from whichever source, VBAT or VDD, has the higher voltage.
31
32
Concatenated
8-bit Prescaler
16-bit Timer
32-bit Timer
32-bit Timer
16-bit Prescaler
32-bit Timer
16-bit Prescaler
64-bit Timer
64-bit Timer
Count up only After reset, the counter is loaded with a value of 0x1 Input clock is required to be 32.768 KHz & it is then divided down to a 1-Hz When count value matches the preloaded value, GPTM asserts and continues counting until either a hardware reset, or it is disabled by software. When the timer value reaches the terminal count, the timer rolls over and continues counting up from 0x0.
34
Optional Prescaler
The maximum input frequency is of the system frequency The timer is configured as a 24-bit or 48-bit up- or down-counting including the optional prescaler with upper count value Counting down: start value is initialized Counting up : start value is 0x0 Capable of capturing three types of events
Rising edge Falling edge Both
Input Signal
After the match value is reached in down-count mode, the counter is then reloaded using the start value, and stopped
36
Optional Prescaler
The maximum input frequency is of the system frequency The timer is configured as a 24-bit or 48-bit up- or down-counting including the optional prescaler with upper count value Counting down: start value is initialized Counting up : start value is 0x0 Capable of capturing three types of events
Rising edge Falling edge Both
Interrupts, ADC and/or a DMA trigger can be generated After the event has been captured, the timer doesnt stop counting
37
Y Time
Input Signal
Configured to capture rising edge events Each time a rising event is detected, the count value is loaded
38
PWM Mode
Timer Use Individual 16/32 bit GPTM Block 32/64 bit GPTM Block
24-bit Timer 48-bit Timer
The timer is configured as a 34-bit or 48-bit down-counter with a start value (and thus period) PWM frequency and period are synchronous events and therefore guaranteed to be glitch free Counting down until it reaches the 0x0 state Wait-for-Trigger mode On the next counter cycle in periodic mode, the counter reloads its start value Capable of generating interrupts based on
Rising edge Falling edge Both
39
Match value
0x0
Time
Output Signal
The output PWM signal asserts when the counter is at its start state The output PWM signal deasserts when the counter value equals the mach value Capability of inverting the output PWM signal
40
41
General Purpose IO
Programmable pad configuration through GPIO module Any GPIO can be an external interrupt source
GPIO banks P and Q can have individual interrupts for each pin (larger packages)
Toggle rate up to the CPU clock speed on the Advanced High-Performance Bus 5-V-tolerant input/outputs Programmable Drive Strength
2, 4, 8 mA or 8 mA with slew rate control, several pins have 18-mA drive strength
Programmable weak pull-up, pull-down, and open drain Digital input enables
42
43
Analog-to-Digital Converter
Stellaris LM4F MCUs feature 2 ADC modules (ADC0 and ADC1) that can be used to convert continuous analog voltages to discrete digital values Each ADC module has 12-bit resolution Each ADC module operates independently and can therefore:
Execute different sample sequences Sample any of the 24 analog input channels Generate different interrupts & triggers
t ADC VIN VOUT
24 Input Channels
VOUT
ADC0
Interrupts/ Triggers
Triggers
ADC1
Interrupts/ Triggers
Hardware averaging of up to 64 samples for improved accuracy 8 Digital comparators/ per ADC Efficient transfers using DMA Optional phase shift in sample time, programmable from 22.5 to 337.5
ADC
Digital readings
The analog comparators may also be used as ADC trigger sources: Allows the user to monitor a sensor value after it passes some threshold voltage. Conversions will only be triggered when the voltage is inside the range of interest
46
47
Sample Sequencers
ADCs on Stellaris LM4F devices collect and sample data using a programmable sequence-based approach. Each sample sequence is a fully programmable series of consecutive (back-to-back) samples that allows the ADC module to collect data from multiple input sources without having to be re-configured. Each ADC module has 4 sample sequencers that control sampling and data capture. All sample sequencers are identical except for the number of samples they can capture and the depth of the FIFO. To configure a sample sequencer, the following information is required:
Input source Mode (single-ended, or differential) Interrupt generation on sample completion Indicator for the last sample in the sequence
Sequencer
Number of Samples
Depth of FIFO
DMA Operation: There is a dedicated DMA channel for each ADC sample sequencer. Each sample sequencer can transfer data independently.
SS 3 SS 2 SS 1 SS 0
1 4 4 8
ADC Sample Sequencers
1 4 4 8
48
ADC uses ADCVREFA+ and ADCVREFA- reference voltages to produce a conversion value. Internal/ external reference voltages for ADC can be selected using VREF bit in ADCCTL register. Resolution (in single-ended mode):
VDDA GNDA
ADCVREFA+
External
Conversion Result
0x000 ADCVREFA-
Range:
0xFFF
Differential Sampling
ADC also allows differential sampling of two analog input channels. Differential input pair can be configured in ADCSSMUXn register. Differential sampling can be enabled by setting Dn bit in ADCSSCTL0. Differential input pair n samples the voltage difference (VIN) between consecutive even and odd analog inputs channels.
Conversion Result
Resolution:
0xFFF
0x000 -VADCVREF
Skewed Sampling
ADC0 & ADC1 can be used out of phase of each other. The sampled data can be combined in the software. This effectively doubles the conversion bandwidth upto 2MSPS.
Analog Input
t ADC0 ADC1 S1 S1 S2 S2 S3 S3 S4 S4 S5 S5 S6 S6 S7 S7 S8
51
S8
Skewed Sampling
Up to 64 samples can be accumulated and averaged to form a single data entry in the sequencer FIFO. By default, hardware sample averaging circuit is off. All the data from the converter passes through the sequencer FIFO. Averaging is controlled by ADCSAC register. All channels are averaged equally irrespective of their configuration (single ended or differential). Example: if AVG value in ADCSAC register is0x02, then 4x averaging will be done. If IE bit in ADCSSCTL0 register is set, then an interrupt will be generated when FIFO gets second data entry. Tradeoff: Throughput is decreased proportionally to the number of samples in the averaging calculation.
A+B+C+D 4 A+B+C+D 4
INT
Internal temperature sensor module consists of: Band gap reference circuit that provides reference voltage to various analog peripherals.
2.7
1.633
147.5
Temperature ( C)
0x0
0x400
0x800
0xC00
0xFFF
53
Each ADC module contains 8 digital comparators. Operational Modes: Always Mode Once Mode Hysteresis Mode Hysteresis Always Mode Modes can be selected using CIM or CTM bit in ADCCTLn register. Functional Ranges: Low Band Mid Band High Band Functional Ranges can be selected using COMP0 and COMP1 bits in ADCDCCMPn register. Always, COMP1 COMP0.
COMP1
COMP0
Low Band
Mid Band
High Band
A digital comparator compares the ADC modules output with user programmable limits. Depending on the result of the comparison, a processor interrupt or a trigger to the PWM module can be generated.
VIN
t
Digital Comparator Functional Ranges
54
VINVIN+
1 VOUT 0 0
0 t
C0o
56
57
Standard (100 Kbps), Fast (400 Kbps), and High (3.4 Mbps) speeds supported Master and slave interrupts support
I2C master generates interrupts when a transmit or receive operation completes (or aborts). I2C slave generates interrupts when data has been sent or requested by a master.
59
61
USB-IF Compliance
TI is a member of the USB Implementers Forum. Complies with USB-IF certification standards TIs Stellaris VID available for sublicense (with assigned PIDs).
62
63
64
Two comparators
Comparator value updates can be synchronized Produces output signals on match
PWM generator
Output constructed based on actions taken as a result of the counter and comparator output signals Produces two independent PWM signals
65
66
Dead-band Generation
To PWM pins
The PWM module essentially consists of a timer, a configurable comparison module, and three stages of signal generation and conditioning logic.
67
.. ..
Count Down Mode
..
Asymmetrical Waveform
Match events produce signals, which can be used to drive positive or negative edges of a PWM. Each counter may generate up to two PWMs using different combinations of compare events.
68
CMPA CMPB
. . . . . . . .
Count Up and Down Mode
Symmetrical Waveform
69
Dead band
70
Fault-condition Interrupts
A fault condition is one in which the controller must be signaled to stop normal PWM function and then sets the outputs to a safe state.
71
Stellaris QEI features: Includes two quadrature encoder interface (QEI) modules Position integrator that tracks the encoder position Programmable noise filter on the inputs Velocity capture using built-in timer Interrupt generation on:
Index pulse Velocity-timer expiration Direction change Quadrature error detection
72
/4
Ch. A Ch. B
shaft rotation Incremental Optical Encoder Quadrature Output from Photo Sensors
73
increment counter
10
decrement counter
(A,B) =
00 Ch. A Ch. B
11
74