Portenta Machine Control Stepper Driver

I'm having trouble using the Portenta machine control to drive my stepper motors. Is there any way to write to a microstep driver and write it? I've tried every variation of the code, including avoiding the <Arduino_MachineControl.h> Library to try and make it run faster. Here is my code so far:

#include <Arduino.h> // Only needed by https://platformio.org/


void setup() {
   pinMode(PI_6, OUTPUT);  // Direction
   pinMode(PH_9, OUTPUT);  // Step
   digitalWrite(PI_6, LOW);  // pick a direction
}

void loop() {


    digitalWrite(PH_9, HIGH); 
    delayMicroseconds(200); 

    digitalWrite(PH_9, LOW);
    delayMicroseconds(200);       

}

Extremely simple to run it and it won't work. Do you guys have any suggestions?

Could you measure the actual width of the pulses with an oscilloscope?
The digitalWrite() function might be too long to execute with the Arduino + mbed + ST HAL overhead.
Using ST HAL directly (HAL_GPIO_WritePin()) might be faster.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.