MS2 debugging

This is a forum for discussing the development and testing of alpha MS2/Extra code. Documentation
(Runs on MS2 and Microsquirt)

Moderators: jsmcortina, muythaibxr

Post Reply
Papatewks
Helpful MS/Extra'er
Posts: 45
Joined: Mon Feb 06, 2023 6:01 pm

MS2 debugging

Post by Papatewks »

Trying to debug some custom code and getting stuck... I was trying to display some variable values by populating the TunerStudio dashboard with dummy values, e.g., have the TPS or CLT guage read the value of a variable. Having trouble getting that to happen, after reading through the *can.c and *misc.c sections. Is this a valid approach? Has anyone done it?
Also curious what the hardcore developers use. Does a 9x12/ms2 simulator exist? Or perhaps old school logic analyzer? I don't expect to reproduce those environments, but surely something exists...
Thanks!
jsmcortina
Site Admin
Posts: 39622
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 debugging

Post by jsmcortina »

On MS2, I found that storing data to "gpioadcX" was easiest. Nothing else is using that so there's no mixup about where the data is coming from.

I have never used a simulator for the microcontroller.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
Papatewks
Helpful MS/Extra'er
Posts: 45
Joined: Mon Feb 06, 2023 6:01 pm

Re: MS2 debugging

Post by Papatewks »

Thanks, that works :)
Papatewks
Helpful MS/Extra'er
Posts: 45
Joined: Mon Feb 06, 2023 6:01 pm

Re: MS2 debugging

Post by Papatewks »

I did find one tool that was extremely useful… ubug12. This connects to the monitor/bootstrap code through serial port 1, and allows 👀 at memory and registers. It also has support for breakpoints and single step, but monitor in the base 9s12 doesn’t seem to support that. Some special tool needed to update that…
Since it requires use of serial port, it can’t be used “live”. What I’ve been doing is letting the board get into an interesting state, then installing the bootstrap jumper and hitting reset. I can then connect to the cpu and access memory contents.
Should be able to use it live by compiling with addresses for second serial port so the monitor port is left alone. If possible to solder into port 2 cpu connections could imagine using port 1 for debugger and port 2 for ms. But no way these eyes and hands are up to the task :)
Post Reply