How to Test TB6612FNG

Hi,

I have a TB6612FNG, it used to work, but now motor connected to BO1 and BO2 is not spinning

How can I troubleshoot the problem.

As part of troubleshooting, I swapped motorA and motorB pins, but still didnt work. Please help

//const int pinMotorA[3] = { pinPWMA, pinAIN2, pinAIN1 };
//const int pinMotorB[3] = { pinPWMB, pinBIN2, pinBIN1 };
const int pinMotorB[3] = { pinPWMA, pinAIN2, pinAIN1 };
const int pinMotorA[3] = { pinPWMB, pinBIN2, pinBIN1 };

Is there a way to identify issue with TB6612FNG using multimeter or so ?

const int pinPWMA = 3;
const int pinAIN2 = 4;
const int pinAIN1 = 5;
const int pinBIN1 = 6;//7;
const int pinBIN2 = 7;//8;
const int pinPWMB = 8;//6;
const int pinSTBY = 9;
 
const int waitTime = 2000;   //espera entre fases
const int speed = 200;      //velocidad de giro
 
//const int pinMotorA[3] = { pinPWMA, pinAIN2, pinAIN1 };
//const int pinMotorB[3] = { pinPWMB, pinBIN2, pinBIN1 };
const int pinMotorB[3] = { pinPWMA, pinAIN2, pinAIN1 };
const int pinMotorA[3] = { pinPWMB, pinBIN2, pinBIN1 };
 
enum moveDirection {
   forward,
   backward
};
 
enum turnDirection {
   clockwise,
   counterClockwise
};
 
void setup()
{
   pinMode(pinAIN2, OUTPUT);
   pinMode(pinAIN1, OUTPUT);
   pinMode(pinPWMA, OUTPUT);
   pinMode(pinBIN1, OUTPUT);
   pinMode(pinBIN2, OUTPUT);
   pinMode(pinPWMB, OUTPUT);
}
 
void loop()
{
   enableMotors();
   move(forward, 180);
   delay(waitTime);
 
   move(backward, 180);
   delay(waitTime);
 
   turn(clockwise, 180);
   delay(waitTime);
 
   turn(counterClockwise, 180);
   delay(waitTime);
 
   fullStop();
   delay(waitTime);
}
 
//Funciones que controlan el vehiculo
void move(int direction, int speed)
{
   if (direction == forward)
   {
      moveMotorForward(pinMotorA, speed);
      moveMotorForward(pinMotorB, speed);
   }
   else
   {
      moveMotorBackward(pinMotorA, speed);
      moveMotorBackward(pinMotorB, speed);
   }
}
 
void turn(int direction, int speed)
{
   if (direction == forward)
   {
      moveMotorForward(pinMotorA, speed);
      moveMotorBackward(pinMotorB, speed);
   }
   else
   {
      moveMotorBackward(pinMotorA, speed);
      moveMotorForward(pinMotorB, speed);
   }
}
 
void fullStop()
{
   disableMotors();
   stopMotor(pinMotorA);
   stopMotor(pinMotorB);
}
 
//Funciones que controlan los motores
void moveMotorForward(const int pinMotor[3], int speed)
{
   digitalWrite(pinMotor[1], HIGH);
   digitalWrite(pinMotor[2], LOW);
 
   analogWrite(pinMotor[0], speed);
}
 
void moveMotorBackward(const int pinMotor[3], int speed)
{
   digitalWrite(pinMotor[1], LOW);
   digitalWrite(pinMotor[2], HIGH);
 
   analogWrite(pinMotor[0], speed);
}
 
void stopMotor(const int pinMotor[3])
{
   digitalWrite(pinMotor[1], LOW);
   digitalWrite(pinMotor[2], LOW);
 
   analogWrite(pinMotor[0], 0);
}
 
void enableMotors()
{
   digitalWrite(pinSTBY, HIGH);
}
 
void disableMotors()
{
   digitalWrite(pinSTBY, LOW);
}

I think I found the problem
// Pins for all inputs, keep in mind the PWM defines must be on PWM pins
I was using 8 for pwmb...changin to 6

A bit late, but you can test the output of a pin with an LED and resistor, which can be used
to confirm its basic function, including analogWrite(), with suitable test-sketch.