NXT displaying "File error!"

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
lizard381
Posts: 44
Joined: 16 Nov 2010, 19:57

NXT displaying "File error!"

Post by lizard381 »

Hi,

I recently started up with a new NXT 2.0 kit, using a MacBook Pro and NXC. I'm compiling and downloading the code to the NXT from the Terminal. For some reason, for a very simple program (just turning Motor A on for some seconds and then stopping), the program runs and then displays "File error!" on the NXT LCD screen. Has anyone else had this before? I think I've downloaded all the necessary firmware and driver updates.

Code:

Code: Select all

#include "NXCDefs.h"

 
 task movement() {
   while (true) {
     OnFwd(OUT_A, 100);
     Wait(100);
	 StopAllTasks();
   }
 }
 
 
 task main() {
   Precedes(movement);
 }
Cheers,
Kami
I haven't grown past my playing with Legos stage and I don't think I want to :)
Blog: http://nuhlikklebickle.blogspot.com
Kami
nxtboyiii
Posts: 366
Joined: 02 Oct 2010, 07:08
Location: Everywhere

Re: NXT displaying "File error!"

Post by nxtboyiii »

Do you have the latest enhanced firmware?
Thanks, and have a nice day,
nxtboy III

programnxt.com
lizard381
Posts: 44
Joined: 16 Nov 2010, 19:57

Re: NXT displaying "File error!"

Post by lizard381 »

nxtboyiii wrote:Do you have the latest enhanced firmware?
Yes, I do.
I haven't grown past my playing with Legos stage and I don't think I want to :)
Blog: http://nuhlikklebickle.blogspot.com
Kami
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NXT displaying "File error!"

Post by afanofosc »

My first suggestion is that you stop #including NXCDefs.h. The compiler does this automatically for you so there is no reason to put this line in your own code anymore. It was needed a long time ago so old sample code may still do this.

My second suggestion is that you are perhaps not actually running the latest enhanced NBC/NXC firmware on your NXT if all you see is the File Error! message without a number also shown on the screen. Recent releases of the enhanced firmware have added an error code output to this message so that you can tell what kind of problem has occurred. You can get version 1.31 of the enhanced NBC/NXC firmware via links on the BricxCC page or in the latest test release zip at http://bricxcc.sourceforge.net/test_releases/. Check the NXT Versions screen under Settings on your NXT to see what version you are actually running. If it doesn't say NBC/NXC on that page then you are running the standard firmware.

My third suggestion is that in a trivial program like this the most likely cause for a File Error message is trying to run 2.0 code on a 1.0 firmware or code that requires the enhanced firmware on the standard firmware or code compiled with a version of NBC that doesn't know anything about the 2.0 firmware on a 2.0 firmware. So it would be good to verify that you are running the latest NBC for your platform and that you are passing -EF if you have the enhanced firmware on your brick but not using that switch on the command line if you have the standard firmware on your brick. And if you happen to have the 1.0x firmware on your brick and are using a recent release of NBC that you are passing -v=107 on the command line so that the compiler correctly targets the 1.0x firmware. Older versions of NBC defaulted to a 1.0x target version but the recent releases now default to using a version of 1.28 (-v=128).

If your program used arrays then another common cause for File Error messages is reading or writing past the end of an array, i.e., trying to access element n when there are only n elements in the array, since in C arrays are indexed from 0 to n-1 for an array with n elements.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
nxtboyiii
Posts: 366
Joined: 02 Oct 2010, 07:08
Location: Everywhere

Re: NXT displaying "File error!"

Post by nxtboyiii »

Oh. works for me.
Thanks, and have a nice day,
nxtboy III

programnxt.com
lizard381
Posts: 44
Joined: 16 Nov 2010, 19:57

Re: NXT displaying "File error!"

Post by lizard381 »

nxtboyiii wrote:Do you have the latest enhanced firmware?
afanofosc wrote:My first suggestion is that you stop #including NXCDefs.h. The compiler does this automatically for you so there is no reason to put this line in your own code anymore. It was needed a long time ago so old sample code may still do this.

My second suggestion is that you are perhaps not actually running the latest enhanced NBC/NXC firmware on your NXT if all you see is the File Error! message without a number also shown on the screen. Recent releases of the enhanced firmware have added an error code output to this message so that you can tell what kind of problem has occurred. You can get version 1.31 of the enhanced NBC/NXC firmware via links on the BricxCC page or in the latest test release zip at http://bricxcc.sourceforge.net/test_releases/. Check the NXT Versions screen under Settings on your NXT to see what version you are actually running. If it doesn't say NBC/NXC on that page then you are running the standard firmware.

My third suggestion is that in a trivial program like this the most likely cause for a File Error message is trying to run 2.0 code on a 1.0 firmware or code that requires the enhanced firmware on the standard firmware or code compiled with a version of NBC that doesn't know anything about the 2.0 firmware on a 2.0 firmware. So it would be good to verify that you are running the latest NBC for your platform and that you are passing -EF if you have the enhanced firmware on your brick but not using that switch on the command line if you have the standard firmware on your brick. And if you happen to have the 1.0x firmware on your brick and are using a recent release of NBC that you are passing -v=107 on the command line so that the compiler correctly targets the 1.0x firmware. Older versions of NBC defaulted to a 1.0x target version but the recent releases now default to using a version of 1.28 (-v=128).

If your program used arrays then another common cause for File Error messages is reading or writing past the end of an array, i.e., trying to access element n when there are only n elements in the array, since in C arrays are indexed from 0 to n-1 for an array with n elements.

John Hansen
I re-downloaded 1.29 and it stopped displaying that error, perhaps something somehow got overwritten when I was getting all the updates? Thanks!

Kami
I haven't grown past my playing with Legos stage and I don't think I want to :)
Blog: http://nuhlikklebickle.blogspot.com
Kami
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXT displaying "File error!"

Post by mattallen37 »

lizard381 wrote:I re-downloaded 1.29 and it stopped displaying that error, perhaps something somehow got overwritten when I was getting all the updates? Thanks!

Kami
If you have 1.29, then I don't think it is enhanced. I don't think John ever released a 1.29 enhanced. The latest he did was 1.31 (but he skipped 1.29, I think).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests