openiolink / io-link-master-shield-hat-sw

Software for the IO-Link Master Shield/Hat for Arduino and Raspberry Pi
Apache License 2.0
25 stars 6 forks source link

Checksum Calculation by the MAX14819 chip #31

Open gammeter opened 3 years ago

gammeter commented 3 years ago

According to the datasheet (page 29) the MAX14819 chip is able to calculate the checksum of IO-Link messages:

The MAX14819 can perform standard IO-Link 6-bit checksum calculation and checksum verification. This can be used to (1) generate the master message checksum automatically, (2) to check the integrity of the master message from the SPI master to the TxFIFO_, and (3) to check the received device message.

However, a comment in the code in Max14819.cpp (currently line 192) says the following:

Dont use InsChks when transmit OD Data, max14819 doesnt calculate it right

I think one should go over the code again to see if this issue is caused by the software (e.g. timing problem with the SPI communication or "wrong" configuration of the chip).
Using the Checksum Calculation on the chip would reduce the CPU load.

gammeter commented 3 years ago

Should the library be portable also to chips that do not support checksum calculation in hardware? @maehne
If yes, using the hardware support for the current chip makes it more difficult to port the library to chips that do not support this feature.

gammeter commented 3 years ago