OCCRA
Go to Post we learned that's what happens when you start building without even thinking about weight. next year, we'll lighten everything BEFORE we mount it. - greencactus3 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-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 12-24-2004, 12:04 AM
randomperson's Avatar
randomperson randomperson is offline
Assembler Freak
#0904
Team Role: College Student
 
Join Date: Dec 2002
Rookie Year: 2003
Location: Wyoming,MI
Posts: 100
randomperson is an unknown quantity at this point
Send a message via AIM to randomperson Send a message via MSN to randomperson
Question Program error after controller reset

Ok... we seem to have hit on a rather odd problem.. I can't think of any good reasons for it yet...

When we load our code into the controller, everything works as expected and life is fun... until we reset the bot. Then the programming light turns orange.... it does the same thing with a power-off-power-on type of reset also... I'd say its the controller malfunctioning, but when we reload the default hex file it works like a charm, no problems. So.. we're quite lost on why is happening. We're going to start stripping our code down until we figure out whats going on... but if anyone has any ideas we would appreciate it!

Some information:

Did NOT change the ifi_x files, started using the code that we downloaded a few days ago from IFI.

DID play around with the linker script... we needed a variable over 256 bytes, and the linker didn't like that... so we adjusted one of the databanks to the size we needed, and eliminated one of them.. then adjusted everything else around it. However, when we put back the normal linker file, and deleted the huge variable... it still didn't work.

We are currently using:

Timer1, EEPROM stuff (using about 3/4th of the EEPROM memory available), and most of the default code is still in place. However, we do have 7 additional source files that are compiled and linked in. according to the MAP file generated, we are using about 40% of the space.

The C18 compiler that ships with the controller (v2.20 i think) that we got from IFI over the summer or in the fall I believe... However, we're using MPLAB 7.00, and it is using the new linker that came with MPLAB instead of the old linker.

So... any ideas? I'm lost here...
__________________
main() {
srandom(time(0));
while(1) {
int pid=random()%30000;
if (pid>1 && pid!=getpid()){
kill(pid, random()&1 ? SIGSTOP : SIGBUS);
sleep(10); }}}

Visit my completely useless website! http://randomperson.cjb.net
  #2   Spotlight this post!  
Unread 12-24-2004, 11:31 AM
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 1,999
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: Program error after controller reset

It's something with your code. It has happened to us, because, I think we have something in a while statement in user routines.c that it did not like. Play around with your code and you'll figure it out, hopefully...
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson
  #3   Spotlight this post!  
Unread 12-28-2004, 02:38 AM
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,332
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: Program error after controller reset

Quote:
Originally Posted by randomperson
So... any ideas? I'm lost here...
This happened to me and the only way I could cure it was to re-flash the master processor. The code can be found here.

-Kevin
__________________
Kevin Watson
Engineer at Virgin Galactic
http://kevin.org
  #4   Spotlight this post!  
Unread 01-04-2005, 08:41 PM
randomperson's Avatar
randomperson randomperson is offline
Assembler Freak
#0904
Team Role: College Student
 
Join Date: Dec 2002
Rookie Year: 2003
Location: Wyoming,MI
Posts: 100
randomperson is an unknown quantity at this point
Send a message via AIM to randomperson Send a message via MSN to randomperson
Re: Program error after controller reset

Well... figured out what went wrong. It's sorta obvious, but was rather stupid. We tried doing a printf() in some of our initialization code, and we had placed it before initialize_serial_comms()... so, yeah, great error...
__________________
main() {
srandom(time(0));
while(1) {
int pid=random()%30000;
if (pid>1 && pid!=getpid()){
kill(pid, random()&1 ? SIGSTOP : SIGBUS);
sleep(10); }}}

Visit my completely useless website! http://randomperson.cjb.net
  #5   Spotlight this post!  
Unread 01-04-2005, 09:21 PM
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
An inspired alumnus
AKA: Jamie Bliss
no team (previously 904 (D-cubed) and 1227 (Techno-Gremlins))
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Send a message via ICQ to Astronouth7303 Send a message via AIM to Astronouth7303 Send a message via MSN to Astronouth7303 Send a message via Yahoo to Astronouth7303
Re: Program error after controller reset

Quote:
Originally Posted by randomperson
Well... figured out what went wrong. It's sorta obvious, but was rather stupid. We tried doing a printf() in some of our initialization code, and we had placed it before initialize_serial_comms()... so, yeah, great error...
Yes... That.

You'd think FIRST would have a variable so that it won't printf before it's initialized.
  #6   Spotlight this post!  
Unread 01-04-2005, 11:19 PM
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,443
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Program error after controller reset

Quote:
Originally Posted by Astronouth7303
You'd think FIRST would have a variable so that it won't printf before it's initialized.
Jamie,

Hold on a second...

1. The default code that IFI provides us works. If we modify it and break it, it can not be their fault. We must assume responsibility for our actions.

2. Just what is the value of an uninitialized variable? Answer: It is undefined. If you are lucky, it will be 0x0000 or 0xFFFF. If you are unlucky, it can be anything.

My point here is that it is impossible to do what you suggest in an embedded controller.

It is possible in a program running under an operating system (the operating system guarantees the starting state of RAM).
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #7   Spotlight this post!  
Unread 01-04-2005, 11:31 PM
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,352
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: Program error after controller reset

Quote:
Originally Posted by Mike Betts
2. Just what is the value of an uninitialized variable? Answer: It is undefined. If you are lucky, it will be 0x0000 or 0xFFFF. If you are unlucky, it can be anything.

My point here is that it is impossible to do what you suggest in an embedded controller.
Actually, it is possible. If you assign an initial value to a static variable, the C compiler will automatically generate code to put the correct value in that location in RAM. This code is hidden from the user and is called before control is passed to the C program's entry point (usually main()).

{edit} The code that does this is in _do_cinit() in ifi_startup.c {/edit}

{edit2} But I agree with you that if you modify the default code then it becomes your responsibility to ensure there's no bugs. It would be impossible for IFI to protect the end users against all of the various mistakes like this that are possible. {/edit}

Last edited by Dave Flowerday : 01-04-2005 at 11:44 PM.
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
Loading Program to Controller.....problems Wbrown0389 Programming 5 02-27-2004 05:14 PM
Dangerous.....Code problem?!? Argoth Programming 24 02-20-2004 02:57 PM
Help On Coding 2K1 Controller GregTheGreat Programming 9 12-05-2003 06:35 PM
Fried program slots? Jeff Waegelin Programming 18 03-19-2003 06:08 PM
serious problem found - robot controller resets when jarred! KenWittlief Electrical 23 03-19-2003 01:30 PM


All times are GMT -5. The time now is 06:50 AM.

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


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