To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 194
193  |  195
Subject: 
Re: NBC with NXT - crash!
Newsgroups: 
lugnet.robotics.nxt
Date: 
Sat, 21 Oct 2006 22:19:29 GMT
Viewed: 
12033 times
  
In lugnet.robotics.nxt, John Hansen wrote:
In lugnet.robotics.nxt, Ross Crawford wrote:
Hi, I wrote the following program, and it causes my NXT to crash!

Running this program on my NXT does not cause mine to crash.  Are you definitely
running the 1.03 firmware?  You can see the version using Settings|NXT Version
on the NXT or from the Diagnostic window in BricxCC.  My brick shows
01.1240/01.03 in the Diagnostic window.  My NXT is a beta so perhaps it behaves
differently from a retail NXT.

Settings shows FW 1.03, AVR 1.01, BC4 1.01, Build 2803060845
Diags window shows 01.1240/01.03

Unfortunately, there isn't any built-in mechanism in the standard NXT firmware
to start and stop threads like you can in the standard RCX firmware (and in the
proprietary Robolab 2.9/RobotC alternate firmware).  And there isn't any
mechanism for acquiring resources such as motors for exclusive access.  So in
both NXT-G and NBC it is possible to write programs which have concurrent
threads which try to control motors simultaneously.  The result could be
catastrophic, depending on how the virtual machine in the standard firmware
handles such things.  But on my NXT, at least, there isn't a crash but the
motors do not operate as you might hope they would.

The way to handle this in NBC is to use a global variable as a semaphore to
protect access to the motors.  Like this:

Thanks John, but as you may have suspected, this program was going to be an
example of how to use mutex variables in the NBC tutorial - this version is to
show the unexpected behaviour without them ;) The crash was certainly
unexpected... Maybe I should contact LEGO about this? Could it be a weird
hardware problem?

BTW, the crash happens as soon as I run the program, only solution is to remove
thw batteries temporarily.

ROSCO



Message is in Reply To:
  Re: NBC with NXT - crash!
 
(...) Running this program on my NXT does not cause mine to crash. Are you definitely running the 1.03 firmware? You can see the version using Settings|NXT Version on the NXT or from the Diagnostic window in BricxCC. My brick shows 01.1240/01.03 in (...) (18 years ago, 21-Oct-06, to lugnet.robotics.nxt)

4 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR