AnsweredAssumed Answered

STM32F100RBT6B l293d 28byj-48

Question asked by pereguda.anton on Aug 29, 2016
Latest reply on Aug 31, 2016 by Dowell.Sherman
Hello i am trying to launch simple stepper (28byj-48) using l293d.

Connecting 28byj-48 to the L293D:
Engine contact 1 is connected to the output 1.
Engine contact 3 is connected to the output 2.
Engine contact 4 is connected to the output 3.
Engine contact 2 is connected to the output 4.

Connecting STM32 to the L293D:
PC1 is connected to input 1.
PC3 is connected to the input 2.
PC5 is connected to the input 3.
PC7 is connected to the input 4.

Enable 1, Enable 2 , Vs, Vss connected to  5v.

As a result, i hear some noise from motor but it do not spin. Dear forum users tell me what am I doing wrong? Thank you.
#include "stm32f10x.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_rcc.h"
void Delay(unsigned int t)
{
unsigned int i;
for (i=0;i<t;i++);
}
void GPIOD_Initialize(){
GPIO_InitTypeDef GPIOC_Stepper;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
GPIOC_Stepper.GPIO_Pin=GPIO_Pin_1|GPIO_Pin_3|GPIO_Pin_5|GPIO_Pin_7;
GPIOC_Stepper.GPIO_Mode=GPIO_Mode_Out_PP;
GPIOC_Stepper.GPIO_Speed= GPIO_Speed_50MHz;
GPIO_Init(GPIOC,&GPIOC_Stepper);
}
 
int main(void)
{
GPIOD_Initialize();
         while(1)
         {
         GPIO_Write(GPIOC,GPIO_Pin_1);
         Delay(100);
         GPIO_Write(GPIOC,GPIO_Pin_1| GPIO_Pin_3);
         Delay(100);
         GPIO_Write(GPIOC,GPIO_Pin_3);
         Delay(100);
         GPIO_Write(GPIOC,GPIO_Pin_5|GPIO_Pin_3);
         Delay(100);
         GPIO_Write(GPIOC,GPIO_Pin_5);
         Delay(100);
         GPIO_Write(GPIOC,GPIO_Pin_5|GPIO_Pin_7);
         Delay(100);
         GPIO_Write(GPIOC,GPIO_Pin_7);
         Delay(100);
         GPIO_Write(GPIOC,GPIO_Pin_7|GPIO_Pin_1);
         Delay(100);
         }
}

Outcomes