hey all ,
i need help in what seems as HW problem.
i am using SN754410 Motor Driver IC, with LPC2138 as its PWM controller.
the board schematics :http://www.iar.com/website1/184.108.40.206/162/IAR-LPC2138-schematic-revC.pdf
i connected 3 AA bateries in serial in order to get more than 4V on the MotorVcc pin in the SN754410.
and the board is connected seperatly to 4 AA batteries for operation (4*~1.3 = 5V) to the J-Link 5V input.
this 5V also supply the SN754410.
i placed decupling capacitors (0.1uF) on each motor.
i placed decupling capacitors (10/47/100uF) on the motors supply pin on the SN754410.(suppose to help in my issue)
i am working with 150Hz PWM main freq, while changing the duty cycle from time to time.
my motors suppoet to run for 3 sec for every time i press the button.
my problem is :
most of the time while using the 90% duty cycle the motors coninue to run without stopping untill power up.
while working with IDE (IAR) i am been getting “undefined handler”.
The behavior you are describing sounds like it could indicate a power problem. Can you try measuring your logic and motor supply voltages with an oscilloscope or multimeter to see if they are dropping significantly when you run the motors? If they are, that could definitely explain why your controller is resetting.
It sounds like you might be using four rechargeable (NiMH) AA batteries, which are nominally 1.2 V each, for your 5 V logic supply. You should instead consider using at least 5 or 6 cells along with a voltage regulator like this one, which should ensure a more consistent voltage. In addition, even with three alkaline batteries, you are only providing the bare minimum 4.5 V that the SN754410 requires on its motor voltage input, so you might get some better results with four or more batteries there.
It does sound like a power problem or noise problem. Check your voltages and signals with a scope.
Hello i am still having problems ,
i put some more details on the matter…
• I’m trying to start 2 Motors to run FW and RW every few seconds.
• It works!! but …
• It seems that after awhile (can take few second or few minutes) my MCU (LPC2138) stop running.
• I placed 47uF in Vcc2, which was supposed to help.
• I attached my schematics and DataQ log that shows the voltage behavior on channels:
o Channel 1: debug pin to monitor my program.
o Channel 2: 3V3 volt of my processor.
o Channel 3: 5V3 for the SN754410 and the EVB
o Channel 4: ~3V0 for the 2 motors.
EVB : IAR LPC2138.(using IAR Jlink and environment)
Motor Driver: SN754410
Gearbox Kit: Tamiya 70168
PWM rate 100Hz.
my code is simple:
if (k > 1000000)
///for debug only !!
if (i > 100000)
i = 0;
void Motor_Drive (bool IsFW , char speedMotor1, char speedMotor2)
PWMLER = 0x24;
PWMMR2 = speedMotor1; /* set falling edge of PWM2 */
PWMMR5 = speedMotor2; /* set falling edge of PWM5 */
will aapriciate any help on the matter.
Is your compiler case insensitive? You see to be incrementing variables with capital letters and checking variables with lowercase letters. I don’t feel like your code is simple. Why not just have your main method be something like this?
Does that work? If so, probably something is wrong with your code. Instead of using the debug pin, you can connect your oscilloscope directly to the PWM lines. Also, if you post code again, it would be very helpful if you add [code] tags around it to make it more readable and supply the all of the code.
its been weeks i am trying to make this H-Bridge work…
i am sure by now that it is HW problem.
for some reason while the motor start to run it crashes the MCU.
i placed a coil between the MCU and the H-Bridge (470mH) , it seems to have some effect for some sec… but still got crashed !! any other ideas ??
i am really desperate…
is there any schemantics that i can review envolve your H-Bridge and any other MCU similiar to mine ?(LPC2138)
i some on web … nothing helps.
If you post you’re entire code we will be able to help you much more. Also post the exact (copy-paste) error messages you get.
You should also perform simple test (such as the one RyanTM suggested) to narrow down exactly where the problem lies. Try just running the motors forwards, just running them backwards, switching every two seconds, etc.
From the datasheet, 3V is outside the recommended motor voltage for the SN754410. Unfortunately, running the motors that come with your gearbox kit at a higher voltage will severely shorten their life span (reference). Also, I hope that you have a separate line to the microcontroller ground. All ground pins should be directly connected to battery ground.
Do you have access to an oscilloscope? I would be interested to see what is going on with your MCU’s logic power as your speeds up. Keep in mind that rapidly accelerating your motor will draw close to the full stall current, which could be introducing electrical noise or causing your battery voltage to drop, especially if your batteries are not freshly charged. Does the problem only happen during rapid acceleration or changes in direction? What happens if you ramp up the voltage slowly over time (i.e. implement software acceleration limiting)?