Associate
August 3, 2023
Question
Need Support regarding Drivers of STM32 F401 board.
- August 3, 2023
- 6 replies
- 6990 views
Hello Everyone,
I wrote the code by self for GPIO drivers , as a step by step process i am adding code for other peripherals & buses after taking due time in learning , the code progress as of now (as per my knowledge) should be enough to enable the GPIO peripherals & further toggling the internal LED at PA5 , but the LED is not toggling.
Any Solutions are invited.
Below attached are the driver files of MCU.
File 1: STM32f401xx.h (stm32 F4 general drivers Header File)
File 2: STM32f401xx_gpio_driver.h (stm32 F4 GPIO drivers specific Header File)
File 3: STM32f401xx_gpio_drivers.c (stm32 F4 GPIO driver file).
/**********************The Code for Toggling Led ***********************/
#include <stdint.h>
#include "stm32F401xx.h"
void delay(uint32_t time_period)
{
for(uint32_t i =0 ; i < time_period ; i++);
}
int main()
{
GPIO_Handle_t GPIO_Internal_LED;
GPIO_Internal_LED.pGPIOx = GPIOA;
GPIO_Internal_LED.pGPIO_PinConfig_t->GPIO_PinNumber = GPIO_PIN_NO_5;
GPIO_Internal_LED.pGPIO_PinConfig_t->GPIO_PinMode = GPIO_MODE_OUT;
GPIO_Internal_LED.pGPIO_PinConfig_t->GPIO_PinSpeed = GPIO_SPEED_MEDIUM;
GPIO_Internal_LED.pGPIO_PinConfig_t->GPIO_PinOPType = GPIO_OP_TYPE_PP;
GPIO_Internal_LED.pGPIO_PinConfig_t->GPIO_PinPuPdControl = GPIO_NO_PU_PD;
GPIO_PeriClkControl(GPIOA , ENABLE);
GPIO_Init(&GPIO_Internal_LED);
while(1)
{
GPIO_TogglePin(GPIOA,GPIO_PIN_NO_5);
delay(1500);
}
return 0;
}
(All the functions are defined in "File 3").
Thanks !
