bug related to Sensor port 1, Bluetooth and program size

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

bug related to Sensor port 1, Bluetooth and program size

Postby Aswin » Fri Mar 09, 2012 9:29 pm

Hi,

I experience a strange problem in one of my programs. In this program I use an US sensor on port 1. Under normal circumstances this program works fine. However, the program also has the option to output data to the NXJChartingLogger. If I use this option in the code the US sensor just returns 255 (out of range). I tried to reproduce this in a smaller program but then everything keeps working fine, with or without the chartingLogger enabled. Therefore I suspected it could have something to do with program size. With the chartingLogger disabled the program size is 55104 bytes, with the logger enabled this is 64304 bytes. The change in program size is because I disable the option by commenting out some lines of code. Could the strange behavior have something to do with the program exceeding the 64K boundary? Is there an official maximum to program size?

I also tried to put the US sensor on a different port. It then keeps working no matter the logging enabled. So I placed another sensor on port 1 and this halted when I used the logging option. The strange thing is that I was able to see that this sensor worked for a brief moment. Only when the code below was executed it stopped working. It doesn't matter if I really make a connection or let the connection time out. I therefore conclude that the ChartingLogger itself isn't to be suspected but the Bluetooth class might be involved in this problem. Indeed, when I replace the Bluetooth connection for a USB connection the program starts working fine again.
Code: Select all
      LCD.drawString("Connect over BT", 0, 0);
      NXTDataLogger log=null;
      NXTConnection connection = Bluetooth.waitForConnection(20000, NXTConnection.PACKET);
      if (connection  != null) {
      try {
         log= new NXTDataLogger();
         log.startRealtimeLog(connection);
      }
      catch (IOException e) {
         log=null;
      }
      }


So. To wrap thing up. Port 1 stops working when I have a large program in combination with a Bluetooth object.
My NXT blog: http://nxttime.wordpress.com/
Aswin
leJOS Team Member
 
Posts: 199
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands

Re: bug related to Sensor port 1, Bluetooth and program size

Postby skoehler » Fri Mar 09, 2012 9:41 pm

We fixed a bug like that in 0.9.1
Are you using 0.9.0 by any chance?
skoehler
leJOS Team Member
 
Posts: 1406
Joined: Thu Oct 30, 2008 4:54 pm

Re: bug related to Sensor port 1, Bluetooth and program size

Postby gloomyandy » Fri Mar 09, 2012 9:57 pm

Hi Aswin,
What version of leJOS is this with? I'm pretty sure that this is fixed in the latest SVN version and I think in any firmware build after 6216. See this change:
http://lejos.svn.sourceforge.net/viewvc ... iew=markup

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3967
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: bug related to Sensor port 1, Bluetooth and program size

Postby Aswin » Fri Mar 09, 2012 10:45 pm

I am using 0.9.1 Firmware revision 5969
My NXT blog: http://nxttime.wordpress.com/
Aswin
leJOS Team Member
 
Posts: 199
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands

Re: bug related to Sensor port 1, Bluetooth and program size

Postby Aswin » Sat Mar 10, 2012 12:25 am

The new firmware and snapshot solved the problem. Thanks
My NXT blog: http://nxttime.wordpress.com/
Aswin
leJOS Team Member
 
Posts: 199
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands

Re: bug related to Sensor port 1, Bluetooth and program size

Postby skoehler » Sat Mar 10, 2012 12:58 am

Firmware and JAR files should always match. Using 0.9.1/snapshot JARs with 0.9.0 firmware might work most of the time, but can also result in a data abort. The same holds for pretty much any combination.
skoehler
leJOS Team Member
 
Posts: 1406
Joined: Thu Oct 30, 2008 4:54 pm

Re: bug related to Sensor port 1, Bluetooth and program size

Postby Aswin » Sat Mar 10, 2012 10:55 am

Well, I try to use the most current snapshot. But I also tried the Windows installer for 0.9.1 and I manually flashed the brick a few times with the robotC and Lejos firmware. I ended up with a mess without knowing it. It has been fixed now. The bug has gone. Thanks.
My NXT blog: http://nxttime.wordpress.com/
Aswin
leJOS Team Member
 
Posts: 199
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff