PDA

View Full Version : Conflict between "Initialize_Tracker()" and "pwm13 & pwm15"? Kevin?


gnormhurst
02-21-2004, 08:35 PM
I got my manual driving code working pretty well, and it was time to move on to IR tracking. I hooked up beacons and made IR servo trackers, loaded Kevin's tracker code, and it worked! Yay.

So I merged the code from the tracker codebase into my code for non-autonomous driving, including dropping Kevin's user_routines_fast.c in place of the default one, and things got weird. No navigation code at all, just tracker code. The trackers would run okay, but the motors, connected to pwm13 and pwm15, started running and stopping, jerking on and off. The manual joystick driving still worked, sort of.

So I started removing bits of Kevin's code to see what was messing me up. I turned off all the code in Process_Data_From_Local_IO(). That didn't help. Then I turned off the call to Initialize_Tracker() that I had added in User_Initialization(), and that stopped the erratic behavior. And the trackers, too, of course.

I thought the code was running too long, so I measured the code duration by hooking up a scope to a digital out, and in main.c set it to '1' just before the call to Process_Data_From_Master_uP() and to '0' just after the call to Process_Data_From_Local_IO. My code runs in about 4 ms.

Today I found Kevin had a new version of tracker.zip posted on kevin.org. I merged that code with mine. No improvement. Darn.

Finally, sensing that there is something "different" about pwms 13, 14, 15, 16, I connected my motors to pwm10 and pwm11, turned all the tracking code back on, and everything worked nicely! That was at the end of the day, so I didn't get a chance to try any navigation...

So, can someone tell me why changing the motors from 13 and 15 to 10 and 11 changed the behavior from erratic to normal??? What's going on here?

-Norm

Astronouth7303
02-21-2004, 08:44 PM
Go through Kevin's code and check very carefully what goes where. I'd replace them with aliases, if he hasn't yet.

I, personnally, wouldn't have just replaced the file. Just copy/paste everything. That way, I know what's going in.

Anthony Kesich
02-21-2004, 11:14 PM
the function generate_pwms(). Something about pwms13-16 is strange and you have to run them through the function generate_Pwms() (or something like that) to have them run correctly (i think it has to do w/ timing and they way some of the outputs are on the chip). all in all, i just avoid 13-16, and try to stick to 1-12.

-Kesich

Kevin Watson
02-22-2004, 01:55 AM
I got my manual driving code working pretty well, and it was time to move on to IR tracking. I hooked up beacons and made IR servo trackers, loaded Kevin's tracker code, and it worked! Yay.Geez, why do people act so suprised when my stuff works :).



So, can someone tell me why changing the motors from 13 and 15 to 10 and 11 changed the behavior from erratic to normal??? What's going on here?PWMs 13 through 16 are controlled by the user processor. I saw the wacky behavior you described while developing the receiver and tracking code. The problem isn't with my code (as far as I know). The IFI folks know about this and wrote it up (http://www.innovationfirst.com/firstrobotics/faq/default.asp?Action=Q&ID=80).

-Kevin