Step and direction mode does not work

Hello comrades. I had not yet finished with the design of my steering wheel, as there was a wild desire to build a mobile platform. Today I tried a sketch from the example of step direction, for signaling I use the second arduino board. The pulses are applied every 100 microseconds, but the motor does not rotate. Please tell me, what am I doing wrong? By the way, my wife is very glad that I found you guys)))

/**
 * A position control example using step/dir interface to update the motor position
 */

#include <SimpleFOC.h>

// BLDC motor & driver instance
BLDCMotor motor = BLDCMotor(7);
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 10, 11, 8);

// Stepper motor & driver instance
//StepperMotor motor = StepperMotor(50);
//StepperDriver4PWM driver = StepperDriver4PWM(9, 5, 10, 6,  8);

// encoder instance
Encoder encoder = Encoder(2, 3, 1024);
// channel A and B callbacks
void doA() { encoder.handleA(); }
void doB() { encoder.handleB(); }

// StepDirListener( step_pin, dir_pin, counter_to_value)
StepDirListener step_dir = StepDirListener(A4, A5, 2.0f*_PI/200.0);
void onStep() { step_dir.handle(); }

void setup() {

  // initialize encoder sensor hardware
  encoder.init();
  encoder.enableInterrupts(doA, doB);
  // link the motor to the sensor
  motor.linkSensor(&encoder);

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 12;
  driver.init();
  // link the motor and the driver
  motor.linkDriver(&driver);

  // aligning voltage [V]
  motor.voltage_sensor_align = 3;
  // index search velocity [rad/s]
  motor.velocity_index_search = 3;

  // set motion control loop to be used
  motor.controller = MotionControlType::angle;

  // contoller configuration
  // default parameters in defaults.h
  // velocity PI controller parameters
  motor.PID_velocity.P = 0.2f;
  motor.PID_velocity.I = 5;
  motor.PID_velocity.D = 0;
  // default voltage_power_supply
  motor.voltage_limit = 5;
  // jerk control using voltage voltage ramp
  // default value is 300 volts per sec  ~ 0.3V per millisecond
  motor.PID_velocity.output_ramp = 1000;

  // velocity low pass filtering time constant
  motor.LPF_velocity.Tf = 0.01f;

  // angle P controller
  motor.P_angle.P = 10;
  //  maximal velocity of the position control
  motor.velocity_limit = 100;

  // use monitoring with serial
  Serial.begin(115200);
  // comment out if not needed
  motor.useMonitoring(Serial);

  // initialize motor
  motor.init();
  // align encoder and start FOC
  motor.initFOC();

  // init step and dir pins
  step_dir.init();
  // enable interrupts
  step_dir.enableInterrupt(onStep);
  // attach the variable to be updated on each step (optional)
  // the same can be done asynchronously by caling motor.move(step_dir.getValue());
  step_dir.attach(&motor.target);

  Serial.println(F("Motor ready."));
  Serial.println(F("Listening to step/dir commands!"));
  _delay(1000);
}

void loop() {

  // main FOC algorithm function
  motor.loopFOC();

  // Motion control function
  motor.move(step_dir.getValue());
}

bool _bounseInputD7S = 0;
bool _bounseInputD7O = 0;
unsigned long _bounseInputD7P = 0UL;
bool _gen1I = 0;
bool _gen1O = 0;
unsigned long _gen1P = 0UL;
void setup()
{
    pinMode(7, INPUT_PULLUP);
    pinMode(4, OUTPUT);
    digitalWrite(4, 0);
    pinMode(5, OUTPUT);
    digitalWrite(5, 0);
    _bounseInputD7O =  digitalRead(7);
}
void loop()
{
    bool  _bounceInputTmpD7 =  (digitalRead (7));
    if (_bounseInputD7S)
    {
        if (millis() >= (_bounseInputD7P + 40))
        {
            _bounseInputD7O= _bounceInputTmpD7;
            _bounseInputD7S=0;
        }
    }
    else
    {
        if (_bounceInputTmpD7 != _bounseInputD7O)
        {
            _bounseInputD7S=1;
            _bounseInputD7P = millis();
        }
    }
    //Плата:1
    if (!(0)) 
    {
         if (! _gen1I) 
        {
            _gen1I = 1;
            _gen1O = 1;
            _gen1P = millis();
        }
    }
     else 
    {
        _gen1I = 0 ;
        _gen1O= 0;
    }
    if (_gen1I) 
    {
          if (_isTimer (_gen1P , 100)) 
        {
             _gen1P = millis();
            _gen1O = ! _gen1O;
        }
    }
    digitalWrite(5, _gen1O);
    digitalWrite(4, !(_bounseInputD7O));
}
bool _isTimer(unsigned long startTime, unsigned long period)
{
    unsigned long currentTime;
    currentTime = millis();
    if (currentTime>= startTime) 
    {
        return (currentTime>=(startTime + period));
    }
     else 
    {
        return (currentTime >=(4294967295-startTime+period));
    }
}

this is the code that runs on the second arduino board

I had the same problem, the code didnt work with short pulses (in my case 3D printer board).
Longer pulse lenght was the solution in my case.
The firmware of my board (marlin) has the option to generate a pulse signal with 50% duty cycle,
after changing that it worked like a charm. :wink:

Maybe the Arduino A4 and A5 pins are not suitable for this?