You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The deal is to pass realtime steps and directions To 2nd Second which manage to control dc motors through quadratures encoders without interrupting the flow of the hal which seems to work , if anyone is interested.
Here What i Came with :
-Board Name commented use default generic_map.h
In file drivers.c we don't need anymore to output hardware steps and directions ,we just rederict them to second core of RP2040 ;
// step_dir_sr4_write(pio0, 0, sd_sr.value); //comment line
if (multicore_fifo_wready)multicore_fifo_push_blocking(sd_sr.value);//added line
//pushes content of shit register updated in realtime with all axes steps and directions data
also add #include "pico/multicore.h"
we don't need anymore pio0 for steps and directions since we need them to read quadratures encoders:
while(multicore_fifo_rvalid()) {
value = multicore_fifo_pop_blocking();//get steps and directions information
//do mask to filter each step direction for every axis
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi Every One
The deal is to pass realtime steps and directions To 2nd Second which manage to control dc motors through quadratures encoders without interrupting the flow of the hal which seems to work , if anyone is interested.
Here What i Came with :
-Board Name commented use default generic_map.h
// step_dir_sr4_write(pio0, 0, sd_sr.value); //comment line
if (multicore_fifo_wready)multicore_fifo_push_blocking(sd_sr.value);//added line
//pushes content of shit register updated in realtime with all axes steps and directions data
also add #include "pico/multicore.h"
we don't need anymore pio0 for steps and directions since we need them to read quadratures encoders:
comment this lines
#elif STEP_PORT == GPIO_SR8
#endif
and no delay and length is needed for pulses:
#if SD_SHIFT_REGISTER
pio_steps.length = (uint32_t)(10.0f * (settings->steppers.pulse_microseconds - 0.8f));
pio_steps.delay = settings->steppers.pulse_delay_microseconds <= 0.8f
? 2
: (uint32_t)(10.0f * (settings->steppers.pulse_delay_microseconds - 0.8f));
comment this lines
// sr_delay_set(pio0, 1, pio_steps.delay);//comment line
// sr_hold_set(pio0, 2, pio_steps.length);//comment line
#endif
in main.c in grblhal add
#include "pico/multicore.h"
void core1_entry()
{
servo();//main for motor control
}
void main ()
{
multicore_launch_core1(core1_entry);
// Wait for it to start up
sleep_ms(400);
grbl_enter();
}
and in main for motor control we just attach interrupt if data from fifo is ready to get data for axes
//servo.c file
void main (){
)
void core1_irq_handler() {
while(multicore_fifo_rvalid()) {
value = multicore_fifo_pop_blocking();//get steps and directions information
//do mask to filter each step direction for every axis
}
}
Feedback is Welcome .
https://youtu.be/WV12ZgEccNY
Beta Was this translation helpful? Give feedback.
All reactions