Serial protocol

This forum is for the discussion of other projects on Megasquirt/Microsquirt hardware that don't fit into any of the other forums

Moderators: jsmcortina, muythaibxr

Post Reply
grom_e30
Super MS/Extra'er
Posts: 4459
Joined: Thu Mar 08, 2012 12:44 pm
Location: UK

Serial protocol

Post by grom_e30 »

iv been playing with an arduino, grabbing info to display on a small screen from serial, and on ms2 v 3.3.2 it works pretty well, but when i try it on ms3 pre 1.3alpha9 it does not work so well, iv changed the data table length to match the f/w also increased the serial buffer to, i can get some info from it like rpm and afr1, also sometimes i get extra or duplicated bytes meaning i receive more than im expecting, is the serial protocol different between ms2 & ms3?
1990 bmw 320i daily driver with m20b25 ms3 sequential fuel, 380cc injectors, d585 coil near plug, home made cam sync, launch control, fan control, vss, homebrew egt logging what's next????
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Serial protocol

Post by racingmini_mtl »

The protocol is the same. The information specific to the command and data is in the ini file for the firmware you're using. If you're not getting the correct data, you likely have either a serial comm issue or an arduino issue.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
jsmcortina
Site Admin
Posts: 39613
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Serial protocol

Post by jsmcortina »

grom_e30 wrote:iv been playing with an arduino, grabbing info to display on a small screen from serial, and on ms2 v 3.3.2 it works pretty well, but when i try it on ms3 pre 1.3alpha9 it does not work so well, iv changed the data table length to match the f/w also increased the serial buffer to, i can get some info from it like rpm and afr1, also sometimes i get extra or duplicated bytes meaning i receive more than im expecting, is the serial protocol different between ms2 & ms3?
Is your CRC checking detecting these problems?

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".
grom_e30
Super MS/Extra'er
Posts: 4459
Joined: Thu Mar 08, 2012 12:44 pm
Location: UK

Re: Serial protocol

Post by grom_e30 »

I'm not totally sure if I'm using the CRC. But on ms2 set the table length as the och block size can read temp, AFR, battery and rpm. Chang block size as on ms3, can get AFR and rpm, but not temp or tps. When you mention the CRC is that aimed towards tuner studio using it or arduino? Looks like if got some homework to do tonight and read up on this lot some more
1990 bmw 320i daily driver with m20b25 ms3 sequential fuel, 380cc injectors, d585 coil near plug, home made cam sync, launch control, fan control, vss, homebrew egt logging what's next????
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Serial protocol

Post by racingmini_mtl »

jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
grom_e30
Super MS/Extra'er
Posts: 4459
Joined: Thu Mar 08, 2012 12:44 pm
Location: UK

Re: Serial protocol

Post by grom_e30 »

I have tried to look at that before but the file is not working.
1990 bmw 320i daily driver with m20b25 ms3 sequential fuel, 380cc injectors, d585 coil near plug, home made cam sync, launch control, fan control, vss, homebrew egt logging what's next????
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Serial protocol

Post by racingmini_mtl »

Click on the confirm line in the window you get with the link.
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
grom_e30
Super MS/Extra'er
Posts: 4459
Joined: Thu Mar 08, 2012 12:44 pm
Location: UK

Re: Serial protocol

Post by grom_e30 »

So would the CRC still be there with the A command?
1990 bmw 320i daily driver with m20b25 ms3 sequential fuel, 380cc injectors, d585 coil near plug, home made cam sync, launch control, fan control, vss, homebrew egt logging what's next????
jsmcortina
Site Admin
Posts: 39613
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Serial protocol

Post by jsmcortina »

grom_e30 wrote:I'm not totally sure if I'm using the CRC. But on ms2 set the table length as the och block size can read temp, AFR, battery and rpm. Chang block size as on ms3, can get AFR and rpm, but not temp or tps. When you mention the CRC is that aimed towards tuner studio using it or arduino? Looks like if got some homework to do tonight and read up on this lot some more
The CRC is the biggest single change in the protocol, you are supposed to use it to validate that the data you received is valid.

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".
grom_e30
Super MS/Extra'er
Posts: 4459
Joined: Thu Mar 08, 2012 12:44 pm
Location: UK

Re: Serial protocol

Post by grom_e30 »

I'm trying to wrap my head round this so to request the information from the ecu with the "A" command it should be 7 bytes long 0x00 0x01 0x41 0xd3 0xd9 0x9e 0x8b. Data length then the command followed by the crc
1990 bmw 320i daily driver with m20b25 ms3 sequential fuel, 380cc injectors, d585 coil near plug, home made cam sync, launch control, fan control, vss, homebrew egt logging what's next????
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Serial protocol

Post by racingmini_mtl »

The 'A' command will work without the wrapper and will then return an unwrapped response. But you won't know if there was any communication error. And if you do wrap it, then you're correct about the resulting command.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
grom_e30
Super MS/Extra'er
Posts: 4459
Joined: Thu Mar 08, 2012 12:44 pm
Location: UK

Re: Serial protocol

Post by grom_e30 »

OK is it always an unwrapped response from the A or if you wrap the command you get a wrapped response?
1990 bmw 320i daily driver with m20b25 ms3 sequential fuel, 380cc injectors, d585 coil near plug, home made cam sync, launch control, fan control, vss, homebrew egt logging what's next????
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Serial protocol

Post by racingmini_mtl »

If you send a wrapped command, you receive a wrapped response.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
Post Reply