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

Re: CANbus to Instruments etc. working

Postby acab » Wed May 15, 2013 10:35 am

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)) */
User avatar
acab
Experienced MS/Extra'er
 
Posts: 207
Joined: Tue Aug 21, 2012 5:52 am
Location: Minsk, BY

Re: CANbus to Instruments etc. working

Postby stevevp » Wed May 15, 2013 4:35 pm

CANBTR0 = 0x1D
CANBTR1 = 0x1C

see http://www.port.de/cgi-scripts/tq.cgi?ctype=Philips&CLK=24&sample_point=87.5
yellow lines are optimal
Steve
stevevp
Helpful MS/Extra'er
 
Posts: 37
Joined: Fri Nov 11, 2011 3:43 am
Location: Brisbane, Australia

Re: CANbus to Instruments etc. working

Postby acab » Fri May 17, 2013 12:40 pm

stevevp wrote:CANBTR0 = 0x1D
CANBTR1 = 0x1C

see http://www.port.de/cgi-scripts/tq.cgi?ctype=Philips&CLK=24&sample_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);
    }

User avatar
acab
Experienced MS/Extra'er
 
Posts: 207
Joined: Tue Aug 21, 2012 5:52 am
Location: Minsk, BY

Re: CANbus to Instruments etc. working

Postby jsmcortina » Wed May 22, 2013 6:44 am

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 supply, repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

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

Re: CANbus to Instruments etc. working

Postby acab » Wed May 22, 2013 9:29 am

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.
User avatar
acab
Experienced MS/Extra'er
 
Posts: 207
Joined: Tue Aug 21, 2012 5:52 am
Location: Minsk, BY

Re: CANbus to Instruments etc. working

Postby racingmini_mtl » Wed May 22, 2013 10:11 am

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
racingmini_mtl
Super MS/Extra'er
 
Posts: 7950
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada

Re: CANbus to Instruments etc. working

Postby acab » Wed May 22, 2013 10:26 am

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
User avatar
acab
Experienced MS/Extra'er
 
Posts: 207
Joined: Tue Aug 21, 2012 5:52 am
Location: Minsk, BY

Re: CANbus to Instruments etc. working

Postby jsmcortina » Wed May 22, 2013 10:34 am

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 supply, repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

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

Re: CANbus to Instruments etc. working

Postby acab » Wed May 22, 2013 10:50 am

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 :(
User avatar
acab
Experienced MS/Extra'er
 
Posts: 207
Joined: Tue Aug 21, 2012 5:52 am
Location: Minsk, BY

Re: CANbus to Instruments etc. working

Postby acab » Thu May 30, 2013 9:29 am

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

Image
User avatar
acab
Experienced MS/Extra'er
 
Posts: 207
Joined: Tue Aug 21, 2012 5:52 am
Location: Minsk, BY

Re: CANbus to Instruments etc. working

Postby acab » Sat Jun 22, 2013 11:21 am

I revisited code, and i see some errors.


Thats code works fine in 3.3a13.
User avatar
acab
Experienced MS/Extra'er
 
Posts: 207
Joined: Tue Aug 21, 2012 5:52 am
Location: Minsk, BY

Re: CANbus to Instruments etc. working

Postby NArcher » Sun Aug 11, 2013 3:31 pm

@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?
NArcher
Helpful MS/Extra'er
 
Posts: 55
Joined: Wed Mar 23, 2011 1:38 pm

Re: CANbus to Instruments etc. working

Postby jsmcortina » Sun Aug 11, 2013 4:10 pm

Which code, what error and what data?

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

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

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

Re: CANbus to Instruments etc. working

Postby alfa147-16-120 » Sat Jan 24, 2015 5:42 pm

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

Re: CANbus to Instruments etc. working

Postby acab » Tue Jan 27, 2015 3:33 pm

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;
   }
User avatar
acab
Experienced MS/Extra'er
 
Posts: 207
Joined: Tue Aug 21, 2012 5:52 am
Location: Minsk, BY

Re: CANbus to Instruments etc. working

Postby acab » Fri Jan 30, 2015 1:30 pm

James, can you check that and fix code in next releases?
User avatar
acab
Experienced MS/Extra'er
 
Posts: 207
Joined: Tue Aug 21, 2012 5:52 am
Location: Minsk, BY

Re: CANbus to Instruments etc. working

Postby piledriver » Fri Jan 01, 2016 1:32 am

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.
piledriver
Super MS/Extra'er
 
Posts: 1634
Joined: Tue Oct 27, 2009 6:24 am
Location: Van Alstyne, Texas

Re: CANbus to Instruments etc. working

Postby slyrye » Tue Mar 22, 2016 5:15 am

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
slyrye
Experienced MS/Extra'er
 
Posts: 207
Joined: Sun Aug 12, 2007 2:41 pm
Location: Philippines

Previous

Return to Other Development

Who is online

Users browsing this forum: No registered users and 1 guest