Protocol j1587

For general Flowcode discussion that does not belong in the other sections.
Post Reply
bios33
Posts: 42
http://meble-kuchenne.info.pl
Joined: Thu Jun 23, 2022 11:43 am
Has thanked: 12 times

Protocol j1587

Post by bios33 »

Hi all! I'm facing a problem, I can't receive data from UART correctly. I need to extract from the message some bytes that are responsible for temperature, engine speed, oil pressure. I take data from the SAE J1587 bus (truck standard) through a UART/RS485 to UART2 STM32F411CE converter. Can anyone help me figure out this exchange protocol? I will be very grateful, I’ve been playing for 3 days already
Here is a similar protocol description
Attachments
SAE J1587 (2002 Standard).pdf
(752.93 KiB) Downloaded 89 times

chipfryer27
Valued Contributor
Posts: 1146
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: Protocol j1587

Post by chipfryer27 »

Hi

Sorry to be brief, heading out.

Are you able to receive data and just need to extract certain bytes or do you have a problem receiving?

If you can receive then you could put the received bytes into a Circular Buffer then look for/extract specific characters / strings / whatever.

Regards

bios33
Posts: 42
Joined: Thu Jun 23, 2022 11:43 am
Has thanked: 12 times

Re: Protocol j1587

Post by bios33 »

Hello!
I receive these packets in this form, message line:
128 084 000 190 000 000 100 020 092 000 102 075 233
where 128 is the MID address (engine) then 084 is the PID data address (road speed) then 000 is the speed value 1 byte then 190 (engine speed) and 2 bytes of speed data, then 100 (oil pressure) and 1 byte of pressure data, 092 (engine load) and 1 byte of data, then 102 (turbine inflation) 1 byte and at the end 233. As I understand it, 233 is a checksum. I think about the cyclic buffer, but I haven’t encountered this and am trying to figure it out, maybe there are examples on this topic. How to do it?
Thank you for your attention!

RGV250
Posts: 264
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 23 times
Been thanked: 30 times

Re: Protocol j1587

Post by RGV250 »

Hi,
I think J1587 is CAN so you would need a CAN transciever rather than RS485. Also there are over 40 CAN protocols and I don't think FC covers the one you want.

Bob

bios33
Posts: 42
Joined: Thu Jun 23, 2022 11:43 am
Has thanked: 12 times

Re: Protocol j1587

Post by bios33 »

Hello!
J1587 or J1708 is similar to can but it is not can, it is the same RS485 only with special receive/transmit processing. I published a detailed description of this protocol above.
It would be nice if we could create the j1587 component for FC10 as in the example of ,,j1939 Automotive,,

RGV250
Posts: 264
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 23 times
Been thanked: 30 times

Re: Protocol j1587

Post by RGV250 »

Hi,
When i googled it I saw this which implied it was CAN.
Introduction to SAE J1587
Kvaser
https://www.kvaser.com › About CAN › CAN Standards
Kvaser provides an introduction to SAE J1587, the CAN protocol used for development and maintenance of microcontroller devices in heavy duty vehicles.
Anyway, if you are interested in checking the checksum it is dead easy, all you need to do is add all the values and then AND with 0xFF and it should be zero.
Calculation of Checksum

A simple way to decide if a message has been correctly transmitted is to add the checksum to the 8-bit sum of all data bytes plus the MID of a received message. The 8-bit sum should be zero (0) if the message was transmitted correctly.

Using your data,

128 + 084 + 000 + 190 + 000 + 000 + 100 + 020 + 092 + 000 + 102 + 075 + 233 = 1024
(1024 AND 0xFF) = 0, so the message is correct.
Bob

chipfryer27
Valued Contributor
Posts: 1146
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: Protocol j1587

Post by chipfryer27 »

Hi

If I understand correctly, you can receive data without any issue, in what looks like a string format. However you need to then extract specifics and then "do something" with them. Is this the case?

Is your received data always in the same format, i.e. same info and same length (albeit variables changing)? Is the example given a true representation of what is actually received i.e. a space is used as a separator etc?

I'm thinking you could either use a CB or append incoming values to a string, processing at will, possibly using the many string functions available (e.g. Left$/Right$/Mid$/Contain$ etc).

How is the data received? Do you request or does it appear at random?

If you can confirm the above then I can suggest further.

Regards

bios33
Posts: 42
Joined: Thu Jun 23, 2022 11:43 am
Has thanked: 12 times

Re: Protocol j1587

Post by bios33 »

Hi!
Here is a fragment of data taken from uart via USB/RS485, you can see there that the packet starts at 0x80 if in hex and in the next screen from special software, j1587 Navigator, from Volvo, and there you can also see that the beginning of the packet starts at 128 in hex 80 But when all the blocks and other packages appear on the network, for example MID 144, MID 130 and so on, now I only have MID128 on my desk.
I can't connect external COM to FC, I think it would be easier that way
Attachments
Connected MID144 (VEHICLE CONTROL UNIT)
Connected MID144 (VEHICLE CONTROL UNIT)
IMG_20240123_023221198_HDR.jpg (338.1 KiB) Viewed 1089 times
IMG_20240123_015241371_HDR.jpg
IMG_20240123_015241371_HDR.jpg (345.85 KiB) Viewed 1090 times
Connected engine control module via USB/RS485 to PC
Connected engine control module via USB/RS485 to PC
Screenshot 2024-01-23 012026.jpg (107.9 KiB) Viewed 1091 times

chipfryer27
Valued Contributor
Posts: 1146
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: Protocol j1587

Post by chipfryer27 »

Hi

A couple of questions.

Out of curiosity, what PC program is it you are using to capture the hex? Is it connected directly to the UART/485 and is the only software running or is it "monitoring" some other software action, perhaps even a bus between modules? I ask as most scan tools I have came across, and that isn't many, interact. By that I mean the user issues commands and the target responds.

As Bob mentions above, there are many protocols and J1587 is quite old with a lot of documentation out there. I found this which may help explain the protocol and physical attributes. It is by Pico, a manufacturer of PC based "scopes" frequently found in garages etc.

https://www.picoauto.com/support/viewtopic.php?t=22640

Depending on your PID, the returned data length varies but in a defined format. The protocol also defines how the data is interpreted so that in your example, PID of 110 with (a single byte) data of 111 translates to a temperature of 43.9. How do you plan to do this conversion or doesn't it matter?

Regards

bios33
Posts: 42
Joined: Thu Jun 23, 2022 11:43 am
Has thanked: 12 times

Re: Protocol j1587

Post by bios33 »

Hi!
Program ,, Serial tool 1.5.0,, .
The engine control unit itself always transmits this data to the network, immediately after power is applied, without any requests. And I just connected the bus via USB/RS485 to the PC and monitor. But I know that you can send commands to it and it will respond to requests, just like Volvo software does. In general, this is a Volvo engine, and I want to install it on my tractor, and I need to see its parameters during operation. I'm not a programming professional, but I'm good with electronics.

Post Reply