How to manually move stepper motor with IHM02A1?

What are you developing?
Post Reply
loarri
Posts: 7
Joined: Wed Aug 03, 2022 1:28 pm
Location: Italy
Contact:

How to manually move stepper motor with IHM02A1?

Post by loarri »

Hello guys,

could you please help me about an issue I have?

I'd need to move a stepper motor simply through a push button, using an F401RE and the expansion board X-NUCLEO-IHM02A1
but it doesn't work and I don't know why ... :-(
The code I'm using is coming from the official demo present in the stm32duino and it seems all ok (for me) but motor doesn't work :-(

Code: Select all

void setup()
{
    /*----- Initialization. -----*/

    /* Initializing SPI bus. */
    dev_spi = new SPIClass(D11, D12, D3);
    SerialPort.begin(115200);

    /* Initializing Motor Control Expansion Board. */
    x_nucleo_ihm02a1 = new XNucleoIHM02A1(&L6470_init[0], &L6470_init[1], A4, A5, D4, A2, dev_spi);

    /* Building a list of motor control components. */
    motors = x_nucleo_ihm02a1->get_components();

 // init manual motor
  pinMode(UP_PIN, INPUT); //Set buzzerPin as output  
    SerialPort.println("Start demo ...");
}


void loop() {
   L6470_init[0].step_sel = StepperMotor::STEP_MODE_FULL;
    if (!motors[0]->set_step_mode((StepperMotor::step_mode_t) L6470_init[0].step_sel)) {
        SerialPort.print("    Step Mode not allowed.\r\n");
    }

      // manual motor move
    buttonUpState = digitalRead(UP_PIN);

    if (buttonUpState==HIGH) {
          motors[0]->prepare_run(StepperMotor::FWD,400);
          SerialPort.println(" --->>> move!");      
     } else {
       //stop
       for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
         motors[m]->prepare_soft_hiz();
       }
    }

    x_nucleo_ihm02a1->perform_prepared_actions(); 
}


Could someone help me please?
Where is the error?:-(

I'm wasting a lot of time on this thing and I don't understand why it doesn't work :-(

Thanks and bye
Lorenzo
Many thanks for your help !!!!!! really thanks!
Hello I am an electronics enthusiast and I always like to experiment with new circuits :D
loarri
Posts: 7
Joined: Wed Aug 03, 2022 1:28 pm
Location: Italy
Contact:

Re: How to manually move stepper motor with IHM02A1?

Post by loarri »

hello all
I solved.
the issue is due to the fact that we're oblige to specify the command that we want to give for all the motors in the chain even if only one is used!



motors[0]->prepare_run(StepperMotor::BWD, 400);
motors[1]->prepare_run(StepperMotor::BWD, 400);

regards
Lorenzo
Hello I am an electronics enthusiast and I always like to experiment with new circuits :D
Post Reply

Return to “Projects”