4 years, 6 months ago.

KL25Z Only works when mini usb is connected

Hello,

I'm new to KL25Z, i have a motor driver project using KL25Z and an OEM L293D Dual H Bridge driver. The code to test the device is as the following:

Motor Driver with DCMotorControl.h

#include "mbed.h"
#include "DCMotorControl.h"
 
Motor myMotor(PTD2, PTA12, PTC8, PTA5, PTA13, PTA4, PTD3, PTC9);
 
//The code below is a test to turn motor from terminant B to terminant A
//begin speed is 10% then 50% and 100% with 3 seconds delay with the previous speed 
int main(void)
{
    int k;
        for(k = 1; k < 10000; k++){
        myMotor.Direction(1,0,1,0,1,0,1,0);
        int i = 20;
        myMotor.setSpeed(i,i,i,i);
        wait(1);
        myMotor.Direction(0,1,0,1,0,1,0,1);
        i = 20;
        myMotor.setSpeed(i,i,i,i);
        wait(1);
    }
}

However, the program inside the board won't drive the motor when mini usb is not connected to the board. Everytime it disconnects, the motor stops working, I power the L239 D driver with 4x AA, each of them is 1.5v.

Hi there,

for posting a code please use Editing tips

<<code>> /*your code*/ <</code>>

A better description of power source connection of the board and driver (Vcc1 and Vcc2) is needed.

BR, Jan

posted by Jan Kamidra 25 Oct 2019

Hello! thank you for the revision! I will definetly add it, i'll take a look on the Vcc and the groundings . Meanwhile, i'm using an arduino motor shield to clarify (OEM L293D) and i don't know where to look at the pins. Thank You!

posted by wikara gunawan 25 Oct 2019

1 Answer

4 years, 6 months ago.

Hi again,

I not have the KL25Z (main board) and the arduino motor shield but you need to download and check the User Manual from the the section "Schematics" of the FRDM-KL25Z's page. I am not sure if this is the point what will help you but in this namual on the page 4 is a picture about the board. /media/uploads/JohnnyK/board.png

HERE is a schematic about the arduino motor shield

According to these schematic it looks like, the connector of external power supply witch is dirrectly connected to the Vcc2 of the L293D as power supply for outputs - motor, servos and so on. Also it can be connected to the Vin pin of the main board when the power jumper is connected. But Vcc1 of the L293D is powered by 5V from 5Vpin from the main board. So it looks like the reason why your project will stop working is about when the main board is not powered by USB, the power source of 5v is not present anymore for the motor shild. Because Vin pin conected to the voltage regulator is reguleted directly to 3.3V and then is the 5V pin dead and the Shield too.

I hope I am not wrong. I think, you can easily verified the when you will powered your board with the battery pack via Vin pin without USB is connected and then check the state of 3.3Vpin and 5Vpin with a voltmetr.

Some links:

Best regards, Jan