Open BreederBai opened 1 year ago
所以这个也会和用户的timer定时器会执行什么超时函数相关
大部分执行的是_thread_timeout函数,调用rt_thread_mdelay函数,超时后是会执行_thread_timeout吗?
所以这个和用户的定时器计时器会执行什么相关的超时函数
熊大,这个问题即使和用户定时器执行的超时函数有关,似乎也不应该在关中断里执行用户的超时程序
我也查到t->timeout_func(t->parameter);这个函数了,但是我最小系统,这里是哪个定时器的影响呢,我本身没开任何定时器啊。
主定时器的话超时函数就是_thread_timeout,应该就是t->timeout_func(t->parameter);对应的函数,这个会运行8.6us大概(加上我控制io的时间),我是GD32, 然后rt_schedule会运行4us左右, rt_thread_sleep里也会运行将近9us,里面耗时的就是 err = rt_thread_suspend_with_flag(thread, RT_INTERRUPTIBLE);//4.6us
rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &tick); rt_timer_start(&(thread->thread_timer));//4.7us
再往下我也找不到具体源头了,就我现在这个代码 加上io控制,已经几乎30+us不开中断了,每个时间段都有10us左右,打5折总delay也得15us
我也查到t->timeout_func(t->parameter);这个函数了,但是我最小系统,这里是哪个定时器的影响呢,我本身没开任何定时器啊。
有可能是线程的定时器吧
我也查到t->timeout_func(t->parameter);这个函数了,但是我最小系统,这里是哪个定时器的影响呢,我本身没开任何定时器啊。
有可能是线程的定时器吧
应该是了,线程对应的定时器。这个东西是挺耗时间的
芯片:HC32F4A0 问题描述:定时器捕获时发现中断响应有时会延时20多us,单步调试发现是由于rt_timer_check函数长时间关中断造成的。 0通道:捕获信号;1通道:测试用的IO,在捕获中断(上升沿)函数中反转电平;2通道:rt_timer_check函数,在关中断和开中断时反转电平
测试二: 修改rt_timer_check函数(更改开关中断位置、更改反转电平位置)再次测试。 0通道:捕获信号;1通道:测试用的IO,在捕获中断(上升沿)函数中反转电平;2通道:rt_timer_check函数,在执行
t->timeout_func(t->parameter);
时反转电平通过下图可以看出
t->timeout_func(t->parameter);
函数耗时1.37us~2.35us,且执行多个。更改后不再影响中断响应。修改后的代码只是为了验证题目所说的内容,在HC32F4A0上可以正常运行,但并没有严格测试是否会影响内核其他功能。