Checksum CRC-15 for velbus (domotics)

I am currently using the velbus output relay module (4 outputs). I managed to get the protocol for the commands (in hex) but the second last byte seems random to me. I tried checksum CRC-15 (for CAN BUS) but i still cannot get it. I downloaded the velbus protocol summary (.pdf) and there is a code for language C. I tried to compile it and it doesnt work. Please someone help me.


Velbus is using two’s complement checksum

Take the sum of all bytes (unsigned) up to the checksum, discarding any overflow bits. Then invert all bits and add 1.