Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Ratfink on February 19, 2007, 03:45:52 PM

Title: F2812 DSP Chip anyone have experience?
Post by: Ratfink on February 19, 2007, 03:45:52 PM
I have a current problem where im limited to the PWM pins 1-6 where 2 pins are being used to control two different motors. The PWM pins 7-12 are being used for another purpose which so its off limits.

Since the timing registers and all three compare registers are being used for the two PWM's how can i get a duty cycle ratio between two different frequencies with the remaining pins?
Title: Re: F2812 DSP Chip anyone have experience?
Post by: dunk on February 19, 2007, 05:25:31 PM
i don't know anything about that platform but what do you have in the way of spare communication ports?
if you have an i2c bus on there for example you could connect a separate microcontroller to handle I/O functions and controll it over the i2c bus.
if you have a spare UART you could do similar (although not as flexible as you will only be able to connect one slave device).

otherwise if you decide to do it on the same processor you are going to need a spare timer capable of generating an interupt.
program your interupt service routine to increase a counter when ever it is called.
change the state of your I/O pin when it gets to the specified delay time and clear the I/O pin when the counter overflows.
you can have several different counters, each controlling a different I/O pin meaning you can get several PWM signals.

dunk.
Title: Re: F2812 DSP Chip anyone have experience?
Post by: Admin on February 19, 2007, 06:54:27 PM
dunk, this might be of possible use to answer your questions at a quick glance:
http://cnx.org/content/m11822/latest/

eZdsp F2812 Reference Technical:
http://c2000.spectrumdigital.com/ezf2812/docs/ezf2812_techref.pdf

ratfink, what are you driving with the PWM?
Title: Re: F2812 DSP Chip anyone have experience?
Post by: Ratfink on February 19, 2007, 07:49:27 PM
Currently it is already driving two motors for the vehicle one is required for forward and backward motion and another for steering. I have a further need for two more PWM's to drive another motor which will be used for my rotating camera (btw the laser thing won't work due to crap camera resolution can't change cameras). Another PWM is needed to tell the motor which direction to turn.

From the manual and also i've tried using a frequency oscilltor it basically says i need 10 KHz and every falling edge will move the motor 1 increment (1.8 degrees). I need it to go alot faster than it does at 10 KHz so i need atleast about 80 KHz to rotate at a decent speed. Since i will be rotating the motor clockwise and anti clockwise 0-180 it also requires a positive DC PWM for clockwise motion and negative voltage for anticlockwise.
Title: Re: F2812 DSP Chip anyone have experience?
Post by: Ratfink on February 19, 2007, 08:03:35 PM
http://focus.ti.com/lit/ug/spru065d/spru065d.pdf

Heres a example document of how the DSP chip works to generate the PWM signals the problem i have is that half the available PWM's are being used for something else which i can't touch while the other half the 3 registers used to specify the Pulse width ratio is already used to control two other motors. Im left with 4 PWM pins which i can't seem to be able to use for controlling the motors since to set them up for such a task would require timers of which only two are provided.

I'd like to avoid using or interfacing a microcontroller
Title: Re: F2812 DSP Chip anyone have experience?
Post by: Admin on February 19, 2007, 08:21:06 PM
Quote
From the manual and also i've tried using a frequency oscilltor it basically says i need 10 KHz and every falling edge will move the motor 1 increment (1.8 degrees). I need it to go alot faster than it does at 10 KHz so i need atleast about 80 KHz to rotate at a decent speed.
hmmm
(80kHz*pulse) * (1.8 deg/pulse) / (360 deg/rotation) = 400 rotations per second
are you sure you need a camera to rotate that fast?! :P

you are sending the PWM to a motor driver, right? is it controlling a stepper motor? if so you dont need duty cycle, you just need a falling edge. in that case, this pseudo code should work with just a single timer:

Code: [Select]
begin loop:
bring all digital ports high

if timer says X time has passed:
bring port for motor A low

if timer says Y time has passed:
bring port for motor B low

if timer says Z time has passed:
bring port for motor C low

wait(5 microseconds) //makes sure the falling edge completes itself in hardware

return loop;

so in the code, the lower X, Y, and Z are, the more falling edges that particular motor will see. the problem however is that its a processor intensive program, so if you need your controller to do otherstuff it wont work . . . but it would work for like 20+ motors if you needed . . .

you can maybe use a timer interrupt to run your PWM code while your device does other stuff, if you have a few cycles to spare.

not sure if there is any other way to do this without buying extra controllers/hardware . . .