Page 1 of 1

CRC Polynomial

Posted: Fri Dec 09, 2016 2:36 am
by imtiaz
Hi ,

Can anyone tell me what the CRC polynomila is that is used by the CRC calc functions in ESP32

uint32_t crc32_le(uint32_t crc, uint8_t const *buf, uint32_t len);

example : 0x04C11DB7U - generally used by ST chips.

Thanks
Imtiaz

Re: CRC Polynomial

Posted: Fri Dec 09, 2016 2:44 am
by ESP_igrr
G(x) = x^32 +x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1

(i trust you can translate that into hex)

Re: CRC Polynomial

Posted: Fri Dec 09, 2016 2:58 am
by imtiaz
Thanks : should be
binary : 100000100110000010001110110110111
hex :104C11DB7

So can it be changed????

Re: CRC Polynomial

Posted: Fri Dec 09, 2016 3:22 am
by imtiaz
Hi ESP_igrr,

Two questions please :

1 - Can CC Polynomial be changed?
2 - Has the ESP got h/w CRC support?

If not then I guess I will need to write my own CRC calcs - which may be slow .

Thanks

Re: CRC Polynomial

Posted: Fri Dec 09, 2016 4:11 am
by ESP_igrr
No, these functions are defined in ROM code, so they can not be changed. Even if they weren't defined there, I wouldn't advise changing them because some other components rely on the way they behave. So if you need a different polynomial, just add your own function.

ESP32 has only one HW CRC32, for calculating CRC of RTC fast memory. The functions in ROM use a LUT and do calculations in software.

Re: CRC Polynomial

Posted: Fri Dec 09, 2016 4:47 am
by imtiaz
Excellent thank you ... thats all I needed to know.