CRC Polynomial

imtiaz
Posts: 106
Joined: Wed Oct 26, 2016 1:34 am

CRC Polynomial

Postby imtiaz » Fri Dec 09, 2016 2:36 am

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

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: CRC Polynomial

Postby ESP_igrr » Fri Dec 09, 2016 2:44 am

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)

imtiaz
Posts: 106
Joined: Wed Oct 26, 2016 1:34 am

Re: CRC Polynomial

Postby imtiaz » Fri Dec 09, 2016 2:58 am

Thanks : should be
binary : 100000100110000010001110110110111
hex :104C11DB7

So can it be changed????

imtiaz
Posts: 106
Joined: Wed Oct 26, 2016 1:34 am

Re: CRC Polynomial

Postby imtiaz » Fri Dec 09, 2016 3:22 am

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

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: CRC Polynomial

Postby ESP_igrr » Fri Dec 09, 2016 4:11 am

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.

imtiaz
Posts: 106
Joined: Wed Oct 26, 2016 1:34 am

Re: CRC Polynomial

Postby imtiaz » Fri Dec 09, 2016 4:47 am

Excellent thank you ... thats all I needed to know.

Who is online

Users browsing this forum: No registered users and 305 guests