Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Systick delay problem in KEIL STM32F407 descovery

Status
Not open for further replies.

yefj

Advanced Member level 4
Joined
Sep 12, 2019
Messages
1,225
Helped
1
Reputation
2
Reaction score
3
Trophy points
38
Activity points
7,355
Hello,I have tried to create a systick delay using systick interrupt as shown in the code bellow.
But i cant see what is the link between the core frequency and the actual delay of the sistick interrupt.
How can i link the core frequency to the actual delay?


HAL MANUAL STM32FG14
https://www.st.com/content/ccc/reso...df/jcr:content/translations/en.DM00105879.pdf

STM32F407 RM
https://www.st.com/resource/en/refe...-arm-based-32-bit-mcus-stmicroelectronics.pdf

Code:
#include "stm32f407xx.h"

volatile uint16_t delay_count=0;
void SysTick_Handler(void)//called every 1ms
{
    if (delay_count>0)
    {
         delay_count--;
    }
}
void delay_ms(uint16_t delay_temp)
{
    delay_count=delay_temp;
    while(delay_count){}
}
int main()
{
   
   
    RCC->AHB1ENR|=(1uL<<3); //set thirdbit
    //GPIOD->MODER&=~(1uL<<31);//reset 0 on 31 01 to gpio_moder 31,30 bits in register
    //GPIOD->MODER|=(1uL<<30);//set 1 on 30 output mode for pin 15 port D
    GPIOD->MODER=0x55000000;
   
    SysTick_Config(SystemCoreClock/1000);//1 ms interrupt
   
    GPIOD->OTYPER=0; //all register is push pull
    GPIOD->OSPEEDR=0;//speed low
     //GPIOD->ODR|=(1<<15); //Sets pin 15

    while(1)
       
    {
         GPIOD->BSRR=(1uL<<15);
             delay_ms(500);
     GPIOD->BSRR=(1uL<<(15+16));      
       delay_ms(500);

    }
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top