MegaTunix on OS-X (revised)

Questions specific to Megatunix - alternate tuning software that runs on unix and windows.
Note that Megatunix is obsolete.

Moderator: djandruczyk

Did this work for you?

Yes
4
67%
No
1
17%
It had a problem somewhere, I posted a question in this thread.
1
17%
 
Total votes: 6

djandruczyk
MS/Extra Guru
Posts: 1210
Joined: Fri May 07, 2004 6:55 pm
Location: Rochester, NY, U.S.A.
Contact:

Re: Dash close caused crash

Post by djandruczyk »

24c wrote:Dave, probably sick of my comments by now, but Terminal on OSX was spitting this out. Megatunix opened, connected etc, but I had another dash open! Closed it and it crashed...

Code: Select all

bash-3.2$ megatunix
Xlib:  extension "RANDR" missing on display "/tmp/launch-0Au8mf/:0".
threads.c: thread_dispatcher()
        Thread created!
threads.c: thread_dispatcher()
        LINK DOWN, Initiating serial repair thread!
mscommon_comms.c: serial_repair_thread()
        Thread created!
mscommon_comms.c: serial_repair_thread()
        Thread exiting, device found!
interrogate.c: load_firmware_details()
        Detected Firmware: MS2-Extra V3.1.0 series
dashboard.c: link_dash_datasources
        Bad things man!, object doesn't exist for bcDC
dashboard.c: link_dash_datasources
        Bad things man!, object doesn't exist for bcDC
megatunix(20649,0x7fff70dcfca0) malloc: *** error for object 0x1013c2890: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap
bash-3.2$ 
The reports are fine, I appreciate the testing and feedback immensely. This means you have a dash chosen that uses a datasource that is undefined within the current set of variables available from this firmware. (bcDC == boost controller DutyCycle) It is not a fatal error, however the malloc error is important. If that is a debug build (./configure --enable-debug ; make clean ; make ; sudo make install), run it under gdb (gdb src/.libs/megatunix) and use "break malloc_error_break", followed by "run" and when it hits that point gdb will stop it , type "backtrace", and send me the info about where it's complaining.
David J. Andruczyk
MegaTunix author. The only non-java cross platform tuning software for MS-I/II hardware.
Where to get and how to install:
http://msextra.com/viewtopic.php?t=23080
http://sourceforge.net/projects/megatunix
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

More stuff, MegaTunix wasn't getting past splash screen after clicking Find My ECU. It was hanging on the comms thread, and as it was working OK on Linux Mint, I pulled the latest git, and followed the usual instructions for the modular_0.4 branch. Unfortunately, the behaviour is still the same on OSX, but the serial led diagnostic plug wasn't. In Linux using the PL2303 USB Serial adaptor, I am looking for port ttyUSB0, and as soon as I click Find My ECU the DTR & RTS pins go red, leaving just the RXD & TXD active. When I fire up in OSX (and it has worked before!), the DTR pin is staying open.

After reading one of your responses in the Linux Mint thread & think this was the /dev/cu.xxxx link, I fired up Terminal, and did

Code: Select all

 open .MegaTunix/config
MegaTunix_config_before.png
Sure enough there was a lot of potential port "cruft", & the override port was incorrect, so I edited it.
MegaTunix_config_after.png
However MegaTunix is still not opening past this "choose my ECU family?" phase , or altering the serial port behaviour. Is there anywhere else I should dabble? Should I change the potential port priority? in the config file, by moving the detected port to the top of the queue.

PS If I go into Offline mode, MegaTunix "works" & loads correctly, but isn't connected obviously.
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

Just a little update, just queried the MicroSquirt using "Q" & "S", and it shows the same DTR pin active on the serial connector diagnostic plug, as well as the expected RXD & TXD pins, and it communicates fine.
OSX_PL2303_query_MicroSquirt.png
Also tried to go into Offline Mode and load a previous snapshot, this happened in Terminal

Code: Select all

Last login: Sat Feb 12 10:32:51 on ttys000
Mike-Cranes-iMac27:~ mikecrane$ megatunix
Xlib:  extension "RANDR" missing on display "/tmp/launch-wdq7e4/:0".
threads.c: thread_dispatcher()
	Thread created!
interrogate.c: load_firmware_details()
	Detected Firmware: MS2-Extra V3.1.0 series
dashboard.c: link_dash_datasources
	Bad things man!, object doesn't exist for fueladc
dashboard.c: link_dash_datasources
	Bad things man!, object doesn't exist for fueladc
dashboard.c: link_dash_datasources
	Bad things man!, object doesn't exist for mapadc
mscommon_comms.c: restore_update()
	Thread created!
mscommon_comms.c: restore_update()
	Thread exiting!
gui_handlers.c: LEAVE() after stop_realtime
gui_handlers.c: LEAVE() after stop_lv_playback
gui_handlers.c: LEAVE() after stop_datalogging
gui_handlers.c: LEAVE() before burn
gui_handlers.c: LEAVE() after burn
gui_handlers.c: LEAVE() configuration saved
threads.c: thread_dispatcher()
	MegaTunix is closing, Thread exiting !!
gui_handlers.c: LEAVE() after iochannel
megatunix(15170,0x7fff70dcfca0) malloc: *** error for object 0x108323928: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Abort trap
Mike-Cranes-iMac27:~ mikecrane$ 
Crash report saved here,
MegaTunix_offline_load_snapshot.rtf
EDIT. I have just found out this after dropping on an Arduino forum, so when the DTR pin is low, the led is red. So that explains why MegaTunix in Linux & OSX have different behaviour. The DTR pin is staying high in OSX, but in Linux it goes low when you click Find My ECU.
DTR_goes_low.png
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

Using my iMac i7 I am having problems trying to connect to the ECU. It is hanging at this point...
MegaTunix_hanging at this point.png
I have git pulled the latest version, removed the cruft. MegaTunix is looking for the right port, and attempting to connect, just doesn't manage to find my ECU. I am running 64bit, tried numerous Prolific PL2303 drivers, and still no change in behaviour.

Any ideas?

PS Works fine in Linux Mint 10 using same USB port & adapter, and I can resume Linux after several restarts using Parallels VM software, and it connects no problems.
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

OK, trying to learn some gdb commands after previous keeps giving me syntax errors.
Using gdb in Terminal,

Code: Select all

file MegaTunix
spits this out...
gdb_file_MegaTunix.rtf
What does this mean, please?

Then I tried the breakpoint stuff from above...and got this.

Code: Select all

Reading symbols from /usr/local/bin/megatunix...done.
(gdb) break malloc_error_break
Breakpoint 1 at 0x126e978d4eef76d
(gdb) run
Starting program: /usr/local/bin/megatunix 
Reading symbols for shared libraries .+++++++++++++++++++++++++++++++++++++++++++++++++++++.......................................................................................... done
Xlib:  extension "RANDR" missing on display "/tmp/launch-KvYKw9/:0".
Reading symbols for shared libraries . done 
so I click on Find my ECU...and Terminal spits this out

Code: Select all

Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
threads.c: thread_dispatcher()
	Thread created!
threads.c: thread_dispatcher()
	LINK DOWN, Initiating serial repair thread!
mscommon_comms.c: serial_repair_thread()
	Thread created!
backtrace

I did try backtrace, but the Terminal session is unresponsive, that is you can type stuff, but nothing happens, almost as if it's waiting for MegaTunix to finish :?

...and then when I try to Exit or close the window, MegaTunix is unresponsive, and spits this out.

Code: Select all

gui_handlers.c: LEAVE() after stop_realtime
gui_handlers.c: LEAVE() after stop_lv_playback
gui_handlers.c: LEAVE() after stop_datalogging
gui_handlers.c: LEAVE() before burn
gui_handlers.c: LEAVE() after burn
gui_handlers.c: LEAVE() configuration saved
gui_handlers.c: LEAVE() after iochannel
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
djandruczyk
MS/Extra Guru
Posts: 1210
Joined: Fri May 07, 2004 6:55 pm
Location: Rochester, NY, U.S.A.
Contact:

Re: MegaTunix on OS-X (revised)

Post by djandruczyk »

OK, here's some tips. GDB will only accept commands if the program being debugged either crashes, stops at a breakpoint or is explicitely stopped with "ctrl-C". So do the following:

gdb /usr/local/bin/megatunix
run
<do whatever you need to to make megatunix appear to freeze>
hit Ctrl-C in GDB to cause it to stop
backtrace

send me that output so I have a rough idea where it seems to be hanging. I suspect its a tty.**** vs cu.***** device driver issue, where one is demanding hardware flow control lines to be in a specific state (which isn't possiblewiht megasquirt since the hardware flow control lines are not used) before the "open()" call returns, which causes the deadlock. This seems to be a Mac OS-X only issue as far as I can tell.
David J. Andruczyk
MegaTunix author. The only non-java cross platform tuning software for MS-I/II hardware.
Where to get and how to install:
http://msextra.com/viewtopic.php?t=23080
http://sourceforge.net/projects/megatunix
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

Thanks for those pointers Dave, it's all new to me, this command line stuff. :)

So I did what I usually do, and start MegaTunix,

Code: Select all

(gdb) run
Starting program: /usr/local/bin/megatunix 
Reading symbols for shared libraries .+++++++++++++++++++++++++++++++++++++++++++++++++++++.......................................................................................... done
Xlib:  extension "RANDR" missing on display "/tmp/launch-KvYKw9/:0".
Reading symbols for shared libraries . done 
Hit Find my ECU on the dialog box after the splash screen...

Code: Select all

Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
threads.c: thread_dispatcher()
	Thread created!
threads.c: thread_dispatcher()
	LINK DOWN, Initiating serial repair thread!
mscommon_comms.c: serial_repair_thread()
	Thread created! 
MegaTunix hangs...so hit Control-C

Code: Select all

^C
Program received signal SIGINT, Interrupt.
0x00007fff869eae92 in select$DARWIN_EXTSN ()
Type backtrace

Code: Select all

(gdb) backtrace
#0  0x00007fff869eae92 in select$DARWIN_EXTSN ()
#1  0x00000001010667a2 in g_poll ()
#2  0x0000000101059508 in g_main_context_iterate ()
#3  0x0000000101059805 in g_main_loop_run ()
#4  0x00000001005eac70 in gtk_main ()
#5  0x0000000100031500 in main (argc=1, argv=0x7fff5fbffa00) at main.c:162
(gdb) 
djandruczyk wrote:send me that output so I have a rough idea where it seems to be hanging. I suspect its a tty.**** vs cu.***** device driver issue, where one is demanding hardware flow control lines to be in a specific state
The odd thing is MegaTunix works on my 32bit MacBook, on a not updated git & modular_0.4 branch, but not on the 64bit iMac, and both are running same 10.6.6 installs, and displays the same port behaviour with the RS232 inline diagnostic connector. I just wonder if something else was using the serial port, but if it was I would have a resource busy response when using "screen" commands in Terminal.
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
djandruczyk
MS/Extra Guru
Posts: 1210
Joined: Fri May 07, 2004 6:55 pm
Location: Rochester, NY, U.S.A.
Contact:

Re: MegaTunix on OS-X (revised)

Post by djandruczyk »

Perhaps the 64 bit serial driver is broken? or actining differently than the 32 bit one? compare the drive infor in about this mac/system profiler between the systems and do some research if there's any open errata on the versions you run.

Unfortunately my mac isn't 64 bit capable so I can't test on that sort of hardware.
David J. Andruczyk
MegaTunix author. The only non-java cross platform tuning software for MS-I/II hardware.
Where to get and how to install:
http://msextra.com/viewtopic.php?t=23080
http://sourceforge.net/projects/megatunix
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

djandruczyk wrote:Perhaps the 64 bit serial driver is broken? or acting differently than the 32 bit one?
The odd thing is, Linux Mint 10, TunerStudio in all flavours (OSX, Windows XP & Linux) work with this driver, but I will check the .kext and see if there is a variation, but I'm not sure it is this now.
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

OK, iMac i7 driver info
iMac_i7_PL2303_driver.png
I'll have to take a snapshot of the MacBook Pro and update/edit this post.
MacBookPro_PL2303_driver.png
So there are differences in the version number dates, but not the actually version numbers. Obviously the MacBook Pro one isn't 64 bit, so it says No in that column . I'll try and upgrade the driver to the later version and see if this breaks MegaTunix.
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

I used a different driver, and I now have a 64bit compatible one working on the MacBook Pro
alt_PL2303_driver.png
but sticking with using gdb, and after more reading, using list, I get this

Code: Select all

(gdb) list
47	 \brief main() is the typical main function in a C program, it performs
48	 all core initialization, loading of all main parameters, initializing handlers
49	 and entering gtk_main to process events until program close
50	 \param argc (gint) count of command line arguments
51	 \param argv (char **) array of command line args
52	 \returns TRUE
53	 */
54	gint main(gint argc, gchar ** argv)
55	{
56		Serial_Params *serial_params = NULL;
(gdb) 
and then exit

Code: Select all

(gdb) finish
Run till exit from #0  0x00007fff869eae92 in select$DARWIN_EXTSN ()
0x00000001010667a2 in g_poll ()
(gdb) 
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

OK running gdb and checking both the working MacBook Pro vs the non working iMac i7.

iMac first

Code: Select all

(gdb) run
Starting program: /usr/local/bin/megatunix 
Reading symbols for shared libraries .+++++++++++++++++++++++++++++++++++++++++++++++++++++.......................................................................................... done
Xlib:  extension "RANDR" missing on display "/tmp/launch-oZkwWs/:0".
Reading symbols for shared libraries . done
^C
Program received signal SIGINT, Interrupt.
0x00007fff869eae92 in select$DARWIN_EXTSN ()
(gdb) list
47	 \brief main() is the typical main function in a C program, it performs
48	 all core initialization, loading of all main parameters, initializing handlers
49	 and entering gtk_main to process events until program close
50	 \param argc (gint) count of command line arguments
51	 \param argv (char **) array of command line args
52	 \returns TRUE
53	 */
54	gint main(gint argc, gchar ** argv)
55	{
56		Serial_Params *serial_params = NULL;
(gdb) continue
Continuing.
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
threads.c: thread_dispatcher()
	Thread created!
threads.c: thread_dispatcher()
	LINK DOWN, Initiating serial repair thread!
mscommon_comms.c: serial_repair_thread()
	Thread created!
^C
Program received signal SIGINT, Interrupt.
0x00007fff869eae92 in select$DARWIN_EXTSN ()
(gdb) list
57		GAsyncQueue *queue = NULL;
58		GCond *cond = NULL;
59		GMutex *mutex = NULL;
60		gint id = 0;
61		setlocale(LC_ALL,"");
62	#ifdef __WIN32__
63		bindtextdomain(PACKAGE, "C:\\Program Files\\MegaTunix\\dist\\locale");
64	#else
65		bindtextdomain(PACKAGE, LOCALEDIR);
66	#endif
(gdb)
and the MacBook Pro

Code: Select all

(gdb) run
Starting program: /usr/local/bin/megatunix 
Reading symbols for shared libraries .+++++++++++++++++++++++++++++++++++++++++++++++++++++.......................................................................................... done
Xlib:  extension "RANDR" missing on display "/tmp/launch-gL4BwP/:0".
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
interrogate.c: load_firmware_details()
	Detected Firmware: MS2-Extra V3.1.0 series
^C
Program received signal SIGINT, Interrupt.
0x00007fff84add322 in semaphore_wait_signal_trap ()
(gdb) list
46	 \brief main() is the typical main function in a C program, it performs
47	 all core initialization, loading of all main parameters, initializing handlers
48	 and entering gtk_main to process events until program close
49	 \param argc (gint) count of command line arguments
50	 \param argv (char **) array of command line args
51	 \returns TRUE
52	 */
53	gint main(gint argc, gchar ** argv)
54	{
55		Serial_Params *serial_params = NULL;
(gdb) continue
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x00007fff84add322 in semaphore_wait_signal_trap ()
(gdb) list
56		GAsyncQueue *queue = NULL;
57		GCond *cond = NULL;
58		GMutex *mutex = NULL;
59		gint id = 0;
60		setlocale(LC_ALL,"");
61	#ifdef __WIN32__
62		bindtextdomain(PACKAGE, "C:\\Program Files\\MegaTunix\\dist\\locale");
63	#else
64		bindtextdomain(PACKAGE, LOCALEDIR);
65	#endif
(gdb) 
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

This alternative driver has reverted the MegaTunix Linux Mint 10 to have the same behaviour now, hanging at the Find my ECU stage. :(

So more stuff to put right now :)
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

Got MegaTunix up & running on Linux Mint 10 eventually.

Tried swapping OSX drivers, restarting OSes, pulling the latest git within Mint, updating Mint etc, using gdb and getting errors, but in the end, I just used Terminal and

Code: Select all

screen /dev/ttyUSB0 115200

and queried with "Q" & "S" to check the comms, and I did get the desired responses.
IIRC, I next fired up MegaTunix, it hung as usual, so I clicked the General tab, it was stuck on interrogating, so I clicked on Interrogate ECU box, then clicked on the Offline mode box, and exited MegaTunix. The DTR & RTS were red at this point when I reopened MegaTunix, and then it found my ECU. Most odd & very confusing, but it's working again ....phew.

OSX on the iMac i7 is still refusing to play ball. It will work in TunerStudio on the same port & adapter, and I can check the firmware & signature comms in Terminal using

Code: Select all

screen /dev/tty.PL2303-001014FD 115200
Tried googling to no avail. :|
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

Still no joy on the iMac i7, just some stuff to look at.

Code: Select all

(gdb) run
Starting program: /usr/local/bin/megatunix 
Reading symbols for shared libraries .+++++++++++++++++++++++++++++++++++++++++++++++++++++.......................................................................................... done
Xlib:  extension "RANDR" missing on display "/tmp/launch-1Z1iRW/:0".
Reading symbols for shared libraries . done
^C
Program received signal SIGINT, Interrupt.
0x00007fff869eae92 in select$DARWIN_EXTSN ()
(gdb) backtrace
#0  0x00007fff869eae92 in select$DARWIN_EXTSN ()
#1  0x00000001010667a2 in g_poll ()
#2  0x0000000101059508 in g_main_context_iterate ()
#3  0x0000000101059805 in g_main_loop_run ()
#4  0x000000010056f97d in gtk_dialog_run ()
#5  0x00000001000360fc in personality_choice () at personalities.c:198
#6  0x00000001009bf889 in gdk_threads_dispatch ()
#7  0x000000010105668d in g_timeout_dispatch ()
#8  0x0000000101055f19 in g_main_context_dispatch ()
#9  0x00000001010594f1 in g_main_context_iterate ()
#10 0x0000000101059805 in g_main_loop_run ()
#11 0x00000001005eac70 in gtk_main ()
#12 0x0000000100031500 in main (argc=1, argv=0x7fff5fbffa00) at main.c:162
(gdb) continue
Continuing.
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
threads.c: thread_dispatcher()
	Thread created!
threads.c: thread_dispatcher()
	LINK DOWN, Initiating serial repair thread!
mscommon_comms.c: serial_repair_thread()
	Thread created!
^C
Program received signal SIGINT, Interrupt.
0x00007fff869eae92 in select$DARWIN_EXTSN ()
(gdb) backtrace
#0  0x00007fff869eae92 in select$DARWIN_EXTSN ()
#1  0x00000001010667a2 in g_poll ()
#2  0x0000000101059508 in g_main_context_iterate ()
#3  0x0000000101059805 in g_main_loop_run ()
#4  0x00000001005eac70 in gtk_main ()
#5  0x0000000100031500 in main (argc=1, argv=0x7fff5fbffa00) at main.c:162
(gdb) list
47	 \brief main() is the typical main function in a C program, it performs
48	 all core initialization, loading of all main parameters, initializing handlers
49	 and entering gtk_main to process events until program close
50	 \param argc (gint) count of command line arguments
51	 \param argv (char **) array of command line args
52	 \returns TRUE
53	 */
54	gint main(gint argc, gchar ** argv)
55	{
56		Serial_Params *serial_params = NULL;
(gdb) finish
Run till exit from #0  0x00007fff869eae92 in select$DARWIN_EXTSN ()
0x00000001010667a2 in g_poll ()
(gdb) kill
Kill the program being debugged? (y or n) y
(gdb) 
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

**** SOLVED *****

I noticed I could talk using Terminal to the Microsquirt, but the DTR & RTS lines were open normally using the RS232 diagnostic adapter. The behaviour in TunerStudio was similar, but it seemed slightly faster at detecting the MicroSquirt, but it was really just a difference in the way they loaded.

Using the following in Terminal

Code: Select all

open .MegaTunix/config
I noticed my baud rate was 9600 by default, and I had a lot of extra ports, all dev/tty.* or dev/tty* variants. I tried to talk to the MicroSquirt using

Code: Select all

screen /dev/tty.PL2303-001014FD 9600
and as it wouldn't respond I changed the baud rate to 115200 from 9600 in the config file.

I noticed in TunerStudio I could use dev/cu & dev/tty, but MegaTunix would only see dev/tty & serialPort.

Then it hit me...I had read about Arduinos and AVRs having to use dev/cu.* in OSX and modify the serial open() command...so I modded the config file from this.
old_config.png
to this
new_config.png
So Dave, all you do is change the /dev/tty.yourPortName to /dev/cu.yourPortname and bingo! So maybe you need to mod the Locate Port function to look for the /dev/cu version if OSX is detected, or another option is to be able to enter your port ID and save this as your "preferred port" and it updates the config file. :idea:
MegaTunix_iMac_i7_works.png
The sad thing in the back of my mind, I now remember having seen this before on an early pre git version of MegaTunix, and what have I just seen re-reading the thread, that you mentioned a few posts back.
djandruczyk wrote:...I suspect its a tty.**** vs cu.***** device driver issue...
:lol:

PS Plus I had this working from git before on this iMac, but I must have broken it when I updated the git or used the Locate Port button. :oops:

PPS Another thing I have noticed, is that my VETable or Spark Table is always present when I open MegaTunix now, whereas before I would see a table full of zeros, even though it said it was updating on starting up. 8)
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
djandruczyk
MS/Extra Guru
Posts: 1210
Joined: Fri May 07, 2004 6:55 pm
Location: Rochester, NY, U.S.A.
Contact:

Re: MegaTunix on OS-X (revised)

Post by djandruczyk »

Thanks for the VERY THOROUGH investigating.

The baud in the conf file should have ZERO EFFECT however, as that isn't even used, it's a deprecated variable and isn't even read or saved. The baud rate is now defined in the per ecu "personality" config file that is loaded WHEN you make a personality choice just after megatunix starts up. (i.e. MS1, MS2, Jimstim, etc)

I still want to get mtx to work properly whether it's a cu or tty device, someone sent me a link a while back that described a potential workaround, but I haven't had an opportunity to give it a try yet.
David J. Andruczyk
MegaTunix author. The only non-java cross platform tuning software for MS-I/II hardware.
Where to get and how to install:
http://msextra.com/viewtopic.php?t=23080
http://sourceforge.net/projects/megatunix
djandruczyk
MS/Extra Guru
Posts: 1210
Joined: Fri May 07, 2004 6:55 pm
Location: Rochester, NY, U.S.A.
Contact:

Re: MegaTunix on OS-X (revised)

Post by djandruczyk »

I just pushed up some changes that should help things for FUTURE users. First, off the port locator will filter out the tty.* devices on os-X, second,it won't show ports mtx already knows about. (i.e. from previous runs of the port locator).

Give it a try (git pull origin master ; make ; sudo make install ; mv ~/.MegaTunix/config ~/.MegaTunix/config.old ; ./src/megatunix)

NOTE: it WILL NOT find your port by default , since you're starting with a fresh config file, so use the "locate port" button on hte Comms tab and follow the prompts and it should detect and work better out of the box. Lemme know if it does.
David J. Andruczyk
MegaTunix author. The only non-java cross platform tuning software for MS-I/II hardware.
Where to get and how to install:
http://msextra.com/viewtopic.php?t=23080
http://sourceforge.net/projects/megatunix
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

djandruczyk wrote:I still want to get mtx to work properly whether it's a cu or tty device, someone sent me a link a while back that described a potential workaround, but I haven't had an opportunity to give it a try yet.
The only one I saw was the AVR board link I found on google, and this on macrumors.

Anyway did as you said, I think. MegaTunix is broken again and hanging at the same point as before now, but it now sees the /dev/tty.portID & /dev/tty.portID, when you use Locate Port. This time I think I got the "The ECU appears to be disconnected. This means..." dialog box with the two choices, Exit Megatunix or Go to Offline mode at the bottom. However, after looking under the Communications tab, it's looking at the /dev/tty.portID, so that's why it is hanging.

It might be useful if at this dialog box, there was an option to select or enter a comms or portID. It would seem logical at this point to give you the choice.

Just in case I have done something stupid, or not done something, here's the Terminal & following gdb session with a backtrace...as an attachment, too many characters.
new_session.rtf
Here's the new config file after updating...
newest_config.png
Unfortunately, the list of potential ports hasn't been culled, so I deleted all except /dev/cu.PL2303-001014FD, and saved the file. Opened MegaTunix, and it fired up OK, and connected straight away, as you can see from this session.

Code: Select all

Last login: Sun Feb 20 05:30:55 on ttys000
Mike-Cranes-iMac27:~ mikecrane$ open .MegaTunix/config
Mike-Cranes-iMac27:~mikecrane$ megatunix
Xlib:  extension "RANDR" missing on display "/tmp/launch-1Z1iRW/:0".

(megatunix:21422): Gtk-WARNING **: Unable to find default local directory monitor type

(megatunix:21422): Gtk-WARNING **: Unable to find default local directory monitor type

Mike-Cranes-iMac27:~ mikecrane$ open .MegaTunix/config
Mike-Cranes-iMac27:~ mikecrane$ 
*The Gtk-WARNING happens when I save the Internal Log & Snapshot.

Modded config file looks like this...
only_cu__in _potential_ports_config.png
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
24c
Master MS/Extra'er
Posts: 847
Joined: Tue Jan 20, 2009 10:21 am
Location: Lancashire UK
Contact:

Re: MegaTunix on OS-X (revised)

Post by 24c »

FYI, the MacBook Pro was awkward to get comms going originally, as you can see by the config file potential ports entries. I assume MegaTunix used to create these extra ones when you click on Locate Port.
MacBookPro_config.png
The answer as to why the MacBook worked with the same USB Serial adapter and the iMac didn't was in the config file all along, (yellow highlight). :oops:

Another link on dev/cu vs dev/tty on OSX
Yamaha GTS1000 v2 MicroSquirt, B&G 2.891
Yamaha GTS1000 v3 beta MicroSquirt, B&G3.760
Yamaha GTS1000 MSExtra 3.1, Dual VR Board
Yamaha YZF1000 MSExtra 3.1
Post Reply