-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP-IDF support without Arduino libraries #94
Comments
As I do not use esp-idf, could you please provide the compile error log ? |
../../../components/FastAccelStepper-master/src/StepperISR_esp32.cpp: In function 'void apply_command(StepperQueue*, const queue_entry*)': |
FYI I am using ESP-IDF 4.3.1 with VisualGDB. |
Have not checked situation for pcnt module |
I've made the necessary changes to make it compile with ESP-IDF 4.3.1 commit 3e370c4296. When running it I'm getting runtime errors that the watchdog was triggered. 18:10:52.787 -> V (2360) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args�[0m :12:28.304 -> �[0;31mE (7360) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:�[0m Stepping through the code I believe this is happening around the point IOMUX is connecting MCPWM module to PCNT module |
Your changes look good from reviewing your code. So here are some questions:
|
Could you please fork the repo and put your code in your repo ? |
I'm currently facing the same watchdog issue. I see this this TODO to disable interrupts in FastAccelStepperEngine::manageSteppers(). Could this have something to do with the issue? If this is related to the PCNT as @Jkallus mentioned, it could be why I'm seeing some drift when continuously rotating between two positions. |
@gagank1 Thanks for digging into this. The TODO was just a reminder to check this code again. Long time ago I had the interrupts disabled there, but the execution of that "agreement" code is pretty slow and not acceptable for high speed operation. So I have chosen to not disable the interrupts. Just that time I was not sure, if there could be a race condition between If you have a drift during continuously rotation and no watchdog reset, then I doubt any relation to the mentioned issue. In order to investigate the drift I would propose to use Another possibility would be to check, if your driver needs a delay on the direction pin. The current master overload
For the esp32 watchdog reset, this can have many causes. And without digging into the root cause, cannot decide if/how the FastAccelStepper need to change |
@gin66 Just to clarify, I am getting the same watchdog reset error, and also seeing slight drift during continuous rotation. I'll take a look at the rest of your comment when I have some more time. |
At first glance the drift might be caused by the direction pin delay. My driver (TMC2209) says it requires I hold dir for 20 ns before and after a full step pulse, so 40 ns in total. Seems small but maybe it's missing a step or two on either side and it's adding up. I'll try setting |
|
So what is the status on this? I've updated to the ESP32 Arduino implementation of IDF 4.4, and I'm running into the same issues during compilation. I do not see any of the proposed fixes on the Network Graph or on any forks. Can someone push their local version to a feature/fix branch? Or post a patch file? I can try to debug the watchdog issue, but I just want to be on the same page code-wise for the sake of clarity. |
Installing espressif using platformio No idea, how to install any 4.4 version with platformio. Any hint ? |
You can follow this guide here -- I am using the new arduino-esp32 package, version 2.0.1, which includes IDF version 4.4: https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html The version of the ESP32 Arduino package which generally comes with Arduino is quite old (v1.0.6) and is equivalent to 3.4, as you've found. Espressif has since changed the location/link allowing the Arduino software package to update the arduino-esp32 package via the Board Manager. This is the new link to paste into the Arduino preferences/settings. https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json Once you've done that, restart the Arduino software, uninstall the old esp32 arduino boards package (probably 1.0.6) from the Board Manager, and reinstall with the new 2.0.1 version. |
Thanks for the hint. Has worked with Arduino-IDE and I can see the compile errors. |
That I'm not sure about, but it would certainly be useful. |
I have started a branch New api is still broken though..... |
API is adapted (not perfect) and a deprecation warning is popping up for using |
Great, I'll test it soon! Was getting tired of the lower performance of FlexyStepper |
For the deprecation warning have filed an issue in the esp-idf github repository |
I used the master branch since it is ahead of the idf-4.4 branch, but everything seems to work great, excluding the deprecation warning. No watchdog warnings/panics. Thanks! |
@Jkallus Please check the branch espidf. I have modified it, that it compiles under platformio without arduino component. Just the MakeLists.txt in the root directory does not fit. I have copied the sources into the project directory for now as test |
@gin66 I have done more research since I opened the issue and I've realized I need a solution more like Marlin/GRBL for what I'm doing. I'm now trying FluidNC for my motion control problem. Thank you for the efforts in bringing this library to ESP-IDF. I hope to use it in the future for a more appropriate job. |
Is it possible to use this with ESP-IDF without the Arduino libraries? It seems the ESP32 implementation uses an API exposed in the arduino-esp32 library which is different from the main ESP-IDF interfaces for MCPWM and PCNT. When I tried compiling this in an ESP-IDF project that was using arduino-esp32 as a component it failed because of several "has no member" errors. When I looked at the structs that were the problem they were mostly in mcpwm_struct.h and the main ESP-IDF library has different names than the copy in arduino-esp32.
The text was updated successfully, but these errors were encountered: