Example description
GPIO_IOToggle GPIO IO Toggle example
Example Description
GPIO ports are connected on AHB bus, using BSRRH and BSRRL registers one cycle is
required to set a pin and another cycle to reset it. So GPIO pins can toggle at
AHB clock divided by 2.
This example describes how to use BSRRH and BSRRL (Port Bit Set/Reset Register
High and Low) for maximum IO toggling.
PG6 and PG8 (configured in output pushpull mode) toggles in a forever loop:
- Set PG6 and PG8 by setting corresponding bits in BSRRL register
- Reset PG6 and PG8 by setting corresponding bits in BSRRH register
In this example, HCLK is configured at 120 MHz so PG6 and PG8 toggles at 60MHz.
To achieve the maximum IO toggling frequency, you have to configure your compiler
options for high speed optimization.
Directory contents
- GPIO/IOToggle/stm32f2xx_conf.h Library Configuration file
- GPIO/IOToggle/stm32f2xx_it.c Interrupt handlers
- GPIO/IOToggle/stm32f2xx_it.h Interrupt handlers header file
- GPIO/IOToggle/main.c Main program
- GPIO/IOToggle/system_stm32f2xx.c STM32F2xx system source file
The "system_stm32f2xx.c" is generated by an automatic clock configuration
tool and can be easily customized to your own configuration.
To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool.
Hardware and Software environment
- This example runs on STM32F2xx Devices.
- This example has been tested with STM322xG-EVAL RevB and can be easily tailored
to any other development board
- STM322xG-EVAL Set-up
- Use LED1 and LED2 connected respectively to PG.06 and PG.08
===============================================================================
GPIO_JTAG_Remap GPIO JTAG/SWD Remap example
Example Description
This example provides a short description of how to use the JTAG/SWD IOs as standard
GPIOs and gives a configuration sequence.
Note that once the JTAG/SWD IOs are disabled, the connection with the host debugger is
lost and cannot be re-established as long as the JTAG/SWD IOs remain disabled.
To avoid this situation, the Key push-button is used to disable or not the JTAG/SWD IOs:
1. Key push-button maintained pressed at reset: JTAG/SWD IOs disabled and LED1 turned ON
2. Key push-button not pressed at reset: JTAG/SWD IOs unchanged and LED2 turned ON
Before starting this example, you should disconnect your JTAG/SWD probe and run
the example in stand-alone mode.
Directory contents
- GPIO/JTAG_Remap/system_stm32f2xx.c STM32F2xx system clock configuration file
- GPIO/JTAG_Remap/stm32f2xx_conf.h Library Configuration file
- GPIO/JTAG_Remap/stm32f2xx_it.c Interrupt handlers
- GPIO/JTAG_Remap/stm32f2xx_it.h Header for stm32f2xx_it.c
- GPIO/JTAG_Remap/main.c Main program
The "system_stm32f2xx.c" is generated by an automatic clock configuration
tool and can be easily customized to your own configuration.
To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool.
Hardware and Software environment
- This example runs on STM32F2xx Devices.
- This example has been tested with STM322xG-EVAL RevB and can be easily tailored
to any other development board
- STM322xG-EVAL Set-up
- Use LED1 and LED2 connected respectively to PG.06 and PG.08
- Use the Key push-button connected to pin PG15 (EXTI Line15)