Skip to content

Conversation

@mguentner
Copy link
Contributor

This PR might fix all possible encoding issues, these seem related:

#202
#200

The PDF that supposedly describes the DBC format got
the byte-order apparently wrong :)

The correct values are:
0 => big-endian, motorola
1 => little-endian, intel

Both encoder/decoder do bound checks before inserting the
bits into the raw signal. The bound checks need to take the
endianess into account because:

if the signal is little_endian / intel, start_bit describes
the LSB, so end_bit = start_bit + signal_size
if the signal is big_endian / motorola, start_bit describes
the MSB, so end_bit = start_bit - signal_size + 1

This I tested this PR together with #205
To test simply cherry-pick dfe3e90

@mrclgl
Copy link

mrclgl commented Jun 10, 2021

Why is this not merged? I'm confused...
I'm using dbcppp in my application and the byte-order wasn't matching, this fixes my issue.
Or is dbcppp wrong and CANdevStudio's current byte-order is correct?

@rkollataj
Copy link
Member

The error is in CANdevStudio. I still not merged it as it is not passing CI build (fails on tests). Before fixing the test I need to update CANdb which requires currently C++17. I am working on moving CI to GitHub actions. During this switch I will drop support for old compilers and will be able to update CANdb. Right after this will be done I will fix tests and merge this PR. Pretty long explanation, but that's the full picture :-)

The PDF that supposedly describes the DBC format got the byte-order apparently wrong :) The correct values are: 0 => big-endian, motorola 1 => little-endian, intel Both encoder/decoder do bound checks before inserting the bits into the raw signal. The bound checks need to take the endianess into account because: if the signal is little_endian / intel, start_bit describes the LSB, so end_bit = start_bit + signal_size if the signal is big_endian / motorola, start_bit describes the MSB, so end_bit = start_bit - signal_size + 1
@rkollataj rkollataj force-pushed the sig_encode_decode_endianess branch from 8909614 to 0cafa17 Compare June 15, 2021 17:41
Signed-off-by: Remigiusz Kołłątaj <remigiusz.kollataj@gmail.com>
Signed-off-by: Remigiusz Kołłątaj <remigiusz.kollataj@gmail.com>
@rkollataj
Copy link
Member

I've completed rework for Big Endian handling in signal decoder. The code required few more changes and alignment of unit tests. I've brefiely tested decoding with https://github.com/eerimoq/cantools/ and it seems to work fine. Let me know if you have any comments.

Signed-off-by: Remigiusz Kołłątaj <remigiusz.kollataj@gmail.com>
Signed-off-by: Remigiusz Kołłątaj <remigiusz.kollataj@gmail.com>
@codecov
Copy link

codecov bot commented Jun 21, 2021

Codecov Report

Merging #206 (5155647) into master (c984022) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #206 +/- ## ========================================== + Coverage 98.83% 98.87% +0.03%  ========================================== Files 96 96 Lines 3002 3018 +16 ========================================== + Hits 2967 2984 +17  + Misses 35 34 -1 
Impacted Files Coverage Δ
...components/cansignaldecoder/cansignaldecoder_p.cpp 97.29% <100.00%> (+1.77%) ⬆️
...components/cansignalencoder/cansignalencoder_p.cpp 100.00% <100.00%> (ø)
src/common/pluginloader.h 97.95% <0.00%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c984022...5155647. Read the comment docs.

@rkollataj rkollataj merged commit e9a850b into GENIVI:master Jun 21, 2021
@mguentner mguentner deleted the sig_encode_decode_endianess branch June 24, 2021 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants