MS2 development/coding for dummies

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

Moderators: daxtojeiro, muythaibxr, jsmcortina

Re: MS2 development/coding for dummies

Postby elsp1991 » Thu May 17, 2012 11:53 am

Hey guys I'm working for my Fsae team and i want to implement a traction control so i want to be able to change the advance on the run and cut some spark events if spark retard is not enough. And i was thinking if it is possible to do something wrong that could make ms2 unprogramable?
elsp1991
MS/Extra Newbie
 
Posts: 2
Joined: Sat Mar 19, 2011 10:14 am

Re: MS2 development/coding for dummies

Postby gslender » Fri May 18, 2012 1:41 pm

elsp1991 wrote:Hey guys I'm working for my Fsae team and i want to implement a traction control so i want to be able to change the advance on the run and cut some spark events if spark retard is not enough.


What you want to do is possible, but on an ms2 the big issue will be available inputs to detect when you've lost traction.

And i was thinking if it is possible to do something wrong that could make ms2 unprogramable?


It is, but you can just trip the boot jumper and reset the ms2 back to a state that will allow serial programming again.

I've had to rely on that a few times when I crash the CPU or do some code loops that stop serial interrupts from being active.

G
Mazda MX5 91 NA6 LE | M45 Mini SC | 4-2-1 Extractors & HI-Flow Exhaust | HSD HR Coilovers | MS2 DIYPNP Full Seq running ms2extra pre3.3alpha5 gslender v2.8 | Toyota COP | RX8 425cc Inj | W2A Intercooled
User avatar
gslender
Super MS/Extra'er
 
Posts: 1014
Joined: Fri Sep 16, 2011 5:29 am
Location: Brisbane, Australia

Re: MS2 development/coding for dummies

Postby elsp1991 » Mon May 21, 2012 3:10 am

Ok this is the thing i want to do with MS2. An avr will produce a analog output. And i have some question

1. The thing is that i dont know the internal variable of adc7, do you know where i can find this info.
2. should i put this tile in several places or just before the end of the main loop? cause i notice that ms2 do launch in several lines??!!

3. user_value_1 = my spark retard
user_value_2 = adc prescaler in order to convert 0-1024 range to 0-50
(????adc7???) = adc7 input signal


Code: Select all
                                                //my code
user_value_1 = user_value_2*(????adc7???);

   if (user_value_1 >= 20) //spark retard is not enough cut some events
      {
      user_value_1 = 20;

      spk_cutx = 4;
      spk_cuty = 7;

      outpc.status2 |= status2_spkcut; //do spark cut with above x,y
      }

   else if (user_value_1 <= 20) //spark retard is enough dont need to cut events
      {
      outpc.status2 &= ~status2_spkcut; //disable spark cut
      }
              else if (user_value_1 <=0)
              {
              user_value_1 = 0;
              outpc.status2 &= ~status2_spkcut; //disable spark cut
              }

lsum += user_value_1;     
                                                  //end of my code




outpc.adv_deg = (int)lsum;  // Report advance before we fudge it
elsp1991
MS/Extra Newbie
 
Posts: 2
Joined: Sat Mar 19, 2011 10:14 am

Re: MS2 development/coding for dummies

Postby m3ltd0wn » Tue Jun 12, 2012 12:44 am

take a look in megasquirt 1 and see how traction control/anti-rev is done, it is a crude implementation but it does it's job, too bad it didn't make it in ms2-extra code, it would be very usefull even if it was just rpm based.
m3ltd0wn
Helpful MS/Extra'er
 
Posts: 126
Joined: Sun Oct 03, 2010 2:32 am

Re: MS2 development/coding for dummies

Postby jsmcortina » Tue Jun 12, 2012 1:24 am

elsp1991 wrote:1. The thing is that i dont know the internal variable of adc7, do you know where i can find this info.

Example on how to search for stuff:
Code: Select all
[jsm@jsm2 ms2extra]$ grep -i adc7 *.c
ms2_extra_main.c:  retard based on ADC7 sensor.
ms2_extra_misc.c:            outpc.adc7 = ATD0DR7;
ms2_extra_misc.c:            tmpadc = outpc.adc7;
ms2_extra_misc.c:            tmpadc = outpc.adc7;
ms2_extra_misc.c:        txbuf.adc7 = outpc.adc7;

James
I can supply, repair or upgrade Megasquirts in UK.

My Success story: viewtopic.php?f=104&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
jsmcortina
Site Admin
 
Posts: 22804
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK

Re: MS2 development/coding for dummies

Postby Wergilius » Thu Jun 14, 2012 5:46 am

i use this editor for my small changes in the code, "find in files" and nice color coding makes life a little more easy.
http://www.editplus.com/
User avatar
Wergilius
Helpful MS/Extra'er
 
Posts: 126
Joined: Fri Sep 16, 2005 12:50 pm
Location: Stockholm, Sweden

Re: MS2 development/coding for dummies

Postby Peter Florance » Mon Dec 24, 2012 3:13 am

jsmcortina wrote:
Martin Young wrote:Anyway, I try to follow the instruction but having entered the tar command with the path to get to the tools.tar.gz file, nothing appears to happen. I don't know if anything ought to happen, but nothing does.

If it didn't give an error message then it worked.
If you prefer to see tons of output, use:

cd /
tar xvfz <path>/tools.tar.gz

To see if it extracted:
ls -l /usr/bin/m9s*

James

Is that what one would do in Linux? I'd like to compile some code to test CANBus in BMW setup (apparently different ID's and multipliers).
When I tried above I got a bunch of errors, the last few being:

tar: usr/m68hc11-elf/lib/m9s12x/libm.a: Cannot open: No such file or directory
usr/m68hc11-elf/lib/m9s12x/libbcc.a
tar: usr/m68hc11-elf/lib/m9s12x/libbcc.a: Cannot open: No such file or directory
usr/m68hc11-elf/lib/libbcc.a
tar: usr/m68hc11-elf/lib/libbcc.a: Cannot open: No such file or directory
tar: Exiting with failure status due to previous errors


I'm really pretty much an idiot in Linux. :RTFM:
Peter Florance
PF Tuning
81 BMW Euro 528i ESP Car
60-2 Wheel LS2 Coils, Low Z Inj
Check your grounds: http://www.msextra.com/doc/general/grounding.html
User avatar
Peter Florance
Super MS/Extra'er
 
Posts: 3206
Joined: Fri Apr 02, 2004 8:40 pm
Location: Virginia Beach, VA

Re: MS2 development/coding for dummies

Postby robs » Tue Dec 25, 2012 3:07 pm

Not exactly sure what's wrong. A couple of things:

  1. you must be root to write to these directories. (either use sudo before the tar command or do "sudo su -" to log in as root full time).
  2. if you have put the tools.tar.gz file in /tmp, the commands you want to type are:
Code: Select all
cd /
tar xvfz /tmp/tools.tar.gz

You should then see a list of the various files and directories as they are created.

All that said, the error messages don't really look like you've got a problem with either of these things. Just can't think of anything else to suggest.

Have fun,

Rob.
robs
Experienced MS/Extra'er
 
Posts: 315
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: MS2 development/coding for dummies

Postby Peter Florance » Tue Dec 25, 2012 5:52 pm

I'll try that.
Thanks!
Peter Florance
PF Tuning
81 BMW Euro 528i ESP Car
60-2 Wheel LS2 Coils, Low Z Inj
Check your grounds: http://www.msextra.com/doc/general/grounding.html
User avatar
Peter Florance
Super MS/Extra'er
 
Posts: 3206
Joined: Fri Apr 02, 2004 8:40 pm
Location: Virginia Beach, VA

Re: MS2 development/coding for dummies

Postby jsmcortina » Thu Dec 27, 2012 5:00 pm

I'd also suggest that you use the current build tools release and see the instructions it includes.

http://www.msextra.com/tools

James
I can supply, repair or upgrade Megasquirts in UK.

My Success story: viewtopic.php?f=104&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
jsmcortina
Site Admin
 
Posts: 22804
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK

Previous

Return to MS2/Extra Development

Who is online

Users browsing this forum: No registered users and 1 guest