Welcome! Log In Create A New Profile

Advanced

Arduino and Mac OS X setting

Posted by Jordi 
Arduino and Mac OS X setting
June 15, 2008 06:16AM
Hi all,

Im trying to get the host software to run on Mac OS X and a single Arduino, using versions: reprap-host-20080523 and reprap-arduino-firmware-1.3.

What I learnt:

1. Host software needs Java 1.6 and, as far as I know, it is only available for Mac OS X 10.5.

2. You need to create a /var/lock directory with write permission (see [osdir.com]). Otherwise the host software will complain about "port is already in use by another program".

I'm now stuck in the following:

> ./reprap-host
DEBUG: Opening port /dev/tty.usbserial-A4001ukF [0,025s/-1213523962602ms]
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
RXTX Warning: Removing stale lock file. /var/lock/LK.002.017.004
DEBUG: Attempting to initialize Arduino [0,052s/27ms]
comms: tx 0->8: 0 ( = 0 ) [4,518s/4466ms]
Invalid memory access of location 3592a7c8 rip=34e457d8

./reprap-host: line 11: 1681 Segmentation fault java -cp ".:./reprap.jar:$REPRAP_DIR:$REPRAP_DIR/reprap.jar:$JAVA_LIBRARY_DIR/*" -Xmx$RAM_SIZE org/reprap/Main



I've never touched Java, so I don't know how to start debugging this.

Any idea will be most appreciated.
Re: Arduino and Mac OS X setting
June 15, 2008 03:59PM
"Segmentation fault"

This is a pretty fatal error and is internal to the java VM

In short, pretty serious. It's not likely to be something easy to debug through the program. It's most possibly caused by:-
corrupt java files (could try re-installing java and the libraries)
a configuration problem (wrong port for arduino comms?)
Possibly a problem communicating with the arduino?

I'd run as many checks as you can on the arduino and board communication. If that's OK, then see if you can beg/borrow a windows/linux box and see if you can get that to work. It *may* be a problem with OS dependancies.

You could also try going as far as you can without the arduino plugged in. I can run the host software on my linux box and I haven't got (or built) my electronics yet.

Java should (in theory) NEVER produce a seg fault - it *should* be able to handle errors by throwing an Exception, which gives you much more useful info on how it's gone wrong.

DaveR
Ru
Re: Arduino and Mac OS X setting
June 16, 2008 04:07AM
I might be more inclined to blame rxtx, as it happens. I'd be *very* surprised if you'd come across a bug in the jvm itself. I coudln't offer you any useful advice on troubleshooting the library however.
Re: Arduino and Mac OS X setting
June 21, 2008 07:39PM
Hi,

This is a bug in rxtx.
I've written a quick fix for it. It doesn't fix everything, but it makes the host software run.
See here for the patch: [mailman.qbang.org]

I didn't update the reprap wiki yet since there is still a bug lurking in there somewhere.

Don't hesitate to get in touch if you need more assistance.

-Marius
Re: Arduino and Mac OS X setting
June 22, 2008 06:30AM
Yes!
Now, the reprap-host seems to be running ok.

Many thanks.
Re: Arduino and Mac OS X setting
October 25, 2008 05:58AM
Hi,

Im quiet new to Mac OS X, so i really don't know, how to use this fix...

Little help?
Re: Arduino and Mac OS X setting
October 25, 2008 07:52AM
Hi,

The host software should work with Java 1.5 again, so this fix is not needed at the moment.


~/= Marius

--
We are Elektropeople for a better living.
[reprap.soup.io]
[www.metalab.at]
Re: Arduino and Mac OS X setting
October 25, 2008 09:52AM
Well, unfortunately i need rxtx to work with some other software too, which is implemented in java6...
Re: Arduino and Mac OS X setting
October 25, 2008 10:45AM
Hi again,

I've attached the libraries I compiled which includes a fix for some of the issues.
I haven't used this myself for a long while, so I cannot guarantee that it will work though.

At the moment, I'd recommend porting your software away from Java 6.
Alternatively, you could work with the guys on the rxtx mailing list to help getting these issues sorted out. AFAIU, this is not a Mac-specific issue, it's just related to 64-bit JVM's, so it should be possible to reproduce and work on this on your OS platform of choice.


~/= Marius

--
We are Elektropeople for a better living.
[reprap.soup.io]
[www.metalab.at]
Attachments:
open | download - RXTXcomm.jar (58.8 KB)
open | download - librxtxSerial.jnilib (181.4 KB)
Re: Arduino and Mac OS X setting
October 25, 2008 11:50AM
Thank You. Now there is at least some kind of communication.
but i dont get an answer from the device. it just shows:

Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
open: locking worked for /dev/tty.usbserial
open: fd returned is 34
has_line_status_register_acess: Port does not support TIOCSERGETLSR
init_threads: start
init_threads: creating drain_loop
init_threads: get eis
init_threads: set eis
init_threads: stop
writeByte
Re: Arduino and Mac OS X setting
October 25, 2008 11:55AM
Hm, this is really a bit out of my league...

Tips for debugging:
o Test with Java5 vs. Java6
o Test on other OS'es
o Test with a different vendor of usb2serial adapters
o Test in 32- vs 64-bits JVMs

The issue I'm talking about is _only_ related to 64-bit JVMs so you need to make sure this is the only place where you're experiencing this problem. Otherwise, you'll be barking up the wrong tree.

Sorry I cannot be of more concrete help, but good luck!


~/= Marius

--
We are Elektropeople for a better living.
[reprap.soup.io]
[www.metalab.at]
Re: Arduino and Mac OS X setting
October 26, 2008 12:20PM
Alright, its running!^^

So thanks for your help. The fact that i didnt get a response from the device was causes by a flaw in my procedure. Now its fixed!

But:

When I try to close the port, it says:

Leaving eventLoop
sometimes crashes here

and the program crashes!

Any Hints?
Re: Arduino and Mac OS X setting
October 26, 2008 02:16PM
Yeah, that's my debugging messages identifying another crash.
Unfortunately, I didn't get around to start debugging that one..


~/= Marius

--
We are Elektropeople for a better living.
[reprap.soup.io]
[www.metalab.at]
Re: Arduino and Mac OS X setting
October 29, 2008 07:48AM
Hi,

Can I disable these messages somehow?
Re: Arduino and Mac OS X setting
October 29, 2008 07:58AM
This is a debug build with extra debug messages.
To disable them, either get the latest version of rxtx, or compile it from source.
You might have to patch it according to my suggestion on the mailing list. I haven't followed this project for a while, so I don't know if this has been fixed by now.


~/= Marius

--
We are Elektropeople for a better living.
[reprap.soup.io]
[www.metalab.at]
Sorry, only registered users may post in this forum.

Click here to login