4 years, 11 months ago.

is there anything to work with NUCLEO F4411RE and X-NUCLEO_IHM01A1 (stepper motor driver) ?

Hello guys could you tell me if there is something available for mbed compiler working with X-NUCLEO_IHM01A1 board? I'd like to use it with my nucleo F411RE but I don't find resources for mbed :-(

could you tell me more on it please?

Many thanks for your help! Lorenzo

1 Answer

4 years, 11 months ago.

Hello Lorenzo,

I am working on a Easyspin library for a personal project: https://developer.mbed.org/teams/Robotique-FIP/code/Easyspin_lib/. The lib is working but is still under construction.

I used an arduino library and changed GPIO, SPI and interrupt management according to mbed layer: https://github.com/MotorDriver/L6474.

Here is a typical main to use the library with two IHM01A1 shields:

include the mbed library with this snippet

#include "easyspin.h"
#include "mbed.h"

Easyspin myEasyspin;

Serial pc(SERIAL_TX, SERIAL_RX);

void MyFlagInterruptHandler(void);

int main()
{
    /* Start the Easyspin library to use 2 shields x-NUCLEO-IHM01A1 */
    /* The Easyspins registers are set with the predefined values */
    /* from file Easyspin_target_config.h*/
    myEasyspin.Begin(2);

    /* Attach the function MyFlagInterruptHandler (defined below) to the flag interrupt */
    myEasyspin.AttachFlagInterrupt(MyFlagInterruptHandler);

    /* Set Current position to be the home position for shield 0 */
    myEasyspin.SetHome(0);

    /* Set Current position to be the home position for shield 1 */
    myEasyspin.SetHome(1);

    while(1) {
        myEasyspin.Move(0, FORWARD, 10000);
        myEasyspin.Move(1, BACKWARD, 10000);
        myEasyspin.WaitWhileActive(0);
        myEasyspin.WaitWhileActive(1);
        wait_ms(100);
        myEasyspin.Move(1, FORWARD, 10000);
        myEasyspin.Move(0, BACKWARD, 10000);
        myEasyspin.WaitWhileActive(0);
        myEasyspin.WaitWhileActive(1);
        wait_ms(100);
    }
}

void MyFlagInterruptHandler(void)
{
    /* Get status of device 0 */
    /* this will clear the flags */
    uint16_t statusRegister = myEasyspin.CmdGetStatus(0);
    pc.printf("cmd1 =  %d;", statusRegister);
    /* Get status of device 1 */
    /* this will clear the flags */
    statusRegister = myEasyspin.CmdGetStatus(1);
    pc.printf("cmd2 =  %d;", statusRegister);
}

Hope it helps,

Julien

That's gooooooddd!!! May thanks forse yuor help! Sure i'll tray Soon It And Then i'll give you My feedback! I'm allo look in formato a p.i.d. example Is Three something , il you know, Done in mbed for It.?could you help me? My Dreams IS To building a seegway clone! :-) thanks And bye Lorenzo

posted by Lorenzo Arrigoni 26 Aug 2015

There are some PID examples on Mbed. The library I am working on uses speed profiles. You can find all those parameters in the "easyspin_config.h" (min speed, max speed, acceleration, decceleration and motors parameters). Note that, to stack two shields, you have to change some 0 ohm jumpers on the boards.

It is explained at the end of this document: http://www.st.com/st-web-ui/static/active/en/resource/sales_and_marketing/presentation/product_presentation/X-NUCLEO-IHM01A1_Quick_Start_Guide.pdf

Julien

posted by Julien Tiron 27 Aug 2015