Skip to main content
Visitor II
June 22, 2024
Question

can i use systick timer for 1us without isr? If yes please provide example

  • June 22, 2024
  • 2 replies
  • 1239 views

Hello Team,

Want to use systick timer for time base of 1uS without interrupt. 

Please help me on this to configure it without interrupt.

 

Regards,

Sachin N

 

    This topic has been closed for replies.

    2 replies

    Super User
    June 22, 2024

    Hi,

    >can i use systick timer for 1us 

    No.

    (You can set it to 1us - yes, but you ask for "use" : so what you wanna "use" on a cpu, if your systick keeps cpu busy at almost 100% ?)

    You can set any timer to output a 1us PWM , no problem, but to do anything (like INT) at this rate is bad idea.

    nevase123Author
    Visitor II
    June 22, 2024

    I want to use 1uS systick timer for scheduler. Basically I want to do this without interrupt.

     

    Regards,

    Sachin N

    Super User
    June 22, 2024

    Oh, then try it. 

    Just - whats your core clock ? 48M ? So about 30...48 instructions can your cpu do here, but :

    how much time you need to switch tasks ? 12 clk for registers, then save task stack, and then have maybe 20 instructions , until next task switch comes....

    and how switching comes, without INT ? polling ????

    and what you expect to do with this then ? (Most time the cpu now busy with task switching, not much time for any program left.

    Graduate II
    June 22, 2024

    You really should talk to each other...

    https://community.st.com/t5/stm32-mcus-boards-and-hardware/systick-timer-configuration-in-microsecond-for-stm32c031c6-mcu/m-p/688843

     

    uint16_t start = TIM3->CNT; // Say 10 MHz count

    while((TIM3->CNT - start) < 10); // Wait ~1 us