1

I've reviewed the documentation

I'm still a little lost when it comes to applying the functions. Each of the redundancy check methods take in an unsigned char and return an unsigned char.

Shouldn't there be some sort of boolean return somewhere confirming that the data is accurate?

I've been trying to debug unsigned char* tempData = "snap" to the terminal, writing it directly to the register, according to the doc it should return h17:

  UDR0 = crc8(tempData,sizeof(tempData));

The terminal outputs '?' - as if it cannot be read.

2

The crc8 function calculates the Cyclic Redundancy Check (8-bit) value for the data you provide. It is then up to you to compare that calculated value with the CRC you have received.

The ? you are seeing in the serial terminal is an unprintable character. It is representing an 8-bit value that doesn't lie within the 32-127 range of normal ASCII characters, or 32-255 of the extended ASCII character set.

| improve this answer | |
  • Okay! Is this appropriate moving forward? 1) On the transferring node store the value crc8() returns and call it the 'checksum' , then send it as part of the payload. 2) On the receiving node call crc8() on incoming tempData and compare it to checksum? – SensationSama Apr 5 '16 at 14:59
  • I'm sort of concerned that even if this works my implementation is to simple and I'm missing something. I might try another protocol that has stronger avr examples – SensationSama Apr 5 '16 at 15:18
  • The SNAP specification seems very wooly. I'd try something more rigidly defined with proper libraries. Depending on what you want to achieve my ICSC library might work well for you. – Majenko Apr 5 '16 at 15:23
  • My needs are pretty straight forward, I just need to validate incoming packets. Your library looks solid but I'm not running off Arduino. I think it would be challenging to port. – SensationSama Apr 5 '16 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.