cancel
Showing results for 
Search instead for 
Did you mean: 

L6470 initialization

Vitek
Associate

Hello,

I am trying to control L6470 mounted on IHM02A1. I downloaded the example software (https://www.st.com/content/st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-spn2.html#overview) and tried it and it worked. Now I would like to simplyfy it (for the beginnig) so that it would be easier to understand it. I succesfully moved motor by few steps with using these lines in example program:

uint8_t movetx[4] = {0b01000001, 0b00000000, 0b11111111, 0b11111111};

 for (int i = 0; i < 4; i++){

 //pin low

 HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);

 //send bytes

 HAL_SPI_Transmit(&HSPI, (uint8_t*)&movetx[i], 1, 10);

 //pin high

 HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET);

 //delay

 HAL_Delay(10);

 }

Unfortunately when I made a new program and used same lines, motor didn't move at all. I initialized SPI, but I think I also need to initialize the L6470. In example program it is made with function BSP_Init() , but it is quite complex function.

Can I initialize L6470 in some easier way? For example by sending some initializing message like I sent to move motor by few steps using function HAL_SPI_Transmit?

Have a good day

0 REPLIES 0