Hi,
I have some stepper motors with “dumb” driver HW, meaning I have to connect it to 4 GPIO pins (1 GPIO pin = 1 motor coil) and set “1” on them in proper order to turn the motor.
Problem is that using standard async task schedulling doesn’t allow for high enough frequency (motor turns slowly) and also it isn’t very precise, so movement is not smooth.
Is it possible to use timer interrupt for this without breaking other SDK functionality?
the SDK does not have support for fast periodic callbacks but I found nice hack.
There is a function HAL_SYSTICK_Callback which is not used and it is weak. Which means that you can override that function (which is empty in SDK) with your own.
The second thing to do is disable periodic sleep of the Core Module and enable PLL by calling bc_system_pll_enable(). Without this you get those irregularities.
I did a test and I have a function which is precisely called 1000 times per second and outputting 500 Hz signal.