S12 pins output

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12 pins output

1,956 Views
deaninkc
Contributor I
I'm trying to directly drive a small stepper motor with an C32. I found the Freescale paper AN2974 that explains how to do it. Basicly they are creating an AC waveform by configuring the GPIO ports (I'm using PT) as output and moving a byte value to the PPT IO register alternating adjacent pins between 1 and 0. Can a pin configured as output sink current? I would think you would have to alternate the pin direction while you are doing it. I'm not having any luck getting it to work. If look on a scope I don't get anything unless I ground the scope lead and then I get a normal + square wave as you would expect. Can anyone enlighten me?

Labels (1)
0 Kudos
3 Replies

443 Views
coscos
Contributor I
Also the 25 mA is the current  we can sink  instaneously, so even with such a small motor using a driver is safer.
0 Kudos

443 Views
deaninkc
Contributor I
Thanks for the help. The stepper is a Switec X25 micro steeper and it only draws 20ma max. The literature indicates it was designed to be driven directly by a microcontroller. I was trying to use an A3967 driver IC on the Easydriver board but was running into problems and decided to try it direct as a proof of concept. Long term I'm going to be using a HC08 but I'm more familar with the HCS12 so I'm using it to test out the logic. I'll probably use a driver chip of some sort but wanted to get a basic understanding of how to control the stepper motor first. I'll try setting the pullups.


0 Kudos

443 Views
JimDon
Senior Contributor III
You would set the pin to output, but I strongly recommend you NOT drive the motor directly.

If you don't turn on the pull up, and have no pull up on the pin you may not see anything.
Also the motor could be basically shorting the pin or forcing it to 5v.
Hopefully, you haven't killed the chip yet. Remove the motor, turn on the pull ups and you should see the pulses.

For one thing, the outputs are only rated at something like 25ma. For another a motor is an inductive load and will put high voltage on the the pin (when you switch an inductor, as the magnetic field collapses, it generates a high voltage).

A SN754410 is a good choice for 5v systems.
SN754410

They can be purchased from mouser for 1.87 qty 1. You can use all 4 outputs to drive a stepper.


0 Kudos