Page 2 of 3

Re: CAN support

Posted: Thu Dec 10, 2015 2:56 am
by blundar
russian wrote:
blundar wrote:And $250 is CHEAP for a J interface! My MyCanic was about $800 when I got it and the CarDAQ plus my buddy has was close to $1600 new)
I guess that's the part which I am failing to comprehend. How comes there is no such thing as a $49 open hardware/open source J2534?
well... There is a lot of nitty gritty annoying programming involved. A friend of mine worked on a J2534 interface using a STM32F103. He got most of the way done with it. I say "most of the way" because there were still issues with some of the protocols, most notably the PWM method used by Ford prior to CANbus.

You might be able to make a $49 CANbus J2534 interface but you're looking at a hell of a lot more work to add support for the other protocols - ISO and PWM. So far, I think that the people who tackled this task did so with profit in mind. The API calls are pretty readily available...

Re: CAN support

Posted: Thu Dec 10, 2015 2:59 am
by AndreyB
blundar wrote:A friend of mine worked on a J2534 interface using a STM32F103. He got most of the way done with it.
Is your friend planning to release this as a $49 product or open design by any chance? Is he doing smth for himself or a commercial product?

Re: CAN support

Posted: Thu Dec 10, 2015 3:00 am
by blundar
And in case it wasn't clear from the last post... 95 or 99% working doesn't cut it for a J interface. Many computers can cost $500-1000 to replace if you fuck them up. Bricking computers while programming is extremely undesirable. A lot of what you're paying for with the more expensive J interfaces is high quality engineering. For instance, that $1600 CarDAQ Plus my buddy bought probably had a BOM less than $100 in parts. But it has incredibly stable, high quality software drivers. It is a well-designed piece of hardware that has proper protection circuitry on all of its inputs and outputs. It's stable, reliable and dependable. Inside and out, hardware and software - Drewtech do very good work. If I was programming 20-40 vehicles a week, I would be very particular about my tools, too.

Re: CAN support

Posted: Thu Dec 10, 2015 3:04 am
by blundar
russian wrote:
blundar wrote:A friend of mine worked on a J2534 interface using a STM32F103. He got most of the way done with it.
Is your friend planning to release this as a $49 product or open design by any chance? Is he doing smth for himself or a commercial product?
My friend is intending to release it as a commercial product, if he ever finishes it.

Re: CAN support

Posted: Thu Dec 10, 2015 3:53 am
by AndreyB
http://shop.chipsoft.com.ua/index.php?route=product/product&product_id=114
CHIPSOFT J2534 LITE
Price: $77

Based on stm32 and ChibiOS, apparently not really known in the English-speaking world.

Re: CAN support

Posted: Thu Dec 10, 2015 8:28 am
by Rhinoman
I just ordered an interface which is described as J2534 for $15 delivered. there isn't really anything special about the hardware. J2534 primarily specifies an interface that can communicate via two OBD channels simultaneously and has a hardware level driver with a standard interface through a DLL which should be called 'J2534.dll'. Theoretically you should be able to use any application software as long as you use the dll for the interface.

Re: CAN support

Posted: Thu Dec 10, 2015 1:23 pm
by AndreyB
Rhinoman wrote:Theoretically you should be able to use any application software as long as you use the dll for the interface.
Only theoretically :(
@ has joined us, he is the developer of chipsoft J2534 device. Unless your device covers the whole J2534 software protocol perfectly with all hardware protocols, you will always have different success with different pieces of software.

Re: CAN support

Posted: Thu Dec 10, 2015 2:10 pm
by Rhinoman
russian wrote: Unless your device covers the whole J2534 software protocol perfectly with all hardware protocols, you will always have different success with different pieces of software.
If the device doesn't work perfectly then its not J2534 compliant and that's likely to be the difference between the expensive tools and the cheap ones. The Tech2 and both SDT support J2534 - I will do some experiments with those as well.

Re: CAN support

Posted: Thu Dec 10, 2015 5:29 pm
by kb1gtt
How do we get .dll's to work with TunerStudio or the Java based DevConsole? Would that be a potential problem? Cool to hear @chipsoft is hanging around.

ISO diagnostics

Posted: Thu Dec 10, 2015 7:12 pm
by Rhinoman
I'm going to use the term ISO diagnostics rather than 'OBD2' because OBD2 requires some specific capabilities that we don't have. I'm going to implement Mode 1 diagnostics as far as I can, building on what Russian has already done.

Re: CAN support

Posted: Thu Dec 10, 2015 8:37 pm
by Rhinoman
kb1gtt wrote:How do we get .dll's to work with TunerStudio or the Java based DevConsole? Would that be a potential problem? Cool to hear @chipsoft is hanging around.
I would imagine that that would need a plug-in. J2534 has no knowledge of the ECU software or the PC application software.

Re: CAN support

Posted: Sun Nov 12, 2017 11:49 am
by puff
any progress?

Re: CAN support

Posted: Sun Nov 12, 2017 2:23 pm
by kb1gtt
I see this project which might be of interest.
https://github.com/openxc/uds-c

Re: CAN support

Posted: Sun Nov 12, 2017 2:32 pm
by kb1gtt
Also perhaps of interest. It includes a link to an engine simulator which appears to include and OBD interface. This simulator could be a handy tool for development purposes.
https://learn.sparkfun.com/tutorials/getting-started-with-obd-ii

The above includes some links to references about why in the USA you do NOT want to spoof OBD data, which uses the same underlying ISO standard which are likely to be implemented for CAN communicators. As expected in the USA spoofing OBD data streams is illegal, and you SHOULD NOT attempt to spoof OBD data. I don't see any problems with making it work with the ISO standards. However it should either fail to report readiness codes, or it should report that the emissions system is not ready, it SHOULD NOT report a VIN, etc. It SHOULD report RPM, fuel trims, temperatures, etc.

Re: CAN support

Posted: Mon Jun 11, 2018 5:05 pm
by Tambralinga
I want to test signal canbus for Frankenso.
Do not know what's wrong?

What should i use for the test, pls advise

Code: Select all

2018-06-12 00_02: EngineState: CAN TX PB6
2018-06-12 00_02: EngineState: CAN RX PB12
2018-06-12 00_02: EngineState: type=3 canReadEnabled=Yes canWriteEnabled=Yes period=50
2018-06-12 00_02: EngineState: CAN rx count 0/tx ok 3/tx not ok 79
out put H,L

Re: CAN support

Posted: Tue Jun 12, 2018 8:59 am
by AndreyB
Tambralinga wrote:
Mon Jun 11, 2018 5:05 pm
I want to test signal canbus for Frankenso.
Do not know what's wrong?
Mazda RX8 gauge cluster is my favourite CAN testing device. What is the big picture of what you are trying to do?

Re: CAN support

Posted: Tue Jun 12, 2018 9:22 am
by Tambralinga

Re: CAN support

Posted: Tue Jun 12, 2018 9:33 am
by kb1gtt
There might be some comments of interest at this thread.
https://rusefi.com/forum/viewtopic.php?f=13&t=1289

Re: CAN support

Posted: Tue Jun 12, 2018 9:47 am
by puff
MCP2515 is a CAN controller, what is the receiver? What is the host device?
My experience: I used frankenstein board as a host, and the power supply there was a bit below 3.3V (somewhat 3V?). Because of that, voltages from the transeiver on the host were a bit below the threshold needed for 5V tranceiver on the test device. So I had similar problems till I switched to 3v3 transceiver.

Re: CAN support

Posted: Tue Jun 12, 2018 8:31 pm
by Tambralinga
What do I use to get value canbus?

Re: CAN support

Posted: Tue Jun 12, 2018 8:39 pm
by puff
as russian has mentioned, you can use Mazda dashboard)
I successfully used 3v3 TI tranceiver chip (SN65HVD234 or something like that) and the blue pill (stm32f103 board).
I bet, if you ensure proper 3v3 power supply for the tranceiver chip on your rusefi board, you should be able to connect it to a 5V tranceiver (your tja1050 board) just fine.

Re: CAN support

Posted: Wed Jun 13, 2018 8:46 am
by Tomin
Cheapest option for CAN monitoring is ELM327.
comands:
ATSP6 - switch to CAN (pins 6+14)
ATH1 - switch header showing ON
ATCAF0 - CAN autoformating OFF (turn OFF ISO15765 format)
ATMA - start monitoring of the CAN

Re: CAN support

Posted: Wed Jun 13, 2018 9:12 am
by puff
Do you know if it works with under-3v3 tranceivers?

Re: CAN support

Posted: Wed Jun 13, 2018 9:31 am
by Tomin
It will depend on used chip there. Some ELM are based on 8bit 5Volt chips and some, ELS27 for example, is PIC24.... which is 3V3 chip.
I use dsPIC (like PIC24) on 3V3 with TJA1057. TJA needs 5Volt power, but is 3V3 compatible on CPU side/inputs (TX+RX pins).

Re: CAN support

Posted: Wed Jun 13, 2018 10:14 am
by puff
Yep. Got it.
I've read an appnote from TI stating that their 3v3 chips are compatible with 5V canbus. But in my case (frankenstein board), the supply voltage on the transceiver side was just not sufficient, so that the signal was somewhat half a volt away from the tolerance specified in TJA1050 datasheet.

Re: CAN support

Posted: Fri Jun 22, 2018 3:23 pm
by Tambralinga
uno r3 and mc2515 conect to fankenso canbus

it can connect to 2515, ok.
iso15765-4 i don't know bit and kband.
Image

Code: Select all

/************************************************************************************************* 
  OBD-II_PIDs TEST CODE
  LOOVEE @ JUN24, 2017
  
  Query
  send id: 0x7df
      dta: 0x02, 0x01, PID_CODE, 0, 0, 0, 0, 0

  Response
  From id: 0x7E9 or 0x7EA or 0x7EB
      dta: len, 0x41, PID_CODE, byte0, byte1(option), byte2(option), byte3(option), byte4(option)
      
  https://en.wikipedia.org/wiki/OBD-II_PIDs
  
  Input a PID, then you will get reponse from vehicle, the input should be end with '\n'
***************************************************************************************************/
#include <SPI.h>
#include "mcp_can.h"

// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
const int SPI_CS_PIN = 9;

MCP_CAN CAN(SPI_CS_PIN);                                    // Set CS pin

#define PID_ENGIN_PRM       0x0C
#define PID_VEHICLE_SPEED   0x0D
#define PID_COOLANT_TEMP    0x05

#define CAN_ID_PID          0x7DF

unsigned char PID_INPUT;
unsigned char getPid    = 0;

void set_mask_filt()
{
    /*
     * set mask, set both the mask to 0x3ff
     */
    CAN.init_Mask(0, 0, 0x7FC);
    CAN.init_Mask(1, 0, 0x7FC);

    /*
     * set filter, we can receive id from 0x04 ~ 0x09
     */
    CAN.init_Filt(0, 0, 0x7E8);                 
    CAN.init_Filt(1, 0, 0x7E8);

    CAN.init_Filt(2, 0, 0x7E8);
    CAN.init_Filt(3, 0, 0x7E8);
    CAN.init_Filt(4, 0, 0x7E8); 
    CAN.init_Filt(5, 0, 0x7E8);
}

void sendPid(unsigned char __pid)
{
    unsigned char tmp[8] = {0x02, 0x01, __pid, 0, 0, 0, 0, 0};
    Serial.print("SEND PID: 0x");
    Serial.println(__pid, HEX);
    CAN.sendMsgBuf(CAN_ID_PID, 0, 8, tmp);
}

void setup()
{
    Serial.begin(115200);
    while (CAN_OK != CAN.begin(CAN_500KBPS))    // init can bus : baudrate = 500k
    {
        Serial.println("CAN BUS Shield init fail");
        Serial.println(" Init CAN BUS Shield again");
        delay(100);
    }
    Serial.println("CAN BUS Shield init ok!");
    set_mask_filt();
}


void loop()
{
    taskCanRecv();
    taskDbg();
    
    if(getPid)          // GET A PID
    {
        getPid = 0;
        sendPid(PID_INPUT);
        PID_INPUT = 0;
    }
}

void taskCanRecv()
{
    unsigned char len = 0;
    unsigned char buf[8];

    if(CAN_MSGAVAIL == CAN.checkReceive())                   // check if get data
    {
        CAN.readMsgBuf(&len, buf);    // read data,  len: data length, buf: data buf

        Serial.println("\r\n------------------------------------------------------------------");
        Serial.print("Get Data From id: ");
        Serial.println(CAN.getCanId(), HEX);
        for(int i = 0; i<len; i++)    // print the data
        {
            Serial.print("0x");
            Serial.print(buf[i], HEX);
            Serial.print("\t");
        }
        Serial.println();
    }
}

void taskDbg()
{
    while(Serial.available())
    {
        char c = Serial.read();
        
        if(c>='0' && c<='9')
        {
            PID_INPUT *= 0x10;
            PID_INPUT += c-'0';
            
        }
        else if(c>='A' && c<='F')
        {
            PID_INPUT *= 0x10;
            PID_INPUT += 10+c-'A';
        }
        else if(c>='a' && c<='f')
        {
            PID_INPUT *= 0x10;
            PID_INPUT += 10+c-'a';
        }
        else if(c == '\n')      // END
        {
            getPid = 1;
        }
    }
}
// END FILE

out put

Code: Select all

------------------------------------------------------------------
Get Data From id: 499
0x49	0x24	

------------------------------------------------------------------
Get Data From id: 499
0x49	0x24	

------------------------------------------------------------------
Get Data From id: 499
0x49	0x24	

------------------------------------------------------------------
Get Data From id: 499
0x49	0x24	

------------------------------------------------------------------
Get Data From id: 499
0x49	0x24	

------------------------------------------------------------------
Get Data From id: 499
0x49	0x24	

Re: CAN support

Posted: Fri Jun 22, 2018 5:24 pm
by AndreyB
russian wrote:
Tue Jun 12, 2018 8:59 am
What is the big picture of what you are trying to do?
What is the big picture of what you are trying to do?

Re: CAN support

Posted: Fri Jun 22, 2018 6:02 pm
by kb1gtt
Sorry had to do it. This seems to be some good CAN support.

Re: CAN support

Posted: Fri Jun 22, 2018 6:13 pm
by Tambralinga
russian wrote:
Fri Jun 22, 2018 5:24 pm
russian wrote:
Tue Jun 12, 2018 8:59 am
What is the big picture of what you are trying to do?
What is the big picture of what you are trying to do?
use uino R3 read canbus from vp230 fankenso :D
I don't know PID protocal canbus.

Re: CAN support

Posted: Wed Jun 10, 2020 4:00 am
by AndreyB
My Frankenso reads and writes CAN messages from/to Mazda RX8 cluster so I know that HW works.

rusEFI firmware shows 25 messages received from red wired self-contained ODB scanner which tells me that I have properly wired 4 wires in OBD connector.

I have an ELM327 clone which is working great on my 2011 daily driver and I know that my 2011 daily driver has CAN protocol.

Problem: rusEFI does not receive a single message from ELM327 clone. I've tried two Android applications and now I am trying AT commands - still, CAN read counter is zero. What's the chance of rusEFI not setting up CAN right? Some sort of filter?

Code: Select all

>ATZ


ELM327 v1.5

>AT SP 0
OK

>0100
SEARCHING...
UNABLE TO CONNECT

>AT SP 6
OK

>0100
CAN ERROR

>