Jeffery,
I really don't have a clue but for people who write in C, the get caught by a particular problem with how C treats the Host Service Request Register.
The first thing that you need to do is make sure that the pair of HSR bits that you are going to write are %00.
Then, you need to make sure that the C compiler only generates one instruction to write to this pair of bits. Many times, the C compiler will generate both an AND and an OR instruction to write to the pair of HSR bits.
Now, this is most important: DO NOT use read-modify-write instructions to deal with the Host Service Request Register. AND, OR, EOR, etc., are all read-modify-write instructions.
What you want to use is a MOVE instruction. Actually, you need to use a MOVE (immediate) instruction. Then, and this is psychotically important, write "0" to all the bits that you do not want to effect. For instance, if you want to cause channel 0 to do something and the HSR code is %01, then use this instruction: MOVE #$0001,(HSR).l. If a bit in the HSR is currently a 1, then a write of 0 will have no effect.
The problem with RMW instructions is that the TPU can change a bit in the HSR inbetween the READ and the WRITE portion of the RMW instruction and this will result in an errant HSR being issued to the channel where the bit got changed.
Like I say, check the actual assembly code that the compiler generated and look for RMW instructions that deal with the HSR and I think you will find your problem.
Regards,
Charlie
Show quoted textHide quoted text
-----Original Message-----
From: jeffreyslcu [mailto:jeffrey.s.sato@...]
Sent: Monday, November 18, 2002 6:22 PM
To: 68300@yahoogroups.com
Subject: [68300] Tabel Stepper Motor TPU Problems
Hi all,
I am using the Table Stepper Motor (TSM) function in the TPU to,
well, run a stepper motor. I am having two problems that I am hoping
someone can help me solve.
First, I have some c-code to run the motor in an open-loop mode.
Every 5mS I read the PRESENT_POSITION register, add an interger (say
8), then write the result to DESIRED_POSITION. Then update the HSR to
implement the command. My start rate is around 140 pulses per second
(pps) and the slew rate is around 2135 pps. I would expect the motor
to run at a somewhat constant rate, or at least dither back and forth
around the given rate based on the discrete acceleration rates in the
profile lookup table. Instead it is very jerky doing stop and go type
behavior. The pulse waveform out of the TPU shows both phases pulsing
as expected, then one phase stops while the other phase keeps
toggling a few times, then both phases begin pulsing again. This
occurs somewhat rhythmically.
The second problem is the 1.8 degree per step motor will be rotating
in the proper direction, suddenly reverse at a somewhat higher rate
and travel more than one revolution, then reverse again and travel as
normal. The phasing never changes to warrant the motor changing
directions. I suspect the anomally above is causing the motor to have
a resonance problem, but I have never heard of a motor traveling
backwards for any substantial distance.
Can anyone help me with these problems?
Thanks,
Jeff
---------------------------------------------------
To unsubscribe from this group, send an email to:
68300-unsubscribe@yahoogroups.com
To learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu <http://www.motorola.com/mcu>
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> .
[Non-text portions of this message have been removed]