Go to Post I'd be more worried about getting struck by lightning right after winning the lottery. :p - evulish [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 07-03-2006, 01:59
ericand's Avatar
ericand ericand is offline
Registered User
AKA: Eric Anderson
FRC #3765 (Terrabots)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: St. Paul, MN
Posts: 148
ericand is a jewel in the roughericand is a jewel in the roughericand is a jewel in the rough
Time available between NEW_SPI_DATA and Putdata

It is well documented that we need to send data back to the master microprocessor every 26.2 ms and that the data from the master is signaled by the setting of the NEW_SPI_DATA flag.

I would like to know how much time is available between the time the NEW_SPI_DATA flag is set and the Putdata is called, before the Master flags a code error.

The default code says:

Getdata(&rxdata); /* Get fresh data from the master microprocessor. */

Default_Routine(); /* Optional. See below. */

/* Add your own code here. */

Putdata(&txdata); /* DO NOT CHANGE! */

But there is no indication of how much time can be taken prior to calling Putdata().

My concern is that NEW_SPI_DATA may become active imidiately following the check for NEW_SPI_DATA. This means that one fast loop execution time may pass before we notice that it is set. Thus we may have more or less time to execute in Process_Data_From_Master_uP() before we are too late to call Putdata().

I think that this is related to our robot seeing intermittant code error conditions. I think that knowing exactly how much time we take (maximum) in our fast and slow loops, we can do a better job of time management and avoid the code error.
  #2   Spotlight this post!  
Unread 07-03-2006, 02:56
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Time available between NEW_SPI_DATA and Putdata

I'd say some testing might be in order. I've heard people say it's between a quarter and half a second, maybe more, but I can't vouch for that personally. I'd say that if you're taking more than 26.2ms then you probably need to rethink your design - I'd assume that this means you'd start dropping data packets all over the place. Probably not something you want to do.
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!

Last edited by steven114 : 07-03-2006 at 03:01.
  #3   Spotlight this post!  
Unread 07-03-2006, 03:34
ericand's Avatar
ericand ericand is offline
Registered User
AKA: Eric Anderson
FRC #3765 (Terrabots)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: St. Paul, MN
Posts: 148
ericand is a jewel in the roughericand is a jewel in the roughericand is a jewel in the rough
Re: Time available between NEW_SPI_DATA and Putdata

Quote:
Originally Posted by steven114
I'd say some testing might be in order. I've heard people say it's between a quarter and half a second, maybe more, but I can't vouch for that personally. I'd say that if you're taking more than 26.2ms then you probably need to rethink your design - I'd assume that this means you'd start dropping data packets all over the place. Probably not something you want to do.
I'm thinking it is much smaller than that. At most I would expect it to be 26.2ms. What I fear is that the master processor is setting the NEW_SPI
flag every 26.2 ms and assuming that the response will follow the setting
of NEW_SPI by some amount much less than 26.2 ms.

As you say, some testing is in order. We have an interrupt driven clock that we will use to get some numbers for the loop timings. We'll probably use the dashboard to capture the data.

I may need to check to see if we can do something like write the data to the eeprom even if we have been disabled by a code error. That brings up another question,
Can the processor detect when it is disabled by experiencing a code error?
  #4   Spotlight this post!  
Unread 07-03-2006, 04:15
Eldarion's Avatar
Eldarion Eldarion is offline
Electrical Engineer / Computer Geek
AKA: Eldarion Telcontar
no team (Teamless Orphan)
Team Role: Alumni
 
Join Date: Nov 2005
Rookie Year: 2005
Location: Númenor
Posts: 558
Eldarion has a reputation beyond reputeEldarion has a reputation beyond reputeEldarion has a reputation beyond reputeEldarion has a reputation beyond reputeEldarion has a reputation beyond reputeEldarion has a reputation beyond reputeEldarion has a reputation beyond reputeEldarion has a reputation beyond reputeEldarion has a reputation beyond reputeEldarion has a reputation beyond reputeEldarion has a reputation beyond repute
Send a message via AIM to Eldarion Send a message via Yahoo to Eldarion
Re: Time available between NEW_SPI_DATA and Putdata

Quote:
Originally Posted by ericand
I'm thinking it is much smaller than that. At most I would expect it to be 26.2ms. What I fear is that the master processor is setting the NEW_SPI
flag every 26.2 ms and assuming that the response will follow the setting
of NEW_SPI by some amount much less than 26.2 ms.

As you say, some testing is in order. We have an interrupt driven clock that we will use to get some numbers for the loop timings. We'll probably use the dashboard to capture the data.

I may need to check to see if we can do something like write the data to the eeprom even if we have been disabled by a code error. That brings up another question,
Can the processor detect when it is disabled by experiencing a code error?
In my testing, it has consistently been half of a second.
An easy way to do this test would be to put a while(1) loop in the main program loop, hit the reset button and see how long it takes before the BLROD comes on.

Good luck!
__________________
CMUCam not working? Tracks sporadically? Try this instead: http://www.falconir.com!
PM me for more information if you are interested (it's open source!).

Want the FIRST Email blasts? See here: http://www.chiefdelphi.com/forums/sh...ad.php?t=50809

"The harder the conflict, the more glorious the triumph. What we obtain too cheaply, we esteem too lightly; it is dearness only that gives everything its value."
-- Thomas Paine

If it's falling apart it's a mechanical problem. If it's spewing smoke it's a electrical problem.
If it's rampaging around destroying things it's a programming problem.

"All technology is run on 'Magic Smoke' contained within the device. As everyone knows, whenever the magic smoke is released, the device ceases to function."
-- Anonymous

I currently speak: English, some German, Verilog, x86 and 8051 Assembler, C, C++, VB, VB.NET, ASP, PHP, HTML, UNIX and SQL
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
Encoders and putdata theycallhimtom Programming 3 09-02-2006 19:24
Parallel Processor rohandalvi Kit & Additional Hardware 25 27-10-2004 20:21
interrupts and putdata() doy Programming 4 23-02-2004 22:45


All times are GMT -5. The time now is 05:11.

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