Anda di halaman 1dari 13

2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery

Home
STM32F4/29 Discovery
STM32F4 links
All STD libraries
STD Libraries API
All HAL libraries
HAL Libraries API
ESP8266
All tutorials

About

STM32F4 Discovery Libraries and tutorials for STM32Fxxx series by Tilen Majerle.

About
LinkedIn
Twitter
Google+
Facebook
Github
Instagram

FOLLOW: STM32F4 / STM32F4 DISCOVERY / STM32F429 / MORE


STM32F429 DISCOVERY
64 COMMENTS
NEXT STORY
SUBSCRIBE
Library 03- STM32F4 system clock and
delay functions
Subscribe if you want to be
Library 02- STM32F429 notified about new posts and
other events on this site.


PREVIOUS STORY

01- First time with STM32F429


Discovery GPIO tutorial Name
Discovery
with onboard leds and
Email *

TOP POSTS
button
All STM32F4 tutorials BY TILZ0R APRIL 6, 2014
Subscribe
STM32F4 PWM tutorial with TIMERs
All STM32F4 libraries
STM32F4 External interrupts tutorial
POLL
All STM32 HAL libraries
Standard peripheral drivers vs
Library 02- STM32F429 Discovery GPIO
Your first blinky project works, but you dont know HAL drivers
tutorial with onboard leds and button
how? I like standard peripheral
drivers and I want to stay on
I will explain GPIO (General Purpose Input/Output) them.
RECENT COMMENTS
CMSIS Library. This library is used to work with I want to start with new
Majerle Tilen on STM32F4 FFT example physical pins on microcontroller. You can set pins HAL system
What are standard
to input or output, put them low (0 volts) or HIGH
Majerle Tilen on New library system built peripheral drivers?
(3,3 volts), select pull resistors, choose output
on STM32Fxxx HAL drivers What are HAL drivers?
type and select clock speed.
Vote
Majerle Tilen on Ethernet server using
To be able to work with pin, you have to enable View Results
STM32F4-Discovery and SD card
pin clock. This is set inside RCC (Reset and Clock
This website uses cookies to improve your experience.
Control).We'll assume you're
AllGPIOs areokon
with this, but
AHB1 you can
bus. Weopt-out if you wish.
will use Accept Read More

https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 1/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery

Majerle Tilen on HAL library 3- DELAY for GPIOG port, because our onboard leds are
STM32Fxxx connected to pins PG13 and PG14. We can enable SUPPORT US
clock with code below:
MK on HAL library 3- DELAY for
1 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE
STM32Fxxx
Next,you need a GPIO_InitTypeDef struct to set
options for pin. If you have included GPIO library
SEARCH
CATEGORIES into project, you can do this with following:
To search type and hit enter
ARM Cortex-M 1 GPIO_InitTypeDef GPIO_InitDef; //Where GPIO_InitDef is variable to work with struct

GPIO_InitTypeDef has 5 options:


Random
TWITTER
1. GPIO_Pin: Choose pins you will use for set
STM32F4
settings
Tweetsby@tilz0R
STM32F4 Discovery 2. GPIO_Mode: Choose mode of operation. Look
down for options TilenMajerle
STM32F429 @tilz0R
3. GPIO_OType: Choose output type
SourcecodeforICLocker
4. GPIO_PuPd: Choose pull resistor websiteisonlineandfreeto
STM32F429 Discovery
use.Youcannowbuildyour
5. GPIO_Speed: Choose pin speed ownICLockerwebsiteat
STM32F7 home.
Every of this settings has its own options. github.com/MaJerle/iclock

STM32F7 Discovery
GPIO_Pin: With this you select pins. MaJerle/i
Officialre
Tutorials 1 //Apply settings just to GPIO_Pin_13: github.com
2 GPIO_InitDef.GPIO_Pin = GPIO_Pin_13;
3 //If you would like to use more pins with same settings, you can use this:
Uncategorized 4 //This will apply same settings to pins 13 and 14 18Feb
5 GPIO_InitDef.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14
6 //This will apply same setings to all pins for one GPIO
7 GPIO_InitDef.GPIO_Pin = GPIO_Pin_All; TilenMajerle
@tilz0R
GPIO_Mode: Mode of pins operation Newlibraries:ESP8266AT,
GSMATandGPS
GPIO_Mode_IN: Set pin to input NMEAparsersbit.ly/2ecBYSz
GPIO_Mode_OUT: Set pin to be an
Newlibra
output
Inthepas
GPIO_Mode_AF: Set pin to alternating stm32f4d

function (to use with peripheral ex. SPI,


USART, etc) Embed ViewonTwitter
GPIO_Mode_AN: Set pin to be an analog
(ADC or DAC)
GPIO_OType: Mode for pins output type
GOOGLE+
GPIO_OType_PP: Output type is push-
RECENT POSTS
pull
New libraries: ESP8266 AT, GSM AT and GPIO_OType_OD: Output type is open
GPS NMEA parsers drain
GPIO_PuPd: Select pull resistors or disable it
HAL Library 36- AHRS and IMU
GPIO_PuPd_UP: Enable pull up resistor
algorithms for calculating roll, pitch and yaw
GPIO_PuPd_DOWN: Enable pull down
axes
resistor
HAL Library 35- GPS parser for GPIO_PuPd_NOPULL: Disable pull Tilen Majerle
google.com/+TilenMajerle
STM32Fxxx resistor
Follow
GPIO_Speed: Select GPIO speed
HAL Library 34- DSP FILTERS for
GPIO_Speed_100MHz 575 followers
STM32Fxxx
GPIO_Speed_50MHz
Follow me on Google+
IC Locker Online inventory for your IC GPIO_Speed_25MHz
components GPIO_Speed_2MHz

HAL Library 33- DMA extension for SPI


on STM32Fxxx

Automotive Connectors
Common
This website uses cookies to improve your experience. and
We'll hard toyou're
assume nd connectors Inbut
ok with this, stock,
youready to ship Go
can opt-out to corsa-technic.com
if you wish. Accept Read More

https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 2/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery

CALENDAR
We never told the script which port we will use
April 2014
because we have more pins 13 and 14 on board.
M T W T F S S
Here comes the first GPIO function called
1 2 3 4 5 6 GPIO_Init(). It is located in stm32f4xx_gpio.h
7 8 9 10 11 12 13
1 /**
14 15 16 17 18 19 20 2 * @brief Initializes the GPIOx peripheral according to the specified parameters in the GPIO_InitStru
3 * @param GPIOx: where x can be (A..I) to select the GPIO peripheral.
21 22 23 24 25 26 27 4 * @param GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that contains
5 * the configuration information for the specified GPIO peripheral.
28 29 30 6 * @retval None
7 */
May 8 void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef*

We want to initialize pins PG13 and PG14 (there


are red and green leds on board) to be an output,
ARCHIVES
push-pull output type, without pull resistor and
November 2016 speed 50MHz. We do this like this:

1 //Enable clock for GPOIG


July 2016 2 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE
3 //Initialize struct
4 GPIO_InitTypeDef GPIO_InitDef;
April 2016 5
6 //Pins 13 and 14
7 GPIO_InitDef.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14
January 2016 8 //Mode output
9 GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT;
10 //Output type push-pull
December 2015 11 GPIO_InitDef.GPIO_OType = GPIO_OType_PP;
12 //Without pull resistors
13 GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL;
November 2015 14 //50MHz pin speed
15 GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz;
16
October 2015 17 //Initialize pins on GPIOG port
18 GPIO_Init(GPIOG, &GPIO_InitDef);

September 2015 Our pins are now ready. But leds are still off. We
need to turn them on:
August 2015
1 //Set PG13 and PG14 pins HIGH
2 GPIO_SetBits(GPIOG, GPIO_Pin_13 | GPIO_Pin_14);
July 2015
Or if we would like to put leds back off:
June 2015
1 //Set PG13 and PG14 pins LOW
2 GPIO_ResetBits(GPIOG, GPIO_Pin_13 | GPIO_Pin_14);
May 2015
Toggle pin is possible too:
April 2015
1 //Toggle PG13 and PG14 pins
2 //If pin was HIGH, than it will be now LOW
March 2015 3 //If pin was LOW, than it will be now HIGH
4 GPIO_ToggleBits(GPIOG, GPIO_Pin_13 | GPIO_Pin_14)

February 2015
On discovery board also has blue User button

January 2015
connected to PA0. Lets configure it as input with
enabled pull down resistor.
December 2014
1 //Enable clock for GPOIA
2 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE
November 2014 3
4 //Pin 0
5 GPIO_InitDef.GPIO_Pin = GPIO_Pin_0;
October 2014 6 //Mode output
7 GPIO_InitDef.GPIO_Mode = GPIO_Mode_IN;
8 //Output type push-pull
September 2014 9 GPIO_InitDef.GPIO_OType = GPIO_OType_PP;
10 //With pull down resistor
11 GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_DOWN;
12 //50MHz pin speed
August 2014
13 GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz;
14
15 //Initialize pin on GPIOA port
July 2014
16 GPIO_Init(GPIOA, &GPIO_InitDef);

June 2014 We have configured pin as input, but how to read


value on pin?
May 2014
1 //Returs pin state (1 if HIGH, 0 if LOW)
2 GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0)
April 2014
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 3/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery

This is all. I made a little program to test all. Leds


are turned off until you press on blue button.

1 #include "stm32f4xx.h"
2 #include "stm32f4xx_rcc.h"
3 #include "stm32f4xx_gpio.h"
4
5 int main(void) {
6 GPIO_InitTypeDef GPIO_InitDef;
7 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG,
8
9 GPIO_InitDef.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14
10 GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT;
11 GPIO_InitDef.GPIO_OType = GPIO_OType_PP;
12 GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL;
13 GPIO_InitDef.GPIO_Speed = GPIO_Speed_100MHz;
14 //Initialize pins
15 GPIO_Init(GPIOG, &GPIO_InitDef);
16
17 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,
18
19 GPIO_InitDef.GPIO_Pin = GPIO_Pin_0;
20 GPIO_InitDef.GPIO_Mode = GPIO_Mode_IN;
21 GPIO_InitDef.GPIO_OType = GPIO_OType_PP;
22 GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_DOWN;
23 GPIO_InitDef.GPIO_Speed = GPIO_Speed_100MHz;
24 //Initialize pins
25 GPIO_Init(GPIOA, &GPIO_InitDef);
26
27 //volatile int i;
28 while (1) {
29 if (GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0
30 GPIO_SetBits(GPIOG, GPIO_Pin_13 | GPIO_Pin_14
31 } else {
32 GPIO_ResetBits(GPIOG, GPIO_Pin_13 |
33 }
34 }
35 }

And because I dont always want to initialize leds


and button, I made a library that will do this for
you.

Library
Features
Sets led on, off or toggle
Checks led state if it is on or off
Checks button state
Supports STM32F429-Discovery leds and
button
Supports STM32F4-Discovery leds and
button
Supports STM32F401-Discovery leds and
button
Supports Nucleo F401 led and button
Supports Nucleo F411 led and button

Dependencies
CMSIS
STM32F4xx
STM32F4xx RCC
STM32F4xx GPIO
TM
TM GPIO
TM STM32F4 GPIO Library
41822 downloads 4.91 KB

Download
defines.h
defines.h configuration example
89851 downloads 0.70 KB
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 4/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery

Download

By default, library dont know which board is used


in your project, so you have to tell it. Open
defines.h file or global projects defines (IDE
options) and add various defines, according to the
board you use. If you not specify settings, you will
get an error tm_stm32f4_disco.h: Please select
your board.

1 /**
2 *STM32F4 Discovery: (STM32F407VG)
3 * Open project options and add "STM32F407VG" define (without quotes)
4 *- Leds:
5 *- LED_GREEN on PD12
6 *- LED_ORANGEon PD13
7 *- LED_RED on PD14
8 *- LED_BLUE on PD15
9 *- Button: (HIGH when pressed)
10 *- Blue buttonon PA0
11 *
12 *STM32F429 Discovery: (STM32F429ZI)
13 * Open project options and add "STM32F429ZI" define (without quotes)
14 *- Leds:
15 *- LED_GREEN on PG13
16 *- LED_RED on PG14
17 *- Button: (HIGH when pressed)
18 *- Blue buttonon PA0
19 *
20 *NUCLEO-F401: (STM32F401RE)
21 *NUCLEO-F411: (STM32F411RE)
22 * Open project options and add "STM32F401RE" or "STM32F411RE" define (without quotes)
23 *- Led:
24 *- LED_GREEN on PA5
25 *- Button: (LOW when pressed)
26 *- Blue buttonon PC13
27 *
28 *STM32F401 Discovery: (STM32F401VC)
29 * Open project options and add "STM32F401VC" define (without quotes)
30 *- Leds:
31 *- LED_GREEN on PD12
32 *- LED_ORANGEon PD13
33 *- LED_RED on PD14
34 *- LED_BLUE on PD15
35 *- Button: (HIGH when pressed)
36 *- Blue buttonon PA0
37 * */

Functions and
enumerations
1 /**
2 * Configure led pins to output
3 *
4 */
5 extern void TM_DISCO_LedInit(void);
6
7 /**
8 * Configure blue button as input
9 *
10 */
11 extern void TM_DISCO_ButtonInit(void);
12
13 /**
14 * Turn on LED
15 *
16 * Parameters:
17 * - led:
18 *LED_ALL
19 * LED_GREEN
20 * LED_RED
21 *LED_ORANGE
22 *LED_BLUE
23 */
24 #define TM_DISCO_LedOn(led)(TM_DISCO_LED_PORT->BSRRL = led)
25
26 /**
27 * Turn off LED
28 *
29 * Parameters:
30 * - led:
31 *LED_ALL
32 * LED_GREEN
33 * LED_RED
34 *LED_ORANGE
35 *LED_BLUE
36 */
37 #define TM_DISCO_LedOff(led)(TM_DISCO_LED_PORT->BSRRH = led)
38
39 /**
40 * Toggle LED
41 * We'll assume you're ok with this, but you can opt-out if you wish.
This website uses cookies to improve your experience. Accept Read More

https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 5/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery
42 * Parameters:
43 * - led:
44 *LED_ALL
45 * LED_GREEN
46 * LED_RED
47 *LED_ORANGE
48 *LED_BLUE
49 */
50 #define TM_DISCO_LedToggle(led)(TM_DISCO_LED_PORT->ODR ^= led)
51
52 /**
53 * Check's if led is on
54 *
55 * Parameters:
56 * - uint16_t led:
57 * LED_GREEN
58 * LED_RED
59 *LED_ORANGE
60 *LED_BLUE
61 *
62 * Return 1 if turned on, otherwise 0
63 */
64 #define TM_DISCO_LedIsOn(led)((TM_DISCO_LED_PORT->ODR & led) != Bit_RESET)
65
66 /**
67 * Set led's state with one function
68 *
69 * Parameters:
70 * - uint16_t led:
71 * LED_GREEN
72 * LED_RED
73 *LED_ORANGE
74 *LED_BLUE
75 *- uint8_t state:
76 *0: led is off
77 *> 0: led is on
78 *
79 * Return 1 if turned on, otherwise 0
80 */
81 #define TM_DISCO_SetLed(led, state)((state) ? TM_DISCO_LedOn(led): TM_DISCO_LedOff(led))
82
83 /**
84 * Checks if button is pressed
85 *
86 * Returns 1 if is pressed, otherwise 0
87 */
88 #define TM_DISCO_ButtonPressed()(((TM_DISCO_BUTTON_PORT->IDR & TM_DISCO_BUTTON_PIN) == 0) != TM

Example
When you press the button, led will be turned
on.

1 /**
2 *Keil project for LEDS and BUTTON
3 *
4 *Before you start, select your target, on the right of the "Load" button
5 *
6 *@authorTilen Majerle
7 *@emailtilen@majerle.eu
8 *@websitehttp://stm32f4-discovery.com
9 *@ideKeil uVision 5
10 *@packsSTM32F4xx Keil packs version 2.2.0 or greater required
11 *@stdperiphSTM32F4xx Standard peripheral drivers version 1.4.0 or greater required
12 */
13 /* Include core modules */
14 #include "stm32f4xx.h"
15 /* Include my libraries here */
16 #include "defines.h"
17 #include "tm_stm32f4_disco.h"
18
19 int main(void) {
20 /* Initialize System */
21 SystemInit();
22
23 /* Initialize leds on board */
24 TM_DISCO_LedInit();
25
26 /* Initialize button on board */
27 TM_DISCO_ButtonInit();
28
29 while(1) {
30 /* If button pressed */
31 if (TM_DISCO_ButtonPressed()) {
32 /* Turn on leds */
33 TM_DISCO_LedOn(LED_RED | LED_GREEN);
34 } else {
35 /* Turn off leds */
36 TM_DISCO_LedOff(LED_RED | LED_GREEN)
37 }
38 }
39 }

Project available onGithub, download library


below.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 6/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery

TM STM32F4 DISCO Library


Leds and buttons for Discovery boards

Download

3.77 KB 9945 downloads

I hope this tutorial a little bit helps to you.

Share this to other users:

11

Tags: button coide coocox gpio gpio tutorial leds

microcontrollers stm32f429 stm32f429discovery

stm32f4discovery stm32f4xx

tilz0R
Owner of this site. Also electronic

enthusiasts, web developer, 3D printer
fan, handball player and more. Big fan of
STM32F4 devices. In anticipation of the
new Discovery board for STM32F7 lines.

at an enterprise and granular


SQL Server Protection level Watch the free webinar
now!
YOU MAY ALSO LIKE...

21 1 5

HAL Library HAL Library Library 47-


33- DMA 27- CRC module
extension for Identification on STM32F4
SPI on for 30 DEC, 2014
STM32Fxxx STM32Fxxx
22 APR, 2016 8 SEP, 2015

Read before
commenting!
Before you make a new comment, make sure
you agree with things listed below:

- Read post to make sure if it is already


posted what you are asking for,
- Make sure you have the latest version
of libraries used in your project,
- Make a clean and grammatically correct
written message,
- Report as many details as possible,
including what have you done so far,
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 7/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery

- Do NOT post any code here. Use


Pastebin,
- Do NOT post any error codes here. Use
Pastebin,
- Specify STM32Fxxx family and used
Discovery/EVAL/Nucleo or custom made
board,
- Make sure your clock is set correct for
PLL,
- If you are using my HAL drivers, please
check this post how to start.

Comment will be deleted on breaking these


rules without notification!

Sand Manufacturing Plant


Fine Sand Manufacturing Plant. Free Design and Download PDF Files. Go to hxjq-crusher.com

Comments Community Login

Recommend 1 Share SortbyBest

Jointhediscussion

AlejoAldana6monthsago
Himannicelibrariesjob!.I'mnoobwith
STM32F4
I'veaproblem.Iaddalllibrariesneededwith.h
and.cfiles,butalwayssays"fatalerror:(for
example"tm_stm32_gpio.h"fileNOTFOUND)
oranyother,Idefinedindefines.hfilebutitstill
doesn'twork,whatitcouldbe!!.Thanks!(and
whereIaddtheHALdriverfiles)
Reply Share

AnhPnL7monthsago
HiMajerleTilen,Ijuststartlearningstm32f4
discovery.Yourlessonsaregreat,easyto
understand.ButcanIaskyouaquestionthat
howcanIdefineSTM32F407VGinthedefine.h
file
Reply Share

radekmh>AnhPnL
7monthsago
Simplywrite'#defineSTM32F407VG'
underthecommentinthisfilethattells
youtodoit:)
Reply Share

FELIXayearago
NICE
Reply Share

Jacobayearago
Hello,I'mcreatingamuxcontrolerandIwould
liketoconfigurePF11tobe1onprogramstart,
andPF13,PF13tobe0onprogramstart.

SoIsetPF11withpullupandtheotherswith
pulldown.AfterIsendcompiledprogramtomy
STM32alloftheconfiguredpinsare0.Changing
bitslaterinthecodeworksfine.

CouldyoupleasetellmewhatamIdoing
wrong?http://pastebin.com/mwF2jTCU
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More
Reply Share
https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 8/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery

MajerleTilen Admin >Jacob


ayearago
Youroutputtypeofpinsis"PUSHPULL"
andyouhaveitconfiguredasoutputs
withpullupsPullupsheredoesnothave
anypoint,becausewithPPmode,you
canforcepintobehighorlowaccording
tooutputregistervalue.
So,youcanuseOpenDrainmodeon
pinwithpullupwhereyoucanjustforce
ittoGND,pullupmakeslogical1or
forcepinhighwithGPIOF>ODR
register,orbetter:
GPIO_SetBits(GPIOF,GPIO_Pin_11)
Reply Share

Loarriayearago
Hellosir!CongratulationforyourusefulAnd
Goodwork!Onequestion...Ihavea
doubt:whichIdesoftwareneedtousewithyour
code?Keiluvisionor?AtNowIuseTheonline
mbedIdeAndIlikeItButiThinkiCannonuse
yorlibrarieswithItright?thanksyouVerymuch
foryourhelp!!!!!bye,Lo
Reply Share

MajerleTilen Admin >Loarri


ayearago
YoucanuseanyIDEwhichhasARM
basedcompiler,sosomeofthemare
these:
KeiluVIsionwithARMCCcompiler
(nonfree)
CoocoxwithGCC(free)
OpenSTM32withGCC(free)
AtollicTrueSTUDIOwithGCC(non
free)
IAR(nonfree)
EclipsewithGCC(free)

I'musingKeil,butlibraryworksinanyC
compilerwhichsupportsARM.
Reply Share

Loarri>MajerleTilen
ayearago
that'sgood!manythanksforyour
veryquicklyreply!!!!:)soIdon't
knowverywellabouttheseide
softwares...Ihaveuvisononmy
laptopbutIneveruseditbecause
itseemsratherdifficultforme!so
whatisyoursuggestiontouse?
whydidyounotusetheonlineide
fromarm(mbed)?Iusethisone
becauseItseemstheeasiestand
similarlanguageasArduino.
Manythanksagainandciao
Lo
Reply Share

MajerleTilen Admin
>Loarri ayearago
Ithinkthatreasonslike"it
isonline"and"seemsthe
easiestandsimilar
languageasArduino"are
enoughwhyIdon'tuse
mbed:)

IsuggestCoocoxor
OpenSTM32.
Reply Share
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More
Loarri>Majerle
https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 9/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery
Loarri>Majerle
Tilen ayearago
okokI'lltray!Thanks
again!bye
Reply Share

jackynguyen>
Loarri 4monthsago
ahihi
Reply Share

Tyrionlannisterayearago
thanksforyourreplyformyearlierdoubt.
pleasehelpmeonthis,

Doineedtoconnectexternalpullupsfordata
andclocklines.(stm32l052r8)
Reply Share

selfiemug2yearsago
whatislibraryworkinstm32f407vg?
Reply Share

MajerleTilen Admin >selfiemug


2yearsago
"Makeacleanandgrammaticallycorrect
writtenmeassage,"
Reply Share

selfiemug>MajerleTilen
2yearsago
whatyoumean?workornot
Reply Share

selfiemug>MajerleTilen
2yearsago
whatyoumean?workornot?
Reply Share

MajerleTilen Admin
>selfiemug
2yearsago
ImeanthatIdon't
understandyou.
Thislibworksforany
F4xxseries.
Reply Share

marie2yearsago
Isthereapossibilitytoread/writefrom/tothe
pinswithanotherfrequencythan2,25,50or
100MHz?IamusingaSTM32F407.Thanksfor
yourhelp!
Reply Share

MajerleTilen Admin >marie


2yearsago
Thesespeedsdoesnotmeanthatthisis
read/writefrequency.
ThisisthemaximumGPIOPIN
frequencypincanhandle.

So,ifyousetGPIOpinto2MHz,then
youcan4Mtimesinonesecondchange
GPIOstateandwillsignalbenice.
Ifyoutogglepinfaster,signalmightnot
benicesquareanymore.Itissomesort
ofcapacitanceloadonlyforthissetting.
Reply Share

marie>MajerleTilen
2yearsago
Ohgreat,thanksforthefast
answer,thatwasveryhelpful!
This website uses cookies to improve your experience. We'll assume you'reok with
this,
Reply Share
but you can opt-out if you wish. Accept Read More

https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 10/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery

JohnDoe2yearsago
Loveyoursite!
Reply Share

Cxl2yearsago
Dearsir,Iwanttodisablesomeofthe
JTAG/SWDpins,butnoway.
Reply Share

MajerleTilen Admin >Cxl


2yearsago
Howyoumeandisable?
Tosetthemasoutput/alternate/input?
Orhowexactly?Youwannadisable
thesepinsforever?
Reply Share

ChaitanyaAllam2yearsago
HiTilen,
Nicework!,Ihaveaqueryforu.canwedetect
openwireininputapartfrom0and1.
Reply Share

MajerleTilen Admin >Chaitanya


Allam 2yearsago

IthinkIdon'tunderstandquestion
correctly.
Reply Share

Lazar>MajerleTilen
2yearsago
Mastatinijejasno?haha:D
Reply Share

MajerleTilen Admin
>Lazar 2yearsago

)
Reply Share

JackyCr2yearsago
HiTilen,

Canwedeclareavariablein.hfiles?WhenItry
todoit,Iget'multiplydefined'error.Thesample
codeisbelow

http://codepaste.net/camh4p
Reply Share

MajerleTilen Admin >JackyCr


2yearsago
Youcanwithsomerestrictions.
Youshowedmelib.hfileandinsidethis
fileyouhaveinclude"lib.h"again.

Takealookfor"extern"keywordinC.
Reply Share

NicolasToussaintSoundForce2yearsago
Majerle!Thankyousomuchforexplainingso
easilyanclearly!Alltheinfosareinthesame
place.STM32issopowerfulbutanightwareto
startfromscratch.

Thanksforthehardwork.Greatsite.
Reply Share

MajerleTilen Admin >Nicolas


ToussaintSoundForce 2yearsago

Nicetohear.Haveaniceprogramming)
Reply Share

phivu2yearsago
Dearsir,
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More
IfIwanttosetuponepinasoutputatthefirst
https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 11/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery
IfIwanttosetuponepinasoutputatthefirst
timebutinputatthenexttime,iwonderthathow
canIprogramlikethat
Reply Share

MajerleTilen Admin >phivu


2yearsago
Ohman..setpintooutput,doyourstuff,
setpintoinput..doyourstuff.
Simpleasthat.2timesyouwillcall
GPIO_Init()functionwithcorresponding
parameters.
Reply Share

Katendencies2yearsago
Majeriethanksbro!!
Reply Share

FawadAslam2yearsago
problemregardingpinconfiguration.ihavean
"ADCRegularconversionexample"inwhichthe
gpiopin10isselected(examplealreadygivenin
stm32cubef4folderidownloaded)

#defineADCx_CHANNEL_PINGPIO_PIN_10

whileyouselectedpins13and14whichareon
thediscoveryboard.Canyoutellmewhereare
theotherpinslocatedorwhyinexample(ADC
Regularconversion)pin10wasselected?
Reply Share

MajerleTilen Admin >FawadAslam


2yearsago
PinsPG13andPG14arepinsforLEDs
onSTM32F429Discoveryboard.

I'mnotusingHALdrivers,expeciallynot
Cubecodegenerator.

ADChasnothingtodowithLEDs.
Reply Share

FawadAslam>MajerleTilen
2yearsago
ok.butthegpiohas16pins.how
doiknowthefunctionsofother
pinstousethem?
Reply Share

MajerleTilen Admin
>FawadAslam
2yearsago
One(andproper)wayis
toreaddatasheet,pin
descriptionforyour
specificdevice.
Secondoptionistoopen
STM32Cube,andwhen
youselectperipheral,
clickonpinonchipwhich
isdisplayedandcheckit's
availableoptions,
Reply Share

RonakPatel2yearsago

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 12/13
2/28/2017 Library02STM32F429DiscoveryGPIOtutorialwithonboardledsandbuttonSTM32F4Discovery
About
LinkedIn
Twitter
Google+
Facebook
Github
Instagram


STM32F4 Discovery 2017. All Rights Reserved.
Copying content from this site is stricly forbidden. This does not apply for
library downloads.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

https://stm32f4discovery.net/2014/04/stm32f429discoverygpiotutorialwithonboardledsandbutton/ 13/13

Anda mungkin juga menyukai