2015-12-16 06:40 AM
Hi.
I'm trying to calculate CRC on STM32F303 using CRC peripheral. I check the correctness of calculation with this on-line application: But I have problems, when I want to calculate CRC above more than 32 bits. If I write to CRC->DR register 32 bits it returns the same as on-line app. For example: - Init value: 0x00000000 - Polynomial: 0x97 - Input data: 0xA5A5A5A5 Here I get CRC value of 0x5A. And the same result I get with on-line app. But if I want to calculate CRC above 40 bits, I don't get the same value anymore. For example: - Init value: 0x00000000 - Polynomial: 0x97 - Input data: 0xA5A5A5A5CC Write CRC->DR = 0xA5A5A5A5 returns 0x5A. Above that I write CRC->DR = 0xCC. And I get 0xFF. Then I use on-line app. And I write input data as: 0xA5A5A5A5CC. It returns 0x44, which is not the same as uC returns. Obviously, I'm doing something wrong. I have set REV_OUT and REV_IN in CR register to 0. Do you have any advice? Thanks #worst-forum-software-ever2015-12-16 08:34 AM
How does it know you're writing an 8-bit value unless you cast it?
*((uint8_t *)&CRC->DR) = 0xCC;2015-12-16 01:15 PM
Thanks Clive, I will try that.
2015-12-17 06:36 AM
2016-01-05 05:32 AM
Hi.
Now I have another problem. I am working on a BiSS protocol and want to implement CRC with standard 0x43 polynomial. I want to use hardware CRC module. I can't get the correct values. I get correct result only if I set CRC_POL register to 0x3 (omitted upper 1 in 0b1000011 polynomial) and with very small input values (5-bit value max.) to DR register. Do you have any suggestion what is going wrong here? Thank you in advance2016-01-05 05:43 AM
> Now I have another problem. I am working on a BiSS protocol and want to implement CRC with standard 0x43 polynomial.
Can you give us a couple of correct examples? JW2016-01-05 06:37 AM
Ok.
First, I am testing with this software:https://ghsi.de/CRC/index.php?Polynom=1000011&Message=aaaaaaaa
(polynomial should be set to 1000011) One example which works can be found in this . On the second page, there is an example with 0x43 polynomial and 0b11 input value. If I put this combination to mentioned software, it turns value 0x5. (Note: The input value should be written as 0x3) Now, if I set polynomial in POL register of a uC to 0x3 and write 0x3 to DR register as input value (same input as before with software), I get 0x5. So, this is true. Althoug I don't know why it works with 0x3 polynomial and not with 0x43. But in this manner (with 0x3 POL) it works for every value which is smaller then 0b100000. So, it works for 0b11111 and smaller inputs. This is a little strange I think. CRC should be computable over unlimited input value, regardless to polynomial. Thank you for yor help.2016-01-05 08:15 AM
Do you have any suggestion what is going wrong here?
Yes, the HW really isn't built do to any other than 8, 16 or 32-bit operations. Do the computation in SW2016-01-05 08:30 AM
2016-01-05 09:39 AM
My previous OT post is of the same ''no title'' type... if you switch from Flat to Threaded view of the thread, you'll see that your post was ''Started'', as if you'd start a new thread (or subthread?) but that fails somehow, that's why it fails to display as standalona, has ''no title'', does not reflect properly poster and timestamp in the threads list.