Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Protocol SAE J1939 with Can Bus Qt
Whazzark last edited by Whazzark
Hi all Qt developpers,
First of all it's my first topic on Qt Forum so if i'm doing something wrong just tell me :)
I'm currently working on an QML application using Can Bus and is it possible to send J1939 protocol frames with the class QCanBusFrame ?
Thanks for your advices.
Hi @Whazzark, welcome to the forums :)
I'm currently working on an QML application using Can Bus
Ok, cool. We currently don't have QML bindings for the CAN bus module, so any experience (and maybe contribution) in this direction is much appreciated.
is it possible to send J1939 protocol frames with the class QCanBusFrame ?
Why shouldn't it? J1939 is just CAN 2.0 with extended frame format, so you just have to pack your J1939 frames into CAN frames.
There is also the idea of improving QCanBus so it supports J1939 directly, but as the standard is "half-closed" nothing happened in this direction so far.
But I have worked like this 12 years ago already when I wrote my diploma thesis about a J1939 system.
Whazzark last edited by
@aha_1980 Thank you for your reply.
Yeah you're right I just combine QML graphics and Can bus module in C++ :)
I was wondering about that because the QCanBusFrame class cannot set up PGN and PDU field directly on the frame and I have to send a frame with 611184 as PGN number. So I thought it wasn't possible to do it with this class.
Maybe I am clearer with this answer :)
is your project open source? if you look at QTBUG-59441, we have the idea to have protocol specific classes on top of QCanBusFrame.
this has not evolved yet, but with your requirement (and help - hint hint hint) we could start modeling something. in a first draft, I'd model a QJ1939Frame that does the bit fiddling to build up a QCanBusFrame and vice versa.
unfortunately i dont have the spec and I'm not willing to pay for it just for fun...
what do you think?
Whazzark last edited by
@aha_1980 Unfortunately it isn't open source .. During my research I found this and it could be a good idea to implement this in Qt.
I would be honor to help the framework to rule them all ! If my work can help other you have my words that I could help.
the QCanBusFrame class cannot set up PGN and PDU field directly on the frame and I have to send a frame with 611184 as PGN number.
QCanBusFramedoes not understand PGNs, but it understands the 29-bit CAN identifier.
You can use bit shifting to create a 29-bit identifier that contains the 18-bit PGN. See:
This is the simple part. The harder part is writing code that ensure the CAN frames are sent and received in a specific order, as required by the J1939 protocol.