Académique Documents
Professionnel Documents
Culture Documents
NVIC_DMA_WFIMode
******************** (C) COPYRIGHT 2009 STMicroelectronics
*******************
* @file
NVIC/DMA_WFIMode/readme.txt
* @author MCD Application Team
* @version V3.1.0
* @date
06/19/2009
* @brief
Description of the NVIC DMA in WFI mode Example.
******************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING
CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS
ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
******************************************************************************
Example Description
This example shows how to enters the system to WFI mode with DMA transfer enabled and
wake-up from this mode by the DMA End of Transfer interrupt.
In the associated software, the system clock is set to 72 MHz, the DMA1 Channely is configured
to transfer 10 data from the EVAL COM1 USART data register to a predefined buffer,
DST_Buffer, and to generate an interrupt at the end of the transfer. The EVAL COM1 USART
receives data from Hyperterminal. A LED1 is toggled with a frequency depending on the system
clock, this is used to indicate whether the MCU is in WFI or RUN mode.
A falling edge on the selected EXTI Line will put the core in the WFI mode, causing the led pin
to stop toggling. To wake-up from WFI mode you have to send the sequence (0, 1, 2, 3, 4, 5, 6, 7,
8, 9) from the Hyperterminal to the EVAL COM1 USART. These bytes will be transferred by the
DMA from the EVAL COM1 receive data register to the predefined buffer, then generates an
interrupt which exits the system from WFI mode. The LED1 restarts toggling and a LED2 will
toggle if the buffer is correctly received else a LED3 is toggled.
Directory contents
STM3210C-EVAL Set-up
o
Use LED1, LED2, LED3 and LED4 connected respectively to PD.07, PD.13,
PF.03 and PD.04 pins
The USART2 signals (Rx, Tx) must be connected to a DB9 connector using a
RS232 transceiver.
Hyperterminal configuration:
No parity
STM3210E-EVAL Set-up
o
Use LED1, LED2, LED3 and LED4 leds connected respectively to PF.06, PF0.7,
PF.08 and PF.09 pins
The USART1 signals (Rx, Tx) must be connected to a DB9 connector using a
RS232 transceiver.
Hyperterminal configuration:
No parity
STM3210B-EVAL Set-up
o
Use LED1, LED2, LED3 and LED4 leds connected respectively to PC.06, PC.07,
PC.08 and PC.09 pins
The USART1 signals (Rx, Tx) must be connected to a DB9 connector using a
RS232 transceiver.
Hyperterminal configuration:
No parity
How to use it ?
In order to make the program work, you must do the following :
stm32f10x_exti.c
stm32f10x_gpio.c
stm32f10x_rcc.c
stm32f10x_dma.c
stm32f10x_usart.c
misc.c
Edit stm32f10x.h file to select the device you are working on.
Edit stm32_eval.h file to select the evaluation board you will use.
Tip: You can tailor the provided project template to run this example, for more details please
refer to "stm32f10x_stdperiph_lib_um.chm" user manual; select "Peripheral Examples" then
follow the instructions provided in "How to proceed" section.
Link all compiled files and load your image into target memory
Note:
NVIC_IRQ_Channels
******************** (C) COPYRIGHT 2009 STMicroelectronics
*******************
* @file
NVIC/IRQ_Channels/readme.txt
* @author MCD Application Team
* @version V3.1.0
* @date
06/19/2009
* @brief
Description of the NVIC IRQ Channels Example.
******************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING
CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS
ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
******************************************************************************
Example Description
This example demontrates the use of the Nested Vectored Interrupt Controller (NVIC) IRQ
Channels configuration:
The three timers are linked to their correspondant Update IRQ channel.
Assignment of a ascendant IRQ priority for each IRQ channel : TIM2 has a preemption
priority of 0 and TIM4 has a preemption priority of 2.
Directory contents
STM3210C-EVAL Set-up
o
STM3210E-EVAL Set-up
o
Use LED1, LED2 and LED3 connected respectively to PD.07, PD.13 and PF.03
pins
Use LED1, LED2 and LED3 leds connected respectively to PF.06, PF0.7 and
PF.08
STM3210B-EVAL Set-up
o
Use LED1, LED2 and LED3 leds connected respectively to PC.06, PC.07 and
PC.08
How to use it ?
In order to make the program work, you must do the following :
stm32f10x_gpio.c
stm32f10x_rcc.c
stm32f10x_exti.c
misc.c
stm32f10x_tim.c
stm32f10x_usart.c
Edit stm32f10x.h file to select the device you are working on.
Edit stm32_eval.h file to select the evaluation board you will use.
Tip: You can tailor the provided project template to run this example, for more details please
refer to "stm32f10x_stdperiph_lib_um.chm" user manual; select "Peripheral Examples" then
follow the instructions provided in "How to proceed" section.
Link all compiled files and load your image into target memory
Note:
Example Description
This example demontrates the use of the Nested Vectored Interrupt Controller (NVIC):
Configuration of 2 EXTI Lines (Wakeup button EXTI Line & Key button EXTI Line) to
generate an interrupt on each falling edge and use the SysTick interrupt.
PreemptionPriority = PreemptionPriorityValue
SubPriority = 0
PreemptionPriority = 0
SubPriority = 1
SysTick Handler:
PreemptionPriority = !PreemptionPriorityValue
In the key button EXTI Line interrupt routine the Wakeup button EXTI Line and SysTick
preemption priorities are inverted. In the Wakeup button EXTI Line interrupt routine the pending
bit of the SysTick interrupt is set this will cause SysTick ISR to preempt the Wakeup button
EXTI Line ISR only if it has higher preemption priority.
The system behaves as following:
1) The first time Key button EXTI Line interrupt occurs the SysTick preemption become higher
than Wakeup button EXTI Line one. So when the Wakeup button EXTI Line interrupt occurs, the
SysTick ISR is executed and the PreemptionOccured variable become TRUE and the four leds
(LED1, LED2, LED3, LED4) start toggling.
2) When the next Key button EXTI Line interrupt occurs the SysTick preemption become lower
than Wakeup button EXTI Line one. So when the Wakeup button EXTI Line interrupt occurs, the
PreemptionOccured variable became FALSE and the four leds (LED1, LED2, LED3, LED4)
stop toggling.
Then this behavior is repeated from point 1) in an infinite loop.
Directory contents
STM3210C-EVAL Set-up
o
Use LED1, LED2, LED3 and LED4 connected respectively to PD.07, PD.13,
PF.03 and PD.04 pins
STM3210E-EVAL Set-up
o
Use LED1, LED2, LED3 and LED4 connected respectively to PF.06, PF0.7,
PF.08 and PF.09 pins
STM3210B-EVAL Set-up
o
Use LED1, LED2, LED3 and LED4 connected respectively to PC.06, PC.07,
PC.08 and PC.09 pins
How to use it ?
In order to make the program work, you must do the following :
stm32f10x_exti.c
stm32f10x_gpio.c
stm32f10x_rcc.c
misc.c
stm32f10x_usart.c
Edit stm32f10x.h file to select the device you are working on.
Edit stm32_eval.h file to select the evaluation board you will use.
Tip: You can tailor the provided project template to run this example, for more details please
refer to "stm32f10x_stdperiph_lib_um.chm" user manual; select "Peripheral Examples" then
follow the instructions provided in "How to proceed" section.
Link all compiled files and load your image into target memory
Note:
NVIC_VectorTable_Relocation
******************** (C) COPYRIGHT 2009 STMicroelectronics
*******************
* @file
NVIC/VectorTable_Relocation/readme.txt
* @author MCD Application Team
* @version V3.1.0
* @date
06/19/2009
* @brief
Description of the NVIC VectorTable_Relocation Example.
******************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING
CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS
ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
******************************************************************************
Example Description
This example describes how to set the CortexM3 vector table in a specific address other than
default using the NVIC_SetVectorTable function from the misc.h/.c driver.
This can be used to build program which will be loaded into Flash memory by an application
previously programmed from the Flash memory base address. Such application can be InApplication Programming (IAP, through USART) or Device Firmware Upgrade (DFU, through
USB).
These applications are available for download from the ST microcontrollers website:
www.st.com/stm32
The associated program implements a "Delay" function based on SysTick end of count interrupt,
and toggles four leds with timing defined by the "Delay" function.
When using the IAP to load your porgram, the vector table must be relocated at address
0x08002000.
When using the DFU to load your porgram, the vector table must be relocated at address
0x08003000.
Directory contents
VectorTable_Relocation/linker:
o
VectorTable_Relocation/linker/EWARMv5:
VectorTable_Relocation/linker/RIDE:
STM3210C-EVAL Set-up
o
STM3210E-EVAL Set-up
o
Use LED1, LED2, LED3 and LED4 leds connected respectively to PD.07, PD.13,
PF.03 and PD.04 pins
Use LD1, LD2, LD3 and LD4 leds connected respectively to PF.06, PF0.7, PF.08
and PF.09 pins
STM3210B-EVAL Set-up
o
Use LD1, LD2, LD3 and LD4 leds connected respectively to PC.06, PC.07,
PC.08 and PC.09 pins
How to use it ?
In order to make the program work, you must do the following :
RVMDK
In the project option menu, select 'Target' window and enter 0x08002000
as IROM start address
In the project option menu, select 'Linker' window and enter 0x08002000
as R/O base address
EWARM5
RIDE
In the Application options -> script menu, set "Use Default Script File" to
"No" and use "stm32f10x_flash_offset.ld" as Script File. This linker is
configured for STM32 High-density devices. To use it with Mediumdensity devices, this linker should be updated as follows:
stm32f10x_gpio.c
stm32f10x_rcc.c
stm32f10x_exti.c
misc.c
stm32f10x_usart.c
Edit stm32f10x.h file to select the device you are working on.
Edit stm32_eval.h file to select the evaluation board you will use.
Tip: You can tailor the provided project template to run this example, for more details please
refer to "stm32f10x_stdperiph_lib_um.chm" user manual; select "Peripheral Examples" then
follow the instructions provided in "How to proceed" section.
In the main.c and linker files, the vector table is relocated at address 0x08002000. You
can modify this address depending on the requirement of your application.
Convert the program image to a binary file, *.bin, then you can download and run it using
the IAP or DFU application.
Note: