Hi, I've been currently working with arduino mega to control 2 servo motor through motor driver TB6612FNG, but when i used analogwrite on pin 12, it worked for a little time and then this pin didn't worked anymore.I mean the function analogwrite did not work with this pin anymore,while the other pin are still fine. I tried with a new arduino mega and it happend again. To be more detailed, I used pin 2,3,4,5 as an input to read data from encoder and send it back to ubuntu through serial port, as the same time my computer send the signal to arduino to drive motors.and one more strange thing that if i keep the same pin from the origin source, everything work for a long time with no problem.but when i rearrange the pin i describe in the image, this problem happned.
If we are to help you then you will need to make a wiring diagram that can be understood unambiguously. Just make a simple pencil drawing with the connections clearly labelled and post a photo of the drawing. See this Simple Image Posting Guide
Also post a link to the datasheet for your motor driver.
And tell us what motor power supply you are using (volts and amps).
...R