[Grbl_Esp32 Issue#14] Promising RTOS experiments

未分类 bolang 4个月前 (10-14) 38次浏览

Issue #14 | 状态: 已关闭 | 作者: bdring | 创建时间: 2018-08-03

标签: Discussion


I decided to give another look at using the RTOS better for step generation.

Since, the step generation seems very stable in the current form, I decided to try to transfer some of that code to an RTOS task. It still uses the interrupt for the timing, but virtually all the code in the interrupt is now in a task.

The priority (configMAX_PRIORITIES – 1) task is blocked with a semaphore and the interrupt unblocks it. The task calculates the next time the interrupt occurs. Right now almost everything appears to basically work, except it sounds a little different. I have not profiled an entire job or compared the steps on a logic analyzer. I have run a few complete jobs though.

The one thing I know that does not work is homing. An unhandled exception occurs when it touches the switch. I have not looked into it yet. I have not tried using the RMT feature yet.

I am not sure why I had trouble before. I think I was trying too many new things at once and was not starting with a stable base of code.


评论 (2)

#1 – bdring 于 2018-08-03

I have added the RMT and it sort of works. I get random stoppages during longs jobs and often during homing. I need to check if running the main Grbl task and the stepper task at the same time could cause a race condition.


#2 – bdring 于 2018-08-04

I fixed the stoppage and homing problems by moving the calculation code back to the interrupt. The interrupt unblocks a task to set the direction and steps (via RMT) it then completes the calculations.

This likely prevents any race issues, because only the interrupt is running, like AVR Grbl.


原始Issue: https://github.com/bdring/Grbl_Esp32/issues/14

喜欢 (0)