Tool/software:
Hi,
i am using a motor driver(DRV8243 IC) for driver a motor.
i am using a CC2340 microcontroller(Operating voltage 3.3V) to drive the DRV8243(we are giving 12v for motor).
so, i have made a code to operate this motor but it is not working. i have checked it using multimeter but it is showing zero. Also, i have checked all the GPIO voltage level and it is working fine.
i am sharing the schematic and code for your reference please help me for this.
void Gpio_init(void)
{
GPIO_write(CONFIG_GPIO_2_SLEEP_N,LOW);
GPIO_write(CONFIG_GPIO_0_DRVOFF, LOW);
GPIO_write(CONFIG_GPIO_1_PH_IN2, LOW);
GPIO_write(CONFIG_GPIO_3_EN_IN1, LOW);
}
void Hal_motor_lock(void)
{
GPIO_write(CONFIG_GPIO_2_SLEEP_N,LOW);
usleep(30);
GPIO_write(CONFIG_GPIO_2_SLEEP_N,HIGH);//
//while(GPIO_read( CONFIG_GPIO_5_FAULT_N)==1);
GPIO_write(CONFIG_GPIO_0_DRVOFF,LOW);
GPIO_write(CONFIG_GPIO_3_EN_IN1, LOW);
GPIO_write(CONFIG_GPIO_1_PH_IN2, HIGH);
}
void Hal_motor_unlock(void)
{
GPIO_write(CONFIG_GPIO_2_SLEEP_N,LOW);
usleep(65000);
GPIO_write(CONFIG_GPIO_2_SLEEP_N,HIGH);
//while(GPIO_read( CONFIG_GPIO_5_FAULT_N)==1);
GPIO_write(CONFIG_GPIO_0_DRVOFF,LOW);
GPIO_write(CONFIG_GPIO_3_EN_IN1, HIGH);
GPIO_write(CONFIG_GPIO_1_PH_IN2, LOW);
}
void motor_normal(void)
{
GPIO_write(CONFIG_GPIO_2_SLEEP_N,LOW);
usleep(30);
GPIO_write(CONFIG_GPIO_2_SLEEP_N,HIGH);
GPIO_write(CONFIG_GPIO_0_DRVOFF,HIGH);
GPIO_write(CONFIG_GPIO_3_EN_IN1, LOW);
GPIO_write(CONFIG_GPIO_1_PH_IN2, HIGH);
}
void vTask1Function(void *ptr)//this is the call function
{
Gpio_init();
for(;;)
{
Hal_motor_lock();
vTaskDelay(pdMS_TO_TICKS(100));
motor_normal();
vTaskDelay(pdMS_TO_TICKS(1000));
Hal_motor_unlock();
vTaskDelay(pdMS_TO_TICKS(100));
motor_normal();
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
schematic of motor Driver
Thanks & Regards
Ratan Dalei