Go to Post What's this about a robot that they speak of? Are we supposed to build one???? - ryan_f [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-10-2007, 10:13
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
pwm signal delay

hi there,
it is known that there are intervals between pwm signals,
these intervals can vary between 10mS and 20mS,

my question is, where is the code that handles the pwm signals?
well, our team's camera servos are tweeching,
and I suspect it may be caused by irregulations in the pwm signal.

many operations are done in the period between signals,
and that fact might cause the intervals to extend beyond range.

for example, it was written in CD, that ini one team, tweeching occured
while writing to EEPROM,
an action (for those who aren't familiar with EEPROM),
that consists of a few cycles => it takes some time to finish.

is it possible to change the default delay period?

thanks in advance,
Ran.
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

  #2   Spotlight this post!  
Unread 03-10-2007, 11:57
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: pwm signal delay

Quote:
Originally Posted by 3dude_2231 View Post
...where is the code that handles the pwm signals?
well, our team's camera servos are tweeching,
and I suspect it may be caused by irregulations in the pwm signal.
If you're using PWMs 13-16, your suspicion is justified. It isn't a matter of time delay between PWM pulses, though. It's the width of the PWM pulse itself that makes it happen.

The last four PWM signals are generated by the user CPU. The default code does not deal with interrupts perfectly, and the pulse width can sometimes be longer than desired when serial port and wheel encoder interrupts occur. Kevin Watson wrote some code to correct the jittery behavior, which you can find here:

http://www.kevin.org/frc/frc_pwm.zip

There is still some occasional twitchiness with Kevin's code when writing EEPROM. It doesn't affect normal robot operation, and I haven't taken the time to figure out whether it's due to interrupts being disabled briefly or some other cause.

The code for PWMs 1-12 runs in the master CPU, and is not usually a problem. If you're seeing twitchy camera servos connected to one of those signals, you are probably getting interference from the serial data signal. Try rerouting the wires to keep the servo and serial data physically separated.
  #3   Spotlight this post!  
Unread 03-10-2007, 12:38
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
Re: pwm signal delay

thanks
I'll try fixing it as quickly as possible, as it's a holiday here in Israel.

BTW,
it's a good opertnity to say "Happy Sukkot" to everyone who celebrates it.

Ran.
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..


Last edited by 3dude_2231 : 03-10-2007 at 12:48.
  #4   Spotlight this post!  
Unread 03-10-2007, 14:18
Jon236's Avatar
Jon236 Jon236 is offline
Registered User
AKA: Jon Mittelman
FRC #2648 (Infinite Loop)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Windsor, Maine
Posts: 741
Jon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond repute
Re: pwm signal delay

Happy Sukkot!
__________________
Jon Mittelman

Senior Judge Advisor New England & Israel 2014-2015
Infinite Loop Mentor 2011-2015
TechnoTicks Mentor 2000-2011
Championship Chairman's Award 2009 Team236 TechnoTicks
Judge 2010-2015 Championships
Senior Judge Advisor New England District Championship 2014-2015
Judge Advisor Tel Aviv Regional 2007-2015
Judge Advisor Pine Tree Regional 2013
Maine Regional Planning Committee
New England District Planning Committee
Lead Inspector Microsoft Tel Aviv Regional 2006-2008
Judge & Lead Inspector GM/Technion Tel Aviv Regional 2006
Judge UTC Hartford Regional 2006
  #5   Spotlight this post!  
Unread 03-10-2007, 15:18
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: pwm signal delay

If you are having huge gigantic problem, you could just run your own pwms using (E)CCP modules.

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #6   Spotlight this post!  
Unread 03-10-2007, 16:53
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: pwm signal delay

Your twitching is most likely from motors and static electricity. We had a bad problem with this two years ago because one of our motors what right need the wire going up to the servo and caused bad twitching.. are you running motors by the the camera or pwm wires?
  #7   Spotlight this post!  
Unread 03-10-2007, 18:17
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: pwm signal delay

Quote:
Originally Posted by Alan Anderson View Post
There is still some occasional twitchiness with Kevin's code when writing EEPROM. It doesn't affect normal robot operation, and I haven't taken the time to figure out whether it's due to interrupts being disabled briefly or some other cause.
The PWM code should be pretty solid at this point. If the twitchiness occurs while saving camera parameters to EEPROM, the likely problem is that I call printf() many times in rapid succession to draw the menu on the terminal screen. This bogs down the CPU and causes a long delay between PWM pulses. If the delay is long enough, the servos assume something is wrong and attempt to center the output shaft. In practice this isn't a problem and can be fixed by using a state machine to dole out the printf()s a few at a time.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #8   Spotlight this post!  
Unread 03-10-2007, 19:44
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: pwm signal delay

Quote:
Originally Posted by Kevin Watson View Post
If the twitchiness occurs while saving camera parameters to EEPROM, the likely problem is that I call printf() many times in rapid succession to draw the menu on the terminal screen. This bogs down the CPU and causes a long delay between PWM pulses. If the delay is long enough, the servos assume something is wrong and attempt to center the output shaft.
That doesn't sound right to me, for two reasons. First, the servo twitch occurs only when EEPROM is written. It does not happen when the menu is written to the terminal at other times. Second, servos don't "attempt to center" when they lose signal. They stop driving the shaft completely.

But we agree that it isn't a problem in practice. I consider it a minor cosmetic blemish on otherwise shiny code.
  #9   Spotlight this post!  
Unread 03-10-2007, 21:05
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: pwm signal delay

Quote:
Originally Posted by Alan Anderson View Post
That doesn't sound right to me, for two reasons. First, the servo twitch occurs only when EEPROM is written. It does not happen when the menu is written to the terminal at other times. Second, servos don't "attempt to center" when they lose signal. They stop driving the shaft completely.

But we agree that it isn't a problem in practice. I consider it a minor cosmetic blemish on otherwise shiny code.
Hmmm... Maybe I'm clueless here (wouldn't be the first time <grin>). I guess I'll have to crack the code open and have a look at what's going on.

BTW, when you say it only happens when EEPROM is being written, is it my code that's doing the writing? Is my camera code running too?

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #10   Spotlight this post!  
Unread 03-10-2007, 23:19
Gdeaver Gdeaver is offline
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,363
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: pwm signal delay

The data sheet shows a byte erase write cycle taking 4ms. The question is for multiple writes are interrupts enabled between writes?
  #11   Spotlight this post!  
Unread 03-10-2007, 23:22
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: pwm signal delay

whats your setup is this a benchtest or is it on a robot? Are you extending the pwm cables at all?
  #12   Spotlight this post!  
Unread 03-10-2007, 23:31
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: pwm signal delay

Quote:
Originally Posted by Gdeaver View Post
The data sheet shows a byte erase write cycle taking 4ms. The question is for multiple writes are interrupts enabled between writes?
Interrupts are only disabled for a about a microsecond each time a byte is written and interrupts are serviced while waiting for the write to complete.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #13   Spotlight this post!  
Unread 04-10-2007, 08:20
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: pwm signal delay

Quote:
Originally Posted by Kevin Watson View Post
BTW, when you say it only happens when EEPROM is being written, is it my code that's doing the writing? Is my camera code running too?
Yes to both. I've only noticed it when writing camera configuration, so it could be an issue with how the pan/tilt control software changes menu modes and might turn out not be related to EEPROM at all. Or it could be that the camera EEPROM data structure is long enough for it to show an effect where a shorter EEPROM structure does not.

In our software, we've generalized the EEPROM and menuing support and added several additional menus (drivebase PID tuning, arm PID tuning, sensor and navigation status, and automode targeting setup). To keep from rewriting what's already provided to us, there is a small bit of "wrapper" code around the calls to the camera and tracking menuing functions. However, those functions do still get called just as often as they do in the unmodified camera code.
  #14   Spotlight this post!  
Unread 04-10-2007, 11:14
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: pwm signal delay

Well since those servos use a linear carbon filament pot for feedback, and simply use proportional control for positioning (Just P, not PI, PD, etc...) then if your supply voltage to the servo(s) is/are too low (I believe 5v is the absolute minimum) then the voltage reference onboard the servo for the analog feedback may be skewed... or it might dip too low whenever the servo attempts to move... causing a 'twitch' as the position the porportional chip in the servo gets back would vary with a low voltage reference. Maybe when you write to your EEPROM your voltage dips ever so slightly and this occurs.

Or, as a more probable option, some EEPROM uses a very high voltage to flash the bits into memory. This could theoretically casue a high voltage spike to go out of the processor as the lines driving the EEPROM decay after flashing a bit in.

Maybe i'm barking up the wrong tree... but it sounds like most other things have been defined as working.

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #15   Spotlight this post!  
Unread 05-10-2007, 20:08
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
Re: pwm signal delay

thanks for your response, guys.
I'll be checking it out soon.
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Digital out signal speed on off, almost like PWM but at max 60Hz Generalx5 Electrical 2 27-03-2007 12:26
PWM Signal Noise? Danny Diaz Electrical 3 28-01-2007 17:02
Delay Gal Longin Programming 1 09-12-2004 10:37
Fading LEDs using a PWM signal from the Edubot DanL Programming 22 30-03-2004 00:07
Loss of signal in PWM cables. archiver 2001 6 23-06-2002 23:29


All times are GMT -5. The time now is 00:20.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi