cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429-disc1 GPIO_IOToggle test (How can I modify GPIO pin

Carter Lee
Associate III
Posted on September 05, 2017 at 18:43

Hi.

I've done set up the \STM32F4xx_DSP_StdPeriph_Lib_V1.8.0 with keil and  think the flash download works good.

So I'm trying to implement GPIO_IOToggle test with 

STM32F4xx_DSP_StdPeriph_Lib_V1.8.0's

  

template project 

After compile, there is no error and I've uploaded to flash my firmware.

0690X000006044fQAA.jpg

But LED does not work. I think there are some mismatch between STM32F429-disc1 kit and 

STM32F4xx_DSP_StdPeriph_Lib_V1.8.0's GPIO declaration.

STM32F429-disc1 ki  have just 2 leds  and it's connected PG13 and PG14. but there is no PG13 and PG14.

 main code is the following.

the original code is

int main(void)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);

GPIO_InitStructure.GPIO_Pin = LED1_PIN | LED2_PIN;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_Init(GPIOG, &GPIO_InitStructure);

while (1)

{

/* Set PG6 and PG8 */

GPIOG->BSRRL = LED1_PIN | LED2_PIN;

/* Reset PG6 and PG8 */

GPIOG->BSRRH = LED1_PIN | LED2_PIN;

and I modify such as the below.

int main(void)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);

GPIO_InitStructure.GPIO_Pin = LED13_PIN | LED14_PIN;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_Init(GPIOG, &GPIO_InitStructure);

while (1)

{

GPIOG->BSRRL = LED13_PIN | LED14_PIN;

GPIOG->BSRRH = LED13_PIN | LED14_PIN;

}

I just want to test of blink in 

GPIO_IOToggle example project.

Can I use ''stm32f4xx_gpio.c'' of ''STM32F4xx_StdPeriph_Driver'' for blink test to PG13 and PG14?

How to connect between PG13, PG14  and ''

stm32f4xx_gpio.c'' of ''

STM32F4xx_StdPeriph_Driver''?

Would you please help me what am I supposed to do?

#stm32f429-discovery #gpio
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on September 05, 2017 at 18:51

What's the issue with the second piece of code, you don't specify

This might have a higher probability of working

void delay(void)

{

  volatile int i;

  for(i=0; i<10000000; i++);

}

int main(void)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_Init(GPIOG, &GPIO_InitStructure);

while (1)

{

GPIOG->BSRRL = GPIO_Pin_13 | GPIO_Pin_14;

delay();

GPIOG->BSRRH = GPIO_Pin_13 | GPIO_Pin_14;

delay();

}
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2
Posted on September 05, 2017 at 18:51

What's the issue with the second piece of code, you don't specify

This might have a higher probability of working

void delay(void)

{

  volatile int i;

  for(i=0; i<10000000; i++);

}

int main(void)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_Init(GPIOG, &GPIO_InitStructure);

while (1)

{

GPIOG->BSRRL = GPIO_Pin_13 | GPIO_Pin_14;

delay();

GPIOG->BSRRH = GPIO_Pin_13 | GPIO_Pin_14;

delay();

}
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 06, 2017 at 10:24

Hi Clive, Thanks

Your instruction works very well..

void delay(void)

{

volatile int i;

for(i=0; i<10000000; i++);

}

int main(void)

{

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_Init(GPIOG, &GPIO_InitStructure);

while (1)

{

GPIOG->BSRRL = GPIO_Pin_13 | GPIO_Pin_14;

delay();

GPIOG->BSRRH = GPIO_Pin_13 | GPIO_Pin_14;

delay();

}

}0690X000006045OQAQ.jpg0690X000006045YQAQ.jpg0690X000006045iQAA.jpg0690X000006045sQAA.jpg