Skip to content

Problem with repeating timer in SDK2.1.0 #2118

@richard9999999999

Description

@richard9999999999

Hello,
I am experiencing a problem with repeating timer in SDK 2.1.0 (I haven't seen it in SDK 1.x.x before). The problem seems happen only when timer callback function is "light" (I mean doesn't contain too much of processing):

repeating_timer_t my_sampling_timer;

bool my_timer_callback(repeating_timer_t *rt)
{
	//volatile int tmp = 0;
	//for(int i=0; i <10000; i++)
	//{
	//	tmp++;
	//}
	
	return true;
}

int main()
{	
	alarm_pool_t *pool = alarm_pool_create(2, 1);	
	alarm_pool_add_repeating_timer_ms(pool, -20, my_timer_callback, NULL, &my_sampling_timer);

	while(1)
	{
		printf("looping\n");
	}
}

If the code is as above, the callback is called only few times. If I uncomment commented part in the callback (to make functionality to spend some more time in callback), the callback is called still during main looping (as desired).
The problem happens in the RELEASE build only.
I use GCC 10.3.1 (not sure if related, probably not)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions