Solution was to NOT do the steps in the IRQ. Set a flag and do pulses outside of the irq.
This commit is contained in:
@@ -17,7 +17,7 @@ debug_tool = stlink
|
|||||||
debug_build_flags = -O0 -g -ggdb
|
debug_build_flags = -O0 -g -ggdb
|
||||||
monitor_port = COM7
|
monitor_port = COM7
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
build_flags = -O0 -Wl,--no-warn-rwx-segment
|
build_flags = -O0 -g -Wl,--no-warn-rwx-segment
|
||||||
lib_deps =
|
lib_deps =
|
||||||
SPI
|
SPI
|
||||||
rlogiacco/CircularBuffer@^1.3.3
|
rlogiacco/CircularBuffer@^1.3.3
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ void cb_set_outputs(void) // Master outputs gets here, slave inputs, first opera
|
|||||||
byte forwardDirection = 0; // 1 if going forward
|
byte forwardDirection = 0; // 1 if going forward
|
||||||
int32_t pulsesToGo = 1000 * (requestedPosition - actualPosition);
|
int32_t pulsesToGo = 1000 * (requestedPosition - actualPosition);
|
||||||
if (pulsesToGo != 0)
|
if (pulsesToGo != 0)
|
||||||
makePulses(500, 1); // Make the pulses using hardware timer
|
makePulses(900, abs(pulsesToGo)); // Make the pulses using hardware timer
|
||||||
|
|
||||||
// digitalWrite(STEPPER_DIR_PIN, HIGH); // I think one should really wait a bit when changed
|
// digitalWrite(STEPPER_DIR_PIN, HIGH); // I think one should really wait a bit when changed
|
||||||
|
|
||||||
@@ -166,10 +166,16 @@ void setup(void)
|
|||||||
|
|
||||||
ecat_slv_init(&config);
|
ecat_slv_init(&config);
|
||||||
}
|
}
|
||||||
|
volatile byte serveIRQ=0;
|
||||||
void loop(void)
|
void loop(void)
|
||||||
{
|
{
|
||||||
ESCvar.PrevTime = ESCvar.Time;
|
ESCvar.PrevTime = ESCvar.Time;
|
||||||
|
if (serveIRQ)
|
||||||
|
{
|
||||||
|
DIG_process(DIG_PROCESS_WD_FLAG | DIG_PROCESS_OUTPUTS_FLAG |
|
||||||
|
DIG_PROCESS_APP_HOOK_FLAG | DIG_PROCESS_INPUTS_FLAG);
|
||||||
|
serveIRQ = 0;
|
||||||
|
}
|
||||||
ecat_slv_poll();
|
ecat_slv_poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,8 +212,7 @@ void indexPulse(void)
|
|||||||
|
|
||||||
void sync0Handler(void)
|
void sync0Handler(void)
|
||||||
{
|
{
|
||||||
DIG_process(DIG_PROCESS_WD_FLAG | DIG_PROCESS_OUTPUTS_FLAG |
|
serveIRQ=1;
|
||||||
DIG_PROCESS_APP_HOOK_FLAG | DIG_PROCESS_INPUTS_FLAG);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleStepper(void)
|
void handleStepper(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user