CANbus to Instruments etc. working

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

acab
Experienced MS/Extra'er
Posts: 243
Joined: Tue Aug 21, 2012 5:52 am

Re: CANbus to Instruments etc. working

Post by acab »

what i must do, for work in 50kbit?

Code: Select all

    CANBTR0 = 0xC2;  /* SJW=4,BR Prescaler= 3(24MHz CAN clk) */
    CANBTR1 = 0x1C;  /* Set time quanta: tseg2 =2,tseg1=13 
                        (16 Tq total including sync seg (=1)) */
stevevp
Helpful MS/Extra'er
Posts: 40
Joined: Fri Nov 11, 2011 3:43 am
Location: Brisbane, Australia
Contact:

Re: CANbus to Instruments etc. working

Post by stevevp »

CANBTR0 = 0x1D
CANBTR1 = 0x1C

see http://www.port.de/cgi-scripts/tq.cgi?c ... point=87.5
yellow lines are optimal
Steve
acab
Experienced MS/Extra'er
Posts: 243
Joined: Tue Aug 21, 2012 5:52 am

Re: CANbus to Instruments etc. working

Post by acab »

stevevp wrote:CANBTR0 = 0x1D
CANBTR1 = 0x1C

see http://www.port.de/cgi-scripts/tq.cgi?c ... point=87.5
yellow lines are optimal

Thanks!

3.3.prebeta13 works fine with Alfa Romeo GT\147 dashboard via C-CAN (500kbit).

jsmcortina, is it real to rewrite broadcast module for future add other dashboards? I can write code for Fial\Alfa\Lancia dashboards. Alreade have code for VW, Audi, Seat dashboard...


this my edited code with working rpm and clt:

Code: Select all

    if (flash4.can_bcast1 & 0x04) {
        id = 0x561;
        val = (((outpc.clt - 320) * 5) / 9)/10;

        valclt = val + 40;
        valrpm = outpc.rpm/32;

        dataLen = 0x08;
        data[0] = 0x00;
        data[1] = 0x00;
        data[2] = 0x00;
        data[3] = (unsigned char)valclt;
        data[4] = 0x00;
        data[5] = 0x00;
        data[6] = (unsigned char)valrpm;
        data[7] = 0x00;
        ECANSendMessage(id, data, dataLen, MSG_STD);
    }

jsmcortina
Site Admin
Posts: 39587
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: CANbus to Instruments etc. working

Post by jsmcortina »

acab wrote:jsmcortina, is it real to rewrite broadcast module for future add other dashboards? I can write code for Fial\Alfa\Lancia dashboards. Alreade have code for VW, Audi, Seat dashboard...
If you have code to contribute that will extend the CAN broadcast support, then yes please.

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".
acab
Experienced MS/Extra'er
Posts: 243
Joined: Tue Aug 21, 2012 5:52 am

Re: CANbus to Instruments etc. working

Post by acab »

jsmcortina wrote: If you have code to contribute that will extend the CAN broadcast support, then yes please.

James
I add working code, that i correct little on based code and it work. Check earler post.
racingmini_mtl
Super MS/Extra'er
Posts: 9128
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: CANbus to Instruments etc. working

Post by racingmini_mtl »

acab wrote:... Check earler post.
It is much easier and less error prone if you send the source code you have to James instead of telling him to check the previous posts. So if you have working code, send the changed source code files to him.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
acab
Experienced MS/Extra'er
Posts: 243
Joined: Tue Aug 21, 2012 5:52 am

Re: CANbus to Instruments etc. working

Post by acab »

racingmini_mtl wrote: It is much easier and less error prone if you send the source code you have to James instead of telling him to check the previous posts. So if you have working code, send the changed source code files to him.

Jean

No problem, here is code. And some settings.
Better way make dropbox with options (like VAG(VW, Audi, Seat) and Fiat(Alfa Romeo, Lancia, Fiat))
can_broadcasting_alfa_romeo.png
jsmcortina
Site Admin
Posts: 39587
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: CANbus to Instruments etc. working

Post by jsmcortina »

Changing CANBTR0 breaks all other CAN comms though?

Code: Select all

--- ms2_extra_can.c	2013-01-31 01:13:12.000000000 +0000
+++ /home/jsm/Downloads/ms2_extra_can.c-acab	2013-05-22 18:28:54.000000000 +0100
@@ -23,7 +23,7 @@
     /* Set Can enable, use IPBusclk (24 MHz),clear rest */
     CANCTL1 = 0xC0;  
     /* Set timing for .5Mbits/ sec */
-    CANBTR0 = 0xC2;  /* SJW=4,BR Prescaler= 3(24MHz CAN clk) */
+    CANBTR0 = 0x1D;  /* SJW=4,BR Prescaler= 3(24MHz CAN clk) */
     CANBTR1 = 0x1C;  /* Set time quanta: tseg2 =2,tseg1=13 
                         (16 Tq total including sync seg (=1)) */
     CANIDAC = 0x00;   /* 2 32-bit acceptance filters */
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".
acab
Experienced MS/Extra'er
Posts: 243
Joined: Tue Aug 21, 2012 5:52 am

Re: CANbus to Instruments etc. working

Post by acab »

jsmcortina wrote:Changing CANBTR0 breaks all other CAN comms though?

Code: Select all

--- ms2_extra_can.c	2013-01-31 01:13:12.000000000 +0000
+++ /home/jsm/Downloads/ms2_extra_can.c-acab	2013-05-22 18:28:54.000000000 +0100
@@ -23,7 +23,7 @@
     /* Set Can enable, use IPBusclk (24 MHz),clear rest */
     CANCTL1 = 0xC0;  
     /* Set timing for .5Mbits/ sec */
-    CANBTR0 = 0xC2;  /* SJW=4,BR Prescaler= 3(24MHz CAN clk) */
+    CANBTR0 = 0x1D;  /* SJW=4,BR Prescaler= 3(24MHz CAN clk) */
     CANBTR1 = 0x1C;  /* Set time quanta: tseg2 =2,tseg1=13 
                         (16 Tq total including sync seg (=1)) */
     CANIDAC = 0x00;   /* 2 32-bit acceptance filters */
James
wow, sorry, i forget about it. No, leave only 500kbit. i use 50kbit only for testing on table.

later i try add code for show fuel consumption. but i donno. where i can get info about fuel injector cc :(
acab
Experienced MS/Extra'er
Posts: 243
Joined: Tue Aug 21, 2012 5:52 am

Re: CANbus to Instruments etc. working

Post by acab »

Proof here :)
But i get bug - 92-95* celsius didnt work fine. show only 90*. 95 or hight - work fine

Image
acab
Experienced MS/Extra'er
Posts: 243
Joined: Tue Aug 21, 2012 5:52 am

Re: CANbus to Instruments etc. working

Post by acab »

I revisited code, and i see some errors.


Thats code works fine in 3.3a13.
NArcher
Helpful MS/Extra'er
Posts: 55
Joined: Wed Mar 23, 2011 1:38 pm

Re: CANbus to Instruments etc. working

Post by NArcher »

@jsmcortina or @stevevp

So I got the Rx portion of the code to compile and I'm fairly certian that the code is correct, but when I load the firmware, I get a settings error, then the firmware becomes corrupted, causing me to bootjump and reload firmware. I tried putting the CAN data into datax1.vss1_16 or datax1.pwmin16. Is this where I should be putting the data? Would it be easier to use the GPIO board for this type of implementation?
jsmcortina
Site Admin
Posts: 39587
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: CANbus to Instruments etc. working

Post by jsmcortina »

Which code, what error and what data?

Probably best to start a fresh topic and post full details.

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".
alfa147-16-120
MS/Extra Newbie
Posts: 1
Joined: Sat Jan 24, 2015 5:18 pm

Re: CANbus to Instruments etc. working

Post by alfa147-16-120 »

acab wrote:Proof here :)
But i get bug - 92-95* celsius didnt work fine. show only 90*. 95 or hight - work fine

Image
Hello everyone, this is my first post here and I am writing from Italy.
I don't own a Megasquirt (not yet...) but I am highly passionated in engine management systems and car electronics.

I own an Alfa 147 1.6 TS 120CV with fully stock engine management, but have observed the same behaviour by comparing the coolant temperature from instrument cluster and from OBD data.

acab, the temperature gauge in the instrument cluster has a "dead zone" at 90°C, I believe this is intentional and due to instrument cluster design, not to your code.
I think that coolant temperature always at 90°C makes the "common user" more comfortable. :)

Also, my educated guess is that, to create the "dead zone", shown temperatures between 80°C and 100°C would not be real too.
They would be higher than real in range 80-90°C, and lower in the range 90-100°C.
acab
Experienced MS/Extra'er
Posts: 243
Joined: Tue Aug 21, 2012 5:52 am

Re: CANbus to Instruments etc. working

Post by acab »

alfa147-16-120 wrote: acab, the temperature gauge in the instrument cluster has a "dead zone" at 90°C, I believe this is intentional and due to instrument cluster design, not to your code.
I think that coolant temperature always at 90°C makes the "common user" more comfortable. :)

Also, my educated guess is that, to create the "dead zone", shown temperatures between 80°C and 100°C would not be real too.
They would be higher than real in range 80-90°C, and lower in the range 90-100°C.
Yes, i see that zone.
I think we need some gap on 90C, but i didnt tested yet.

Code: Select all

if(engine_status_msg_buffer[3] > ((uint8_t)130)) { // there is a gap on 90C
		engine_status_msg_buffer[3] += 10;
	}
acab
Experienced MS/Extra'er
Posts: 243
Joined: Tue Aug 21, 2012 5:52 am

Re: CANbus to Instruments etc. working

Post by acab »

James, can you check that and fix code in next releases?
piledriver
Super MS/Extra'er
Posts: 1679
Joined: Tue Oct 27, 2009 6:24 am
Location: Van Alstyne, Texas

Re: CANbus to Instruments etc. working

Post by piledriver »

I have been digging around for awhile with no luck...

Is there a central list/thread somewhere of what OEM and aftermarket CAN dashes are supported so far?
Always doing things the hard way, MS2 sequential w/ v1.01 mainboard, LS2 coils. 80 mile/day commuter status.
slyrye
Experienced MS/Extra'er
Posts: 255
Joined: Sun Aug 12, 2007 2:41 pm
Location: Philippines
Contact:

Re: CANbus to Instruments etc. working

Post by slyrye »

acab wrote:James, can you check that and fix code in next releases?
Hello there, Been wanting to know How's the CAN communication with MS3 and E46 progressing so far?
MSnS'n'4G15
tottestad
MS/Extra Newbie
Posts: 32
Joined: Sat May 15, 2010 10:28 pm

Re: CANbus to Instruments etc. working

Post by tottestad »

Has there been any further developements on this? I Have a 2001 boxter I'd like to get the cluster working via Megasquirt pro ultimate. Ive managed to get the tach to work, setting 0x280*4 but nothing else. The coolant doesnt seem to work by setting 0x289 on.
tottestad
MS/Extra Newbie
Posts: 32
Joined: Sat May 15, 2010 10:28 pm

Re: CANbus to Instruments etc. working

Post by tottestad »

tottestad wrote:Has there been any further developements on this? I Have a 2001 boxter I'd like to get the cluster working via Megasquirt pro ultimate. Ive managed to get the tach to work, setting 0x280*4 but nothing else. The coolant doesnt seem to work by setting 0x289 on.
Just checking in to see if anyone has come across this issue.
Post Reply