Pages: 1 [2]
Author Topic: USBtin experiences?  (Read 23671 times)
woj
Hero Member
*****

Karma: +43/-3
Offline Offline

Posts: 500


« Reply #15 on: July 04, 2018, 02:02:18 PM »

Drop us a link once this ESP32 device of yours is more available Wink

Kvaser might be Swedish, I am not, only happen to live here at the moment. Just checked this product you quoted, looks very solid piece of hardware, just the price is probably more than my complete spending on the Flex Fuel development so far.

And what is going on with the post and duties is currently crazy here, it is not about postage time, but the totally choked duty collection system and post's inability to deal with it. Seriously, this is beyond Monty Python level... Wink

Logged
minDark
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 3


« Reply #16 on: October 24, 2018, 07:53:43 AM »

Hi all! An alternative option could be this: https://www.macchina.cc/. It has 2 CAN inetrfaces, SWCAN, K-Line an J1850, and also one optional ESP32 module for WiFi.
Logged
woj
Hero Member
*****

Karma: +43/-3
Offline Offline

Posts: 500


« Reply #17 on: December 17, 2018, 03:43:04 PM »

So for the better part of last week I engaged into developing an slcan protocol for the integrated Leonardo-CAN device I mentioned earlier (and that I have already fully working otherwise). I first used a ready Arduino project for this some good soul made, but then had to optimize things for speed and I ended up essentially rewriting the whole thing. All this so that I can use / test serial based socket CAN interface for my flasher. It now works and it seems I have hit the serial throughput limit (the device happily connects at 2Mbaud, but it seems the real speed is never higher than 115200). I think we already established that the slcan protocol is wasteful - two characters for each byte to be transmitted, not to mention continuous sending of extended CAN ids with each frame. All in all I got it down to 1:54 for complete flash of my 850k file vs. the 1:19 when I do it with my own waste-less serial protocol. The math also tells me I won't do better than ~1:50 over 115200 baud with slcan.

To the point, motivated by the canable device mentioned earlier that works either in slcan mode, or as a native socket CAN device with candlelight firmware faking gs_usb CAN device, and dealing with the Leonardo's 32u4 chip that supposedly has native USB capability, I am inclined to try the same on the Leonardo-CAN. There are some native USB examples for the hardware capable Arduinos, but the problem is I know total JS about native USB programming (so far), so I am not even sure if that's possible. I was wondering whether somebody has any experience that would help, or simply would like to help develop this. The stuff I did for slcan I plan to release sooner or later.

Logged
woj
Hero Member
*****

Karma: +43/-3
Offline Offline

Posts: 500


« Reply #18 on: December 25, 2018, 10:18:59 AM »

It is doable, I now have a skeleton code that makes a proper CAN-USB device out of my Arduino, makes it recognisable as a gs_usb device on Linux, and I can now receive fake CAN messages with candump generated at the Arduino end. Now what remains is to interface it neatly with the MPC_CAN library, seems to be a piece of cake to finish this.

The bad news is that it required reprogramming the Arduino core, cannot be done as a PluggableUSB library. In practice the core now reads one of the board pins to decide if it wants to be a gs_usb device or the regular Leonardo/ACM device. That is not super elegant, but working. The other alternative is to write a custom Linux kernel module, I looked into this too, but that outgrew me for the moment.
Logged
woj
Hero Member
*****

Karma: +43/-3
Offline Offline

Posts: 500


« Reply #19 on: January 30, 2019, 01:34:47 PM »

So I managed to make a proper native USB driver for this device, link again for the lazy ones: http://www.hobbytronics.co.uk/leonardo-canbus. I got rid of all Arduino dependencies and made it a clean AVR C implementation. It's fast too. Previously the best I could do was 1:18 time for flashing my ECU using the same device, but with a custom optimised serial to CAN Arduino sketch (or a socket CAN interface on CAN-BUS hat equipped RasperryPI, all the same). Now the time is 0:56, that's almost 30% increase in speed. On an empty bus, on a loaded bus it is previous ~1:30 vs. new 1:04. The file size is 832K and looking at the frame times reported by Linux I won't be able to do much better than this. I tested it enough to be confident and it will be published eventually, only that the C code still needs some TLC, and more importantly I need to identify all licences, people, and such that I stole from writing the code, this will take a while.
 
Logged
370rx
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 39


« Reply #20 on: February 04, 2019, 01:15:29 AM »


Fast write speed. my kess v2 via OBD says at least 5 minutes or more. When setting up the motor on the stand was very uncomfortable and lost a lot of time

So I managed to make a proper native USB driver for this device, link again for the lazy ones: http://www.hobbytronics.co.uk/leonardo-canbus. I got rid of all Arduino dependencies and made it a clean AVR C implementation. It's fast too. Previously the best I could do was 1:18 time for flashing my ECU using the same device, but with a custom optimised serial to CAN Arduino sketch (or a socket CAN interface on CAN-BUS hat equipped RasperryPI, all the same). Now the time is 0:56, that's almost 30% increase in speed. On an empty bus, on a loaded bus it is previous ~1:30 vs. new 1:04. The file size is 832K and looking at the frame times reported by Linux I won't be able to do much better than this. I tested it enough to be confident and it will be published eventually, only that the C code still needs some TLC, and more importantly I need to identify all licences, people, and such that I stole from writing the code, this will take a while.

 
Logged
woj
Hero Member
*****

Karma: +43/-3
Offline Offline

Posts: 500


« Reply #21 on: February 04, 2019, 11:10:32 AM »

Fast write speed. my kess v2 via OBD says at least 5 minutes or more. When setting up the motor on the stand was very uncomfortable and lost a lot of time

If we talk about ME7.9.10 I think even the cloned MPPS can do better than this on CAN. I suspect that your setup is the older K-line ECU, in which case 5 minutes is not unreasonable, still slow however, here I was also able to do around 3 minutes (do not remember if less or more, did not record this) on regular KKL to serial connection. And that in theory could be improved - the ECU accepts even faster K-line speed settings (ASM source tells me so), but I couldn't get it to work, the fastest baud that worked for me was 115K.
Logged
370rx
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 39


« Reply #22 on: February 04, 2019, 11:31:11 PM »

Yes, K-line
Logged
woj
Hero Member
*****

Karma: +43/-3
Offline Offline

Posts: 500


« Reply #23 on: February 05, 2019, 05:22:15 AM »

If any one cares: https://github.com/woj76/gs_usb_leonardo

Logged
370rx
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 39


« Reply #24 on: February 05, 2019, 11:02:13 PM »

Thanks, maybe someday I'll come to that

Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Page created in 0.02 seconds with 17 queries. (Pretty URLs adds 0s, 0q)