Skip to content
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

fix compile errors for SimpleFOC 2.3.1 #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

runger1101001
Copy link

If you're interested, this patch fixes the compile problems with SimpleFOC 2.3.1.

Of course, I don't have a smartknob myself so I can't test it out :-(

The errors are caused by an API change:

motor.initFOC() no longer takes the zero angle and direction as parameters. The semantics of that were very complicated and error-prone.

Now the zero_electrical_angle and sensor_direction can be set on the motor in advance of calling initFOC(), like all the other parameters.

If you don't set them, (or set them to NOT_SET, UNKOWN) then the initFOC() will run the calibration. If you provide them in advance, it will skip the calibration.

@scottbez1
Copy link
Owner

Thanks so much for sending! I want to do some testing of the platform update specifically -- previously I ran into odd scheduling/task delays on the newer platform for the regular ESP32 which caused the motor task to run unreasonably infrequently and hadn't had a chance to diagnose the root cause, so that's why that config has been pinned to an old platform (and therefore old FOC version for lib compatibility) 🫤

@scottbez1
Copy link
Owner

This works great on the S3 build (nanofoc env), but something about the platform update is causing crashes on the standard ESP32 build (view env). So some further investigation will be needed before this can be merged.

@FelixvanBeusekom
Copy link

Hi @scottbez1 and @runger1101001. The espressif32 platform update is causing crashes on the view environment. I spent my evening debugging where it comes from. Let me list the changes I made to the smartknob repo here (on top of the changes in this PR):

  • espressif32@6.7.0
  • askuric/Simple FOC@2.3.3
  • monitor_speed = 115200 (I had to lower the baud rate of the monitor. Not sure why, but it wouldn't work otherwise)
  • Removed -DSOC_GPIO_VALID_GPIO_MASK=0xFF0EFFFFFF and -DSOC_GPIO_VALID_OUTPUT_GPIO_MASK=0x30EFFFFFF
  • Finally, I spent hours on figuring out why I still got crashes. I traced it down to the ledcSetup() funciton in display_task.cpp. Turns out that it suddenly doesn't like high update frequencies anymore. I found that about 1200Hz is the maximum before the CPU crashes. I didn't investigate further, as I think an update rate of 1000Hz is plenty for the backlight of the display.

@runger1101001
Copy link
Author

So the new version of Espressif IDE and Arduino for ESP32 is not compatible with SimpleFOC 2.3.3.

Antun has re-written the drivers for MCPWM, LEDC PWM and current sensing to be compatible with the new framework version.

We have just merged the fixes to our dev branch, and the next release 2.3.4 will be compatible with the new version of IDF. Until that release you could test against the dev branch.

Note that this is a distinct topic to the one originally posted in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants