Pages: [1] 2 3   Go Down
Author Topic: New oscilloscope for arduino (Mac only)  (Read 4092 times)
0 Members and 1 Guest are viewing this topic.
France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For previous history & correspondance, please see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1256923269

Macintosh running with OS 10.4 (Tiger) and arduino-15 version.

Sketch downloaded from http://github.com/alvieboy/arduino-oscope/

Mac Scope display java software downloaded from http://www.alvarolopes.com/resources/oscope/

RXTX package downloaded from http://jlog.org/rxtx-mac.html

ARDUINO SIDE

Two arduino boards have been tested.

Duamilanove with Atmega328: sketch compiles then dowloads correctly

Mega: sketch does not compiles due to following error
Code:
In function 'void setup_adc()':
PRR &= ~BIT(PRADC); /* Disable ADC power reduction */
error: 'PRR' was not declared in this scope

MAC SIDE

Created a folder on desktop containing:
Code:
arduino-oscope.jar
fixperm-217.sh
librxtxSerial.jnilib
RXTXcomm.jar

Opened a Mac terminal window then launched
Code:
$ cd Desktop     (or the folder where you downloaded the script)
$ sudo sh ./fixperm-217-leo.sh
Password: <your administrator password>

Then lauched
Code:
$ java -jar arduino-oscope.jar
which gave these results
Code:
Experimental:  JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
found /dev/tty.modem
found /dev/cu.modem
found /dev/tty.usbserial-A9007U6Z
found /dev/cu.usbserial-A9007U6Z
found /dev/tty.Nokia6131-NokiaPCSui-1
found /dev/cu.Nokia6131-NokiaPCSui-1
found /dev/tty.Nokia6131-Dial-upnetwor-2
found /dev/cu.Nokia6131-Dial-upnetwor-2
found /dev/tty.Bluetooth-PDA-Sync
found /dev/cu.Bluetooth-PDA-Sync
found /dev/tty.Bluetooth-Modem
found /dev/cu.Bluetooth-Modem
found /dev/tty.Nokia6131-NokiaPCSuite-1
found /dev/cu.Nokia6131-NokiaPCSuite-1

The Arduino Oscope was succesfully launched then selection of /dev/tty.usbserial-A9007U6Z giving this result on terminal shell
Code:
Select
RXTX Warning:  Removing stale lock file. /var/lock/LK.001.009.016
Port /dev/tty.usbserial-A9007U6Z open successfully
Pinging device

Moving a bit "trigger level" with mouse gives this result on terminal shell
Code:
New trigger 0
New trigger 2
New trigger 3
New trigger 5
New trigger 6
New trigger 8
New trigger 9
New trigger 11
New trigger 11
New trigger 11
New trigger 9
New trigger 6
New trigger 5
New trigger 3
New trigger 0
New trigger 0

Moving "holdoff samples" with mouse does not display anything on terminal shell.

Moving "prescaler" with mouse gives this result on terminal shell
Code:
New prescaler 5 (32)
New prescaler 7 (128)

Clicking "dual channel" seems to not work and gives this result on terminal shell
Code:
Num samples: 962
Invalid packet 135 in state PING, expecting 227

P.S. Double-clicking on "arduino-oscope.jar" icon lauches scope without need to lauch terminal.

Directly connecting 5V pin from duamilanove to Analog pin0 does not show any change on display so I'm not sure scope is working or if I've missed some set up on my Mac.

I wanted to insert Capture Screen Shot (JPEG) on this post but does not know how to do it ?

Thank you in advance
« Last Edit: November 11, 2009, 08:54:55 am by selfonlypath » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Quote
Code:
PRR &= ~BIT(PRADC); /* Disable ADC power reduction */
You can comment out that line.

Quote
Code:
RXTX Warning:  Removing stale lock file. /var/lock/LK.001.009.016
Port /dev/tty.usbserial-A9007U6Z open successfully
Pinging device
Sometimes the internal state machine is not ready for packets. Can you try either use my last sketch version ? If it still does not work, often closing/opening the application  will fix it. I'm working on protocol changes so that you can reset the state machines before starting. I'll implement that on 2.0 version of protocol. I'll post details on a separate thread.

Álvaro
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Excellent news, i've "commented out" the line
Code:
PRR &= ~BIT(PRADC);
so compilation then loading on MEGA works now succesfully smiley-wink

Please confirm i'm using your last sketch version which I downloaded from http://github.com/alvieboy/arduino-oscope/

Same question about your last java version which I downloaded from http://www.alvarolopes.com/resources/oscope

Please instruct a simple self-generation or testing so I can see scope signal change on my screen.

Muito obrigado
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Right now, Alvaro's arduino scope dual channel scope works fine on both MEGA or DUAMILANOVE boards except for some reason, it freezes after a while which means no more scope display along with no more RX/TX between Mac and arduino board.

I would be interested to know if other Mac's users have similar issue on Mac OS 10.4 Tiger and arduino 15 version.

I've found a more easy install version of RXTX via this link
http://www.efianalytics.com/TunerStudio/mac/MacInstructions.html
taking care of RXTXcomm.jar & librxtxSerial.jnilib

For those interested in generating specific PWM frequency and duty cycle outside of standard arduino PWM libraries, i've used 16-bit timer on my mega board to generate both channels then connect both pin outputs via 10K resistor towards both analog inputs (0 and 1). I take this opportunity to fix a little error on my other threads found thanks to arduino scope:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1252073278/15#28
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1257113480/0#9

On a side note with MEGA board, just use
Code:
PRR0 &= ~BIT(PRADC);
instead of using on DUAMILANOVE board
Code:
PRR &= ~BIT(PRADC);
which means Alvaro's scketch is universal on both boards.
« Last Edit: November 11, 2009, 10:50:44 pm by selfonlypath » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've tried to narrow down that problem and I have found a potential race condition while messing with flags. This is related to arduino sketch, not java or Mac. Can you please give it a try ?

Other think that might be happening is packet loss from mac to arduino, but I sincerly doubt it.

Another question: does it freeze without your intervention, or while you change the controls ?

Álvaro
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Alvaro - The freezing happens with both mega or duamilanove boards. I'm glad to hear it is not related to Mac or Java but only arduino sketch because i really hope success with arduino scope for many of us wether PC, Linux, Mac,...

To answer your query and after many trials yesterday & this morning: it freezes after a while without intervention on my side and as I mentionned to you privately, there is no packet loss detected by software when I lauch Mac terminal shell. To lauch again the scope, I usually press one time, sometimes two times the dual channel button with my mouse so it works again then freezes after a while but the working duration is random (can be a few seconds, sometimes one minute).

Hope it helps
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I had a friend testing this on a Mac, and he did not experience any freeze.

You tested again with my latest sketch, right ?

If you did, then my conclusion is that somehow your packets are reaching arduino with losses or checksum errors. We can try to narrow that down if you feel you have the time.

Other thing I can do is retry the "SAMPLE" command if it does not get a response in, let's say, one second.

Do you have any errors in "dmesg" about the ftdi driver ? I often have.

Álvaro
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I had a friend testing this on a Mac, and he did not experience any freeze.
I'm using iMac G5 running with Mac OS Tiger, what is your friend Mac & OS ?

I'm using arduino version 15, what is your arduino version to compile then download ?

Quote
You tested again with my latest sketch, right ?
I believe so, tested the sketch you sent me by mail yesterday but to be sure, please send me again your last sketch.

BTW. Do you happen to have a java scope window providing time scale ?

Quote
Do you have any errors in "dmesg" about the ftdi driver ? I often have.
We did test together via skype chat yesterday, no error message at all.
« Last Edit: November 12, 2009, 02:54:50 pm by selfonlypath » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm using iMac G5 running with Mac OS Tiger, what is your friend Mac & OS ?
Not sure, I'll ask him. I remember he had to switch to Java 32 bit, cause he's on a 64-bit platform.

Quote
I believe so, tested the sketch you sent me by mail yesterday but to be sure, please send me again your last sketch.
So you did not use latest smiley That was before I fixed the race condition.
You can always get the latest version here: http://github.com/alvieboy/arduino-oscope

Quote
We did test together via skype chat yesterday, no error message at all.
Yes we did, but we only checked for errors coming from the application, not from the operating system itself.

Please try that last sketch (commitID d0e216e376c8cd44dbf82fa28029d106534cc7af, message "Fix a potential race acessing gflags ")

Direct link: http://github.com/alvieboy/arduino-oscope/raw/master/oscope.pde

You can see what I changed using this: http://github.com/alvieboy/arduino-oscope/commit/d0e216e376c8cd44dbf82fa28029d106534cc7af

I really hope it helps.

Álvaro
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Not sure, I'll ask him. I remember he had to switch to Java 32 bit, cause he's on a 64-bit platform.
I'm using Mac OS X version 10.4.11 on 1.8GHz powerPC G5 and also on a 2.0 GHz PowerPC G5. I don't understand or know how to swtich Java 32bit versus 64 bit smiley-sad

Quote
You can always get the latest version here: http://github.com/alvieboy/arduino-oscope
I'll try your new sketch (.pde and .h) but I cannot find your new arduino-oscope.jar !
What should i do to compile or build arduino-oscope.jar from your java files on my Macintosh ?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'll try your new sketch (.pde and .h) but I cannot find your new arduino-oscope.jar !
It's also there, in the downloads section.
Quote
What should i do to compile or build arduino-oscope.jar from your java files on my Macintosh ?
You need JDK and ant. Perhaps you already have that installed. I'll send you more instructions by email.

Álvaro
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It's also there, in the downloads section.
I've downloaded the all thing but cannot see any *.jar !
Can you provide direct link to it inside http://github.com/alvieboy/arduino-oscope
Thx
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry for the late reply ;(

You can download it here:

http://cloud.github.com/downloads/alvieboy/arduino-oscope/oscope-snapshot-v2-20091112.zip
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

it says access denied smiley-sad
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Some problem with github....

Try this one:

http://alvie.com/files/projects/oscope/arduino-oscope-snapshot-20091112.zip
Logged

Pages: [1] 2 3   Go Up
Jump to: