• Aucun résultat trouvé

November29,2017 bosio@lirmm.fr AlbertoBosio STM32:Peripherals

N/A
N/A
Protected

Academic year: 2022

Partager "November29,2017 bosio@lirmm.fr AlbertoBosio STM32:Peripherals"

Copied!
32
0
0

Texte intégral

(1)

STM32: Peripherals

Alberto Bosio bosio@lirmm.fr

Univeristé de Montpellier

November 29, 2017

(2)

System Architecture

(3)

System Architecture

S0: I-bus: This bus connects the Instruction bus of the Cortex-M4 core to the BusMatrix. This bus is used by the core to fetch instructions. The targets of this bus are the internal Flash memory, the SRAM and the CCM RAM.

S1: D-bus: This bus connects the DCode bus (literal load and debug access) of the Cortex-M4 core to the BusMatrix.

The targets of this bus are the internal Flash memory, the SRAM and the CCM RAM.

S2: S-bus: This bus connects the system bus of the

Cortex-M4 core to the BusMatrix. This bus is used to access data located in the peripheral or SRAM area. The targets of this bus are the SRAM, the AHB to APB1/APB2 bridges, the AHB IO port and the ADC.

S3, S4: DMA-bus: This bus connects the AHB master interface of the DMA to the BusMatrix which manages the

(4)

Memory map

Peripherals are memory mapped

(5)

Memory map

(6)

Memory map

(7)

Memory map

(8)

Memory map

(9)

Reset and clock control (RCC)

System clock (SYSCLK) selection:

I HSI clock: generated from an internal 8 MHz RC Oscillator RCC registers allow to enable the use of a particular peripheral

I When the peripheral clock is not active, the peripheral register values may not be readable by software and the returned value is always 0x0.

RCC_AHBENR, RCC_APB1RSTR, RCC_APB2RSTR

(10)

Example: Using on board LEDs

On which bus LEDs are connected?

(11)

Example: Using on board LEDs

On which bus LEDs are connected? Read DATA SHEET!

(12)

Example: Using on board LEDs

(13)

Example: Using on board LEDs

(14)

Example: Using on board LEDs

We have to use GPIOE connected to bus AHB

Let us configure the correct RCC register: RCC_AHBENR

I How to write? (address)

I Which value?

(15)

Example: Using on board LEDs

(16)

Example: Using on board LEDs

We have to write ‘1’ on the bit 21 Address: base + offset

I base = 0x40021000

I offset = 0x14

I address = 0x40021014

(17)

Example: Using on board LEDs

Can you write the assembler code?

(18)

Example: Using on board LEDs

Next steps are:

I Configure the GPIOE in output mode

I Write a value in order to switch on/off LEDs

(19)

Example: Using on board LEDs

Configure the GPIOE in output mode:

I GPIO port mode register (GPIOx_MODER)

Which value do you have to write? Which address?

(20)

Example: Using on board LEDs

Write a value in order to switch on/off LEDs:

Which value do you have to write? Which address?

(21)

Interrupts

Nested vectored interrupt controller (NVIC)

I 74 maskable interrupt channels

I 16 programmable priority levels (4 bits of interrupt priority are used)

I Low-latency exception and interrupt handling

I Power management control

I Implementation of System Control Registers

(22)

Configuring Interrupts

To configure a line as interrupt source, use the following procedure:

I Configure the corresponding mask bit in the EXTI_IMR register.

I Configure the Trigger Selection bits of the Interrupt line (EXTI_RTSR and EXTI_FTSR).

I Set the Interrupt Service Routine.

I Clear the pending request.

(23)

External and internal interrupt/event line mapping

36 interrupt/event lines are available: 8 lines are internal (including the reserved ones); the remaining 28 lines are external.

The GPIOs are connected to the 16 external interrupt/event lines in the following manner:

(24)

External and internal interrupt/event line mapping

(25)

External and internal interrupt/event line mapping

(26)

Configuring Interrupts

Configure the corresponding mask bit in the EXTI_IMR register:

(27)

Configuring Interrupts

Configure the Trigger Selection bits of the Interrupt line (EXTI_RTSR)

(28)

Configuring Interrupts

Configure the Trigger Selection bits of the Interrupt line (EXTI_FTSR)

(29)

Configuring Interrupts

Set the Interrupt Service Routine (Vector Table)

(30)

Configuring Interrupts

(31)

Configuring Interrupts

(32)

Configuring Interrupts

Clear the pending request.

Références

Documents relatifs

I am confident you are all aware that the global achievements in polio eradication are the fruitful outcome of strong national and international political will, true

Additionally, we show our design and build process for a testbed to rapidly prototype SETG components and subsystems, which has successfully automated nucleic

The following code releases IRQ number 9 from any as- signed internal logical device by going through all logical de- vices, one by one, and writing the value of 0h to bits 3 - 0 of

When Interrupt Control D is interacting with Floating Tape Loader-Monitor C and control- ling the execution of a foreground and background program, location 267

The interrupt option provides each of the input channels with I/O data and service interrupt control which enables the external device to interrupt the computer

Since the receiver blindly groups data bits into characters, there must be a means of synchronizing the receiver to the transmitter so that the proper

REAL TIME CLOCK/INTERRUPT CONTROLLER CHAPTER 3: ASSEMBLY Figure 3.2.3 shows an input line and the four interrupt conditions.. The six pins should be connected to

The 16 Regional trigger decisions are finally gathered by one unique board, the Global board, which communicates the dimuon trigger decision to the ALICE Central Trigger