cancel
Showing results for 
Search instead for 
Did you mean: 

calculate time interval (stm32f405 rgt6)

Zy
Associate

My work on stm32f405 just started last month. It means I don't know very much about it, and I have been working on other C/C++ applications development.

The stm32 MCU board I have is given in snapshots.

0690X000009joQFQAY.jpg0690X000009joQKQAY.jpg

I have been working on time interval's computation for almost one week but no good idea to get it.

I tried using SysTick->VAL and RTC but doesn't work, for I was told that there is no RTC on the board and SysTick needs to reload which had been initialized at the very beginning of the system for some delays(). In this case, there is no simple way for me to do this. Someone has told me to use TIM but 4 TIM (2 to 5) were used for encoders, and I'am worrying about doing configurations for hardware because of wick knowledge in hardware. So, anyone help?

SysTick's init is done after system startup

void delay_init(168) 

#if SYSTEM_SUPPORT_OS                        . 

    u32 reload; 

#endif 

      SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);  

    fac_us=SYSCLK/8;                         

#if SYSTEM_SUPPORT_OS                          

    reload=SYSCLK/8;                         

    reload*=1000000/delay_ostickspersec;     

                                                  

    fac_ms=1000/delay_ostickspersec;                

    SysTick->CTRL|=SysTick_CTRL_TICKINT_Msk;        

    SysTick->LOAD=reload;                          

        SysTick->CTRL|=SysTick_CTRL_ENABLE_Msk;        

#else 

    fac_ms=(u16)fac_us*1000;                 

#endif 

0 REPLIES 0