Post a new topicPost a reply Page 1 of 1   [ 5 posts ]
Author Message
 Post subject: OTAP: What does it do to serial port?
PostPosted: Wed Mar 21, 2012 11:32 am 

Joined: Fri Jan 13, 2012 2:27 pm
Posts: 34
Ok, I am now running on a full linux machine (no VM). Its an IBM Thinkpad x31 running Ubuntu 11.10.

I have a small C program which captures the sensor frames as they appear on the serial port via the Gateway. Thats working...no problems. Now, as part of the program I want to parse the sensor frame and check the value of part of its contents. If below an alarm value I want to use a system command to run an OTAP command to check what sensor nodes are within range. I use the following command:

./otap -scan_nodes --mode BROADCAST --time 3

This works within the program, and the output is piped to a file for processing later. While it is performing this task I am not parsing any sensor frames. However, when I go back to parse the frames it seems that the port is now misconfigured, and the parsing fails. This kills the program.

If I try to restart my program, then it continually fails. So no, closing/reconfiguring of the port seems to help. Only when I remove the gateway and reinsert it, will the program work again (The sensor having been ON all through this period).

So is the OTAP command taking control of the port in some way? Or reconfiguring it? I'm a bit confused.


Top
 Profile  
 
 Post subject: Re: OTAP: What does it do to serial port?
PostPosted: Wed Mar 21, 2012 3:29 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7479
Fab4,

Fab4 wrote:
So is the OTAP command taking control of the port in some way? Or reconfiguring it? I'm a bit confused.


When you use OTA, it takes control of serial port, but when it finishes, serial port is liberated, so your issue is quite strange.

You can test it using Waspmote IDE for example, if you plug the gateway you can see the corresponding serial port on tools/serial port. then, if you run OTA, you will notice that serial port is not shown on IDE while OTA is running. When OTA is finished, serial port is available again.

We will think in your issue. In the meantime, can you give us more detail about this? How do you parse, etc.

Regards


Top
 Profile  
 
 Post subject: Re: OTAP: What does it do to serial port?
PostPosted: Thu Mar 22, 2012 9:05 am 

Joined: Fri Jan 13, 2012 2:27 pm
Posts: 34
I will try that today and let you know. Yesterday I coded a workaround to the problem, where I did a reset (in software) of the USB gateway. This is like unplugging/resinserting it manually but in code.


Top
 Profile  
 
 Post subject: Re: OTAP: What does it do to serial port?
PostPosted: Tue Mar 27, 2012 2:58 pm 

Joined: Fri Jan 13, 2012 2:27 pm
Posts: 34
My workaround was a 'false dawn' I'm afraid. However I ran your test of using the Serial Monitor of the Waspmote IDE (v0.2) to view the sensor frames and run an OTAP command using the OTA shell (v0.1-b70). I received the same Java error as I did while collecting th frames with my own program...the following:

Code:
wmc-ThinkPad:~/sensor_workspace/otap$ sudo ./otap -scan_nodes --mode BROADCAST --time 3
RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyUSB0: File exists
RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyUSB0: File exists
The port: /dev/ttyUSB0 doesn't exists.
Error when writing to serial port.Error when writing to serial port.Error when writing to serial port.Error when writing to serial port.Error when writing to serial port.Error when writing to serial port.Error when writing to serial port.Error when writing to serial port.Error when writing to serial port.Error when writing to serial port.Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NullPointerException
        at libelium.otap.Commands.waitForData(Commands.java:1734)
        at libelium.otap.Commands.configureMY(Commands.java:1164)
        at libelium.otap.Commands.xbee_setup(Commands.java:1459)
        at comandos.Ejecuta.read_xbee_setup(Ejecuta.java:1377)
        at comandos.Ejecuta.read_nodes_firmware(Ejecuta.java:960)
        at comandos.Ejecuta.main(Ejecuta.java:197)
        ... 5 more


Any suggestions?


Top
 Profile  
 
 Post subject: Re: OTAP: What does it do to serial port?
PostPosted: Tue Apr 24, 2012 4:15 pm 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7479
Fab4,

First of all sorry for delay answering. The post was missed.

Code:
RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyUSB0: File exists
RXTX fhs_lock() Error: creating lock file: /var/lock/LCK..ttyUSB0: File exists

Previous lines means that there is another program (using Java RXTX library) using this port.
You can try doing "ps -ax" to kill process which uses this port. Moreover, It could be one OTAP process wrong ended..so just search it with "ps" and kill it.

Sometimes one port could be closed wring, and just rebooting the systems it is fixed.

Best Regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use