Can Protocol for egt board

General support questions and announcements for MS3. See also MS3 manuals.

Moderators: jsmcortina, muythaibxr

kubeq_sq
Experienced MS/Extra'er
Posts: 157
Joined: Thu May 06, 2010 11:53 am

Can Protocol for egt board

Post by kubeq_sq »

Hi, i make an egt board for my ms3 and i want to communicate with ms through can protocoll. I read carefully the pdf with can communication and i think i have understand the text. What i don't know wher to find in ini fike for my code where to send the values to the controller ( the adresses?) Could you tell me where to find the adresses for generic sensors 1-6 in ini file? I tried to find the topic with can, but there is can in every topic.
Can you help me?
Greetings from germany
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Can Protocol for egt board

Post by jsmcortina »

You don't send it directly. You need to configure the ECU to send a request and you reply to that.

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".
kubeq_sq
Experienced MS/Extra'er
Posts: 157
Joined: Thu May 06, 2010 11:53 am

Re: Can Protocol for egt board

Post by kubeq_sq »

Okey, than i was wrong.... I thought i can send the message in to the megasquirt without the request. Could you tell me where can i read more about that? Because in my opinion there is not much about that in the CAN pdf.

Update 17.02.17
Is here someone, that can help me?
kubeq_sq
Experienced MS/Extra'er
Posts: 157
Joined: Thu May 06, 2010 11:53 am

Re: Can Protocol for egt board

Post by kubeq_sq »

UPDATE 26.02.17:
If I good understand, when i look in TS in CAN parameters i see for the generic sensors 1-4 Table 7, offset 2.That mean, that for the sensor 1 offset is 2, for 2 is 4, for 3 is 6 for 4 is 8 and in the next line for sensor 5 table 7 offset 10.
Am i right?
Next question: send the MS3 CPU the myvaroffset, mavarblk and varbyt in MSQ_REQ? because in the text ( page 9/15 CAN Manual) there is wrote, that hese parameters are in MSG_RSP generated, but these parameters sends the MS CPU to the egt to fetch the data from, and i must than put the table and offset in messege identifier, when i send the answer?

Would megasquirt send the request for 4 sensors to my board at once? It would be possible from data lenght. Then i need only offset for the first sensor?

I think i understand a little bit how to make it :) Am i right?
kubeq_sq
Experienced MS/Extra'er
Posts: 157
Joined: Thu May 06, 2010 11:53 am

Re: Can Protocol for egt board

Post by kubeq_sq »

Hallo, could you tell me how is the mcp2515 in the ms3 board configured?? How many kps and so one??
Greetings from Germany
Jakub
grom_e30
Super MS/Extra'er
Posts: 4459
Joined: Thu Mar 08, 2012 12:44 pm
Location: UK

Re: Can Protocol for egt board

Post by grom_e30 »

500kbps
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????
kubeq_sq
Experienced MS/Extra'er
Posts: 157
Joined: Thu May 06, 2010 11:53 am

Re: Can Protocol for egt board

Post by kubeq_sq »

grom_e30 thanks :)
I am now fast ready with my code for test. But for tests i have only here ms2 and in car ms3 installed.
I have a question, for the ms2 code extra 3.3.x i should use this id http://www.msextra.com/doc/pdf/Megasqui ... -01-20.pdf
for old codes i should use this manual: http://www.megamanual.com/com/CAN.htm ??

Could you tell me also what bit timing configuration should i use for my mcp2515??
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Can Protocol for egt board

Post by jsmcortina »

Use the latest docs. I found the old Megamanual page too complicated to make sense of.

No idea on the MPC2515, see the datasheet.

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".
kubeq_sq
Experienced MS/Extra'er
Posts: 157
Joined: Thu May 06, 2010 11:53 am

Re: Can Protocol for egt board

Post by kubeq_sq »

thanks jsmcortina,
i am by this CAN protocol, i have set table 7 offset 2 and 10, board id 8. My board only listen to CAN, but i have logic state analyser and I noticed on CAN, that MS2 extra 3.4.2 sends two messages on CAN with ID 0x00088438, Data: 0x07, 0x0D, 0x08; ID: 00288438, Data: 0x07, 0x0E, 0x08. That makes no sense, since I have calculated the IDs for these tables and offsets : ID: 0x00094038, data fetched from MS should look like these: 0x07, 0x00, 0x48 (bit 4 not used); ID: 0x00294038, data fetched from MS: 0x07, 0x01, 0x44 (or 0x48 is Ms will all ADC`s). Why do i become other ID from MS? Have I made a mistake?

Another question is : in the attachment you see the CAN setiings from project properties. Do I have to add here my board? If yes what should i place in ini file?

greetigs from Germany and really thanks for any help :)
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Can Protocol for egt board

Post by jsmcortina »

Those messages look fine to me, I wrote a utility to decode them.
./can29bit 0x88438
29bit CAN header = 0x88438
var_blk = 0x7
to_id = 0x8
from_id = 0x0
msg_type = 0x1 (MSQ_REQ)
var_offset = 0x2

./can29bit 0x288438
29bit CAN header = 0x288438
var_blk = 0x7
to_id = 0x8
from_id = 0x0
msg_type = 0x1 (MSQ_REQ)
var_offset = 0xa

These and the payload look valid to me. Without your MSQ it is hard to know.

I'm not sure I understand your question about the CAN device section. If you don't know why you'd want to use that, you probably don't need to.

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".
kubeq_sq
Experienced MS/Extra'er
Posts: 157
Joined: Thu May 06, 2010 11:53 am

Re: Can Protocol for egt board

Post by kubeq_sq »

Hi jsmcortina, that are the ID's I have made for my EGT Monitor.... The MS sends totally other ID through the CAN network. See the printscreen. I have realoded the software in my MS2 board with bootloader jumper, nothing better, everything the same. The IDs are as they are written in my last post (see atachment). Why MS sends other IDs as set in the CAN parameters?

Here you have the pdf from my chip. http://ww1.microchip.com/downloads/en/D ... 21801d.pdf . See page 37. I must configure my CAN chip to synchronize with other devices on CAN network. The BIT timings must be the same. If they differ my EGT board will never communicate with ms :(

thank You for your help.
Greetings
Jakub
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Can Protocol for egt board

Post by jsmcortina »

The IDs it is sending are correct. You must be misunderstanding the protocol.

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".
kubeq_sq
Experienced MS/Extra'er
Posts: 157
Joined: Thu May 06, 2010 11:53 am

Re: Can Protocol for egt board

Post by kubeq_sq »

ok, thanks, than i will study once more the protocol :D, but what about bit timings? :)
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Can Protocol for egt board

Post by jsmcortina »

kubeq_sq wrote:ok, thanks, than i will study once more the protocol :D, but what about bit timings? :)
I can't help you on the bit timings, sorry.

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".
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Can Protocol for egt board

Post by jsmcortina »

Here's the source of the code I used to convert the IDs.

Code: Select all

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{

    unsigned int can_hdr;
    unsigned int var_offset, msg_type, from_id, to_id, var_blk, msg_x,
        myvarblk, myvaroff, varbyt;
    if (argc != 2) {
        fprintf(stderr, "Usage is %s <29bit header>\n", argv[0]);
        exit(1);
    }

    can_hdr = strtol(argv[1], NULL, 0);

    printf("29bit CAN header = 0x%x\n", can_hdr);

    /* this is the header bits exclusing SRR, IDE, RTR */
    var_blk = ((can_hdr & 0x78) >> 3) | ((can_hdr & 0x4) << 2);
    to_id = (can_hdr & 0x780) >> 7;
    from_id = (can_hdr & 0x7800) >> 11;
    msg_type = (can_hdr & 0x38000) >> 15;
    var_offset = (can_hdr & 0x1ffc0000) >> 18;

    printf("var_blk = 0x%x\n", var_blk);
    printf("to_id = 0x%x\n", to_id);
    printf("from_id = 0x%x\n", from_id);
    printf("msg_type = 0x%x\n", msg_type);
    printf("var_offset = 0x%x\n", var_offset);


return 0;
}
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".
kubeq_sq
Experienced MS/Extra'er
Posts: 157
Joined: Thu May 06, 2010 11:53 am

Re: Can Protocol for egt board

Post by kubeq_sq »

jsmcortina, thanks for your funktion :D
Could you tell me the datafield comes from byte 0 to 2, and the bytes there from 7 to 0??
i Used intrukctions from page 9 this pdf http://www.msextra.com/doc/pdf/Megasqui ... -01-20.pdf to decode the data in datafield and i become something else as MS sends. Could you tell me why?
Greets
Jakub
racingmini_mtl
Super MS/Extra'er
Posts: 9129
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Can Protocol for egt board

Post by racingmini_mtl »

Do you know what endianness is? That may not be your issue but you need to know about big and little endian when working with bits and bytes and different processors.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
kubeq_sq
Experienced MS/Extra'er
Posts: 157
Joined: Thu May 06, 2010 11:53 am

Re: Can Protocol for egt board

Post by kubeq_sq »

Hi racingmini_mtl, i know what big and small endian is... I don't think, that is my problem in the datafield. I think i should become 0x07, 0x00, 0x48 and i become from MS 0x07, 0x0D, 0x08. That are table number, offset and datafield lenght. I don't think I made here a mistake, did I?
Greetings :)
jsmcortina
Site Admin
Posts: 39611
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Can Protocol for egt board

Post by jsmcortina »

Why are you worrying about those fields? They are generated by the MS3 and specify where IT wants the data returned. Turn the packet around and complete the fields using the table and offset data it sent.

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".
kubeq_sq
Experienced MS/Extra'er
Posts: 157
Joined: Thu May 06, 2010 11:53 am

Re: Can Protocol for egt board

Post by kubeq_sq »

jsmcortina,
I made today so. I made my IDs: 0x00094038, 0x00294038, and i send the readings, the data in datafield is ok (I've checked with analyser the data). But MS" on his gauges has only CAN error bits on MAX and the GPIO ADC don't move.... They are all at 0. I noticed, that my board answers only the second/third request from MS. the uC on the board is atmega32a and it is to slow to answer quicker. Is this a problem??

Only to be sure, the MS uses big endian??
Post Reply