woj
|
|
« on: April 29, 2018, 01:43:37 PM »
|
|
|
Anyone has any experiences to share with using USBtin: http://www.fischl.de/usbtin/ for non-trivial custom CAN stuff? Like making own flashing interfaces, etc? Just curious.
|
|
|
Logged
|
|
|
|
jcsbanks
Full Member
Karma: +19/-3
Offline
Posts: 146
|
|
« Reply #1 on: April 30, 2018, 01:23:18 AM »
|
|
|
I looked at it and thought it looked interesting if you could make use of its software.
A few things I didn't like the look of for performance:
PIC18F (slow with little memory to buffer) MCP2515 (tiny receive buffer) ASCII protocol (halves transfer rate) Throughput tests only at 250Kbps
I ended up using J2534 for my project, but it has some weaknesses:
Easy to snoop Polling instead of callbacks Price is higher for a genuine product Windows registry dependency but can be made to work on other platforms, but no examples with Android Not usually wireless Carries other capabilities I don't need hence price
Soon I'm migrating my project to a custom built ESP32 device with a CAN transceiver. Before I even started the project, I made sure I could tweak it so that it could deal with a full CAN bus with minimal latency (<10us the minimum I can measure with what I was using to test - Kvaser Leaf Light HS v2). Out the box, the sample drivers could not. The net effect on large transfers is considerable if your device is slower than your ECU.
From what I've seen of MED17, it transmits every 1ms for large ISO TP groups, and asks in its flow control for 2ms inter-packet spacing to receive but accepts faster. So you might not need the theoretical ~240us (depending on bit stuffing) reply time. Kvaser told me they only do 1ms best over USB.
|
|
|
Logged
|
|
|
|
Colt45
Jr. Member
Karma: +0/-1
Offline
Posts: 36
|
|
« Reply #2 on: May 01, 2018, 10:05:10 PM »
|
|
|
I started building some of these but haven't programmed or tested them yet: http://canable.io/I think you can buy them readymade too, pretty cheap. I'm just cheap-er. Since it is STM32, and has native socketCAN support (instead of just slcan [ascii]) should be better throughput. Not sure about latency, I'll have to test when i finish assembling mine.
|
|
|
Logged
|
|
|
|
woj
|
|
« Reply #3 on: May 02, 2018, 02:44:56 AM »
|
|
|
Thank you both for input, I will look into all this.
|
|
|
Logged
|
|
|
|
jcsbanks
Full Member
Karma: +19/-3
Offline
Posts: 146
|
|
« Reply #4 on: May 02, 2018, 08:20:15 AM »
|
|
|
The Cantact/Canable design looks very good/minimal.
There is another design somewhere that uses the STM32 but uses the USB clock instead of a crystal to pare it down even more.
|
|
|
Logged
|
|
|
|
prj
|
|
« Reply #5 on: May 02, 2018, 08:20:47 AM »
|
|
|
USB2 has 125us polling, that's a hard limit you can't do anything about. USB3 works differently and you can get down to 25us.
|
|
|
Logged
|
|
|
|
jcsbanks
Full Member
Karma: +19/-3
Offline
Posts: 146
|
|
« Reply #6 on: May 02, 2018, 10:00:55 AM »
|
|
|
Most microcontrollers used in CAN interfaces don't seem to support the 125us microframes of USB high speed.
|
|
|
Logged
|
|
|
|
prj
|
|
« Reply #7 on: May 02, 2018, 10:16:19 AM »
|
|
|
Well then USB3 is your best bet.
|
|
|
Logged
|
|
|
|
jcsbanks
Full Member
Karma: +19/-3
Offline
Posts: 146
|
|
« Reply #8 on: May 02, 2018, 10:32:20 AM »
|
|
|
I am putting the latency sensitive logic in the OBD device and sending much larger packets with higher latencies through WiFi.
|
|
|
Logged
|
|
|
|
prj
|
|
« Reply #9 on: May 02, 2018, 11:31:12 PM »
|
|
|
Yeah, it's probably the best way to go to have all the logic in the MCU and have a higher level protocol for computer comms vs. trying to send every packet from the computer.
|
|
|
Logged
|
|
|
|
woj
|
|
« Reply #10 on: May 03, 2018, 01:38:15 AM »
|
|
|
Precisely what I did with Arduino Leonardo-CAN and got very good results in terms of performance. Nevertheless, the solution is software heavy - non trivial code on the Arduino that has to deal with MPC peculiarities, and corresponding code to package things on the PC before they are send to the interface. All in all, huge contraption that happens to work. One of the interfaces we are discussing would allow to just have socket based (I work on Linux exclusively) CAN connection and have a much cleaner design, software wise. Would have already bought this canable thing to test, if not for the shipping to my country being the same as the product price :/
|
|
|
Logged
|
|
|
|
woj
|
|
« Reply #11 on: July 04, 2018, 04:36:23 AM »
|
|
|
I have been digging a bit into J2534 things, and I think I now understand what it offers. I have even localised this: https://github.com/NikolaKozina/j2534which is of great help. But, I am still not totally clear on the actual devices. I know the genuine stuff costs $$$, I have also found something called Tactrix Openport2.0 on Chinsese websites. Does this have any chance of working. Or, there is this Toyota Mini VCI cable popping up all the time when googling for J2534, is that anywhere near what I think it could be? Would it work for CAN 500kbs based protocols?
|
|
|
Logged
|
|
|
|
jcsbanks
Full Member
Karma: +19/-3
Offline
Posts: 146
|
|
« Reply #12 on: July 04, 2018, 08:00:18 AM »
|
|
|
I have a genuine OpenPort 2.0 and Kvaser Leaf Light HS v2. I got the Chinese OP2 for $20 and a Toyota MVCI to try as I thought users might try them and wanted to know how bad they were and what issues would arise. The MVCI is very slow and the Chinese OP2 is dead, but initially worked like the genuine one.
The OpenPort 2.0 can happily flash at 500Kbps with a 75% full CAN bus. It is faster than the Kvaser at J2534, but the Kvaser has great development tools and utilities and they handle a 100% full CAN bus without errors for hours, which for some reason seems a tall order for CAN interfaces.
Main weakness of J2534 I see is that its drivers are single threaded and polling based. Both OpenPort 2.0 and Kvaser have bugs in their J2534 implementation too.
For distribution of software to end users, except for pros who are doing lots of cars, genuine/good J2534 is usually too expensive.
|
|
« Last Edit: July 04, 2018, 08:06:35 AM by jcsbanks »
|
Logged
|
|
|
|
woj
|
|
« Reply #13 on: July 04, 2018, 10:25:48 AM »
|
|
|
You are a gold mine of knowledge for this You really ought to change your nick to something like CAN-Bus-Guru or something Why can't it be simple I wonder, it's not a rocket science to have a USB to CAN device. Many standards, proprietary hardware, what not. Original products are not an option for this use case (not that I am against the principle or anything, quite the contrary), for personal use I already solved my issues with Arduino-CAN, but I was simply thinking about open-sourcing some of my developments (logger/flasher) for ME7.9.10, but I'd need some hardware people could just buy easily and cheaply. For logging ELM is sufficient, hell, I even managed to get ELM to work for flashing, but the complete procedure is 8 minutes instead of 1.5. And it has some really ugly hacks because of the older ELM version (and also most likely Chinese, never cared to check) that I have that does not support some things. Seems the next step would be to try the cloned OP (it I could only buy it in Europe, Sweden is now hard on imports and duties have to be paid on essentially everything, not a financial problem, but it also equals months of waiting time for delivery, seriously). How much slower are we talking about for MVCI?
|
|
|
Logged
|
|
|
|
jcsbanks
Full Member
Karma: +19/-3
Offline
Posts: 146
|
|
« Reply #14 on: July 04, 2018, 11:47:20 AM »
|
|
|
MVCI was crazy slow, like ELM327 speed. Kvaser is Swedish Chinese stuff from AliExpress takes about 3 weeks to UK with no import duty for this stuff. I am doing an ESP32 device in a tiny OBD enclosure presently, but it is a commercial project. It does four CAN packets in a millisecond, but has been tweaked endlessly and doing the same with ISO15765 now. Once everyone involved gets their cut it not be cheap but with new features. Unless you sell loads or give away your real time and costs, it does not surprise me that genuine J2534 stuff cost €200+.
|
|
« Last Edit: July 04, 2018, 11:55:28 AM by jcsbanks »
|
Logged
|
|
|
|
|