Pages: [1]
Author Topic: Hexadecimal files, and canbus ... Which programming language is indicated?  (Read 5051 times)
INMOCARS
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 5



Hello everybody! 

I would like to know if any of you can help me decide on the programming language that is most appropriate for handling information in hexadecimal files (I already made some applications in Free Pascal, Lazarus, since it has packages that allow such tasks) and  On the other hand, I have made canbus dialogues sending and receiving frames with arduino and canbus shield but I never studied the C language, I got to put together basic sketches looking for examples and so on.  The question is: What language do you recommend in order to go further on these issues?  The idea is through a usb / obd2 interface plus the indicated code to be able to handle canbus messages, receive a seed, execute the indicated algorithm and be able to respond with its correct key and from there on, read the information from the MCU (example a VW board with micro NEC and  24c64).

 Thanks for reading me and I hope you understand what I am trying to find out.  I've been looking for this answer for months.  I am thinking of C # or Python ...

 Thank you all very much
Logged
d3irb
Full Member
***

Karma: +134/-1
Offline Offline

Posts: 195



Whatever you are most comfortable with language wise. Anything is perfectly capable of these tasks, it's just simple byte manipulation.

The big thing you will need to decide is what to use for your CAN interface.

The two big options are to use the J2534 DLL API, where there are lots of commercial devices available like OpenPort, Panda or commercial devices like DrewTech - but you're stuck to Windows only besides some major hacks. This will work from any language that can load a shared library, so Python, C#, C, C++, node.js, Java, pretty much anything will work.

Or to use SocketCAN, which is very strictly Linux only but is like "normal" sockets programming, so could be easier if you are familiar with this. Again, pretty much any language on Linux can use sockets, so all good here. Panda also works as a SocketCAN device, or you can build a full small Linux computer to use with something like a Raspberry Pi and a Seeed Studios CAN hat, or a Macchina P1.

Then there are a bunch more obscure options too, like to use Python-CAN with or without SocketCAN, or the million different one-off CAN platforms (Vector, Kvaser, blah blah).

Overall, I would pick the language you are most comfortable with, then pick a device that will work with that language on the platform you would like to use, then get to work. I write most of my tools in Python using python-can just because it was simple to get started and is cross-platform, but there's no reason I couldn't have written them nearly as quickly in C#, TypeScript, or even Pascal if I had wanted.
Logged
INMOCARS
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 5



I appreciate your answer very much! 
And I'm going to take what you told me ... as comfortable today I meet with Free pascal - Delphi and I'm going to investigate a control called lazserial that is to work with serial ports and boot with a usb / obd2 interface that works with AT commands or  ST with which I am not familiar, but to start I think it's fine ..

Anyway and little by little I'm going to start a python course ... everything I read leads me to that language. 

Thank you
Logged
prj
Hero Member
*****

Karma: +1072/-481
Offline Offline

Posts: 6037



If you want to work on windows, use C# and J2534.
C# has full primitives, which is very useful, as well as the ease of using a garbage collected language, with the ability to easily link into native code via C++ interop. I would dare say, it is in a very unique and privileged place in the Windows ecosystem.
If you ever need to do something resource intensive, then the ability to have good interactive profiling tools and easy native access to the OS comes in handy.

Whatever you do won't be cross platform anyway, since Linux and Windows have totally different ways of interfacing with the hardware, so you need some sort of abstraction layer.

So your first question is what do you want to do.
If you want to build a dedicated middleware device on something like a raspberry pi or ESP32, then Python is a very good choice.
If you want to make something that uses available J2534 hardware from a PC, then I'd say C# (or Visual C++) is your only good choice, everything else will have a lot of pain to get working.

I am not going to go into philosophical debates about Windows vs Linux and open vs closed standards, I am just speaking from a purely practical point of view.
« Last Edit: April 27, 2021, 03:25:11 AM by prj » Logged

PM's will not be answered, so don't even try.
Log your car properly - WinOLS database - Tools/patches
INMOCARS
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 5



If you want to work on windows, use C# and J2534.
C# has full primitives, which is very useful, as well as the ease of using a garbage collected language, with the ability to easily link into native code via C++ interop. I would dare say, it is in a very unique and privileged place in the Windows ecosystem.
If you ever need to do something resource intensive, then the ability to have good interactive profiling tools and easy native access to the OS comes in handy.

Whatever you do won't be cross platform anyway, since Linux and Windows have totally different ways of interfacing with the hardware, so you need some sort of abstraction layer.

So your first question is what do you want to do.
If you want to build a dedicated middleware device on something like a raspberry pi or ESP32, then Python is a very good choice.
If you want to make something that uses available J2534 hardware from a PC, then I'd say C# (or Visual C++) is your only good choice, everything else will have a lot of pain to get working.

I am not going to go into philosophical debates about Windows vs Linux and open vs closed standards, I am just speaking from a purely practical point of view.

Thanks for your answer. 
The truth is that it is nothing to write home about when it comes to sophistication, I think, today it seems very difficult because it is something completely unknown, and what I was looking for was not to waste time studying a language that does not serve me or is really complicated when I can.  achieve the goal more easily.  It is not something for commercial purposes, but it is to have other types of tools and procedures when working.  The ease of being able to read or write a sector of an eprom or a micro by means of an OBD2 port using code is enough for me to start. 
As I mentioned before ... the closest I am to delphi since I made some applications that manipulate the hexadecimal information but giving it the file with the information obtained by reading the eprom or the mcu with a programmer directly from the eprom or the mcu.  Definitely if it would be under windows that would work.  Never work with linux. 
So I'm going to start studying both languages ​​... nothing happens over time. 
Thanks for the tips. 
Greetings
Logged
nyet
Administrator
Hero Member
*****

Karma: +608/-168
Offline Offline

Posts: 12270


WWW

For windows, C# is the most obvious solution.
Logged

ME7.1 tuning guide
ECUx Plot
ME7Sum checksum
Trim heatmap tool

Please do not ask me for tunes. I'm here to help people make their own.

Do not PM me technical questions! Please, ask all questions on the forums! Doing so will ensure the next person with the same issue gets the opportunity to learn from your ex
Pages: [1]
  Print  
 
Jump to:  

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