MotorDriver / L6474

Stepper motor driver library for Arduino Uno using X-NUCLEO-IHM01A1 shield (based on L6474 component)
10 stars 7 forks source link

Code testing #2

Closed zz-zsys closed 9 years ago

zz-zsys commented 9 years ago

Hi Michel,

First of all, I would to thank you for the wonderful codes and the libraries that you wrote. It is very impressing. For my project I'm using the X-NUCLEO-IHM01A1 motor control board to control my stepper motor from igus. The website about this motor can be found here:

http://www.igus.eu/wpck/7663/N11_6_14_2_Schrittmotor_NEMA23?C=DE&L=en

I'm using the Arduino Mega 2560 for this project. Before furthering my project I would like to test the motor by using the sketchbook example for one motor that has been provided by you. The problem is after I uploading the code, the motor won't rotate. The red and green LED from the X-NUCLEO-IHM01A1 are on. Here is my electrical setting for the motor.

Voltage from power supply : 24 V Current from power supply : 3 A

I'm not really sure if the problem due to the software part or hardware part right now. Perhaps you could give some idea. Thanks!

Michel-F commented 9 years ago

Hi zubairzulkifli, The problem is probably due to the fact that the library is written for the Arduino Uno only. If you want to use it on the Mega 2560, you will need to make some adaptations of the functions which handle the PWMs. These functions are L6474::PwmInit, L6474::Pwm1SetFreq, L6474::Pwm2SetFreq and L6474::Pwm3SetFreq, L6474::PwmStop and their relative ISR in file L6474.cpp.

zz-zsys commented 9 years ago

Thanks Michel!

If I just want to drive one motor only, basically I didn't even need to change the function that needed to drive the motor right? Because the interrupt and the function that handle the PWM are still the same like the UNO. All I need to adjust is just connecting the right SPI pins (which is different from UNO).

Could you maybe give some examples from one of the functions that you meant ( e.g. PwmInit) that I should adapt for my Arduino MEGA 2560?

Thanks again!

zz-zsys commented 9 years ago

I have try connecting the Motor Driver Board with Arduino MEGA 2560 via wire (instead of connecting it above the arduino board. And the change the pwm1 pin from 9 to 11 (timer1 is connected to pin 11) and it works.