Protocol SAE J1939 with Can Bus Qt
-
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.
Regards
-
@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 :)
Regards.
-
hi @Whazzark,
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?
-
@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.
Regards.
-
@Whazzark said in Protocol SAE J1939 with Can Bus Qt:
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.
QCanBusFrame
does 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:
- https://www.ixxat.com/images/librariesprovider8/technologies/all4can/j1939-technology-identifier.png?sfvrsn=904b4d6_2&MaxWidth=500&MaxHeight=&ScaleUp=false&Quality=High&Method=ResizeFitToAreaArguments&Signature=7528B5FEEECE73B9DF4697F1F53FA27B60129F63
- http://slideplayer.com/slide/10852377/39/images/16/Data+Link+Layer+SAE+J1939/21+29+Bit+ID+PRI+PGN+SA+28…26+25+24+23…16.jpg
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.