Showing results for 
Search instead for 
Did you mean: 

Battery affecting program execution for stepper motor driver on nucleo board

Associate II

Using a Nucleo f401re nucleo board with a 'X-NUCLEO-IHM03A1' shield that houses a powerSTEP01 stepper motor driver. I've downloaded and run the example projects from 'X-CUBE-SPN3' by ST and the stepper motor runs perfectly. I then generated my own projected with CUBEMX and imported all the driver header and source files in this project. All peripherals are initialized correctly and the physical wiring connections havent changed.

When i run the project, the motor doesnt move and upon debugging line by line, program execution pauses forever after setting the 'X-NUCLEO-IHM03A1' reset pin high. This only happens when the battery (3S LiPo) is connected to Vin, When there is no battery program execution runs fine (using a logic analyzer i can see all SPI signals sending through correctly) but obviously the motor wont run.

Below is the function to initialize the peripherals and stepper motor driver that gets called in main.c

void Powerstep01_Init(void* pInit)
  /* Initialise the GPIOs of the just added device */
  if(Powerstep01_Board_SpiInit() != 0)
    /* Initialization Error */
  /* configure the step clock */
  /* Standby-reset deactivation */
  /* Let a delay after reset */
  if (pInit == 0)
    // Set all registers to their predefined values from powerstep01_target_config.h 

After Line 16, the program will get stuck on Line 20 forever. Powerstep01_Board_ReleaseReset(powerstep01DriverInstance) just sets the reset pin high:

void Powerstep01_Board_ReleaseReset(uint8_t deviceId)

I have no idea how the battery is affecting program execution, as everything works in the original example project and motor runs (both projects have the same main.c).

What could be any possible causes?

I can send the project files through if necessary.