2017-09-05 09:43 AM
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.
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 #gpioSolved! Go to Solution.
2017-09-05 09:51 AM
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();}2017-09-05 09:51 AM
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();}2017-09-06 03:24 AM
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();}}