Skip to content

arch/arm: Add necessary conversion between tick and usec in systick_interrupt#18457

Open
blta wants to merge 1 commit intoapache:masterfrom
blta:tickless_fix
Open

arch/arm: Add necessary conversion between tick and usec in systick_interrupt#18457
blta wants to merge 1 commit intoapache:masterfrom
blta:tickless_fix

Conversation

@blta
Copy link

@blta blta commented Feb 26, 2026

fix tickless issue

Summary

  • default tickless scheme with arm_systick.c don't works
  • we add necessary conversion between tick and usec in systick_interrupt
  • the local variable next_interval as the first parameter of low->callback , which unit is tick not usec,
    it seem that we must do conversion before and after calling

Impact

just fix tickless issue

Testing

We test this commit on our own platform:

hardware

  • cpu : cm55@armv8-m
  • systick clk: 1M

config

CONFIG_ARMV8_SYSTICK=y
CONFIG_PER_TICK=1000
CONFIG_RR_INTERVAL=5
CONFIG_SCHED_TICKLESS=y
CONFIG_SYSTEM_TIMER64=y
CONFIG_TIMER_ARCH=y

test code

we add some testing code about delay in our chip's xxx_bring_up stage

syslog(LOG_INFO, "per_tick: %d\n", USER_PER_TICK);
syslog(LOG_INFO, "delay begin: %lu\n", clock_get_sched_ticks());
usleep(1000000);
syslog(LOG_INFO, "delay 1s: %lu\n", clock_get_sched_ticks());
usleep(5000000);
syslog(LOG_INFO, "delay 5s: %lu\n", clock_get_sched_ticks());
usleep(10000000);
syslog(LOG_INFO, "delay 10s: %lu\n", clock_get_sched_ticks());

test result

master branch

....
# can' t run these test code , no logs

add commit

[19:22:20.959]收←◆per tick: 1000
delay begin: 322

[19:22:21.956]收←◆delay 1s: 1323

[19:22:26.944]收←◆delay 5s: 6324

[19:22:36.919]收←◆delay 10s: 16325

@jerpelea jerpelea changed the title arch/arm/src: Add necessary convertion between tick and usec in systick_interrupt arch/arm: Add necessary convertion between tick and usec in systick_interrupt Feb 26, 2026
jerpelea
jerpelea previously approved these changes Feb 26, 2026
@github-actions github-actions bot added Arch: arm Issues related to ARM (32-bit) architecture Size: S The size of the change in this PR is small labels Feb 26, 2026
@blta blta changed the title arch/arm: Add necessary convertion between tick and usec in systick_interrupt arch/arm: Add necessary conversion between tick and usec in systick_interrupt Feb 26, 2026
…less

When testing tickless scheme with default arm_systick.c, we found the
count writed to systick register is too smaller the expected, just the
ticks not count, and os runing abnormally with too much interrupter.
Add necessary coversion, then system run well.

Signed-off-by: taoliu <taoliu@asrmicro.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants