Skip to content

Commit bca614e

Browse files
author
Max 'MaxMax' Mönikes
committed
Fix in CRC calculation for crc8 in read register replys
1 parent 36a704c commit bca614e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

TLE9012.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ iso_uart_status_t TLE9012::readRegisterSingle(uint8_t nodeID, uint16_t regaddres
987987
#ifdef SOFT_MSB_FIRST
988988
msb_first_converter(&(response_buffer[4]),5);
989989
#endif
990-
uint8_t crc = crc8(&response_buffer[4],5);
990+
uint8_t crc = crc8(&response_buffer[4],4);
991991

992992
*result = (((uint16_t) response_buffer[6])<<8) | ((uint16_t) response_buffer[7]);
993993

@@ -1093,7 +1093,7 @@ iso_uart_status_t TLE9012::readRegisterBroadcast(uint16_t regaddress, uint16_t*
10931093

10941094
for(uint8_t n = 0; n < N_DEVICES; n++)
10951095
{
1096-
uint8_t crc = crc8(&response_buffer[4+(n*N_DEVICES)],5);
1096+
uint8_t crc = crc8(&response_buffer[4+(n*N_DEVICES)],4);
10971097
result[n] = (((uint16_t) response_buffer[6+(n*N_DEVICES)])<<8) | ((uint16_t) response_buffer[7+(n*N_DEVICES)]);
10981098
if(crc != 0)
10991099
status = isoUART_CRC_ERROR;

0 commit comments

Comments
 (0)