Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] HW CRC32 calculation works even without clock enabled #82

Closed
milosfec opened this issue Sep 15, 2021 · 0 comments · Fixed by #83
Closed

[BUG] HW CRC32 calculation works even without clock enabled #82

milosfec opened this issue Sep 15, 2021 · 0 comments · Fixed by #83
Labels
bug Something isn't working spit-and-polish Works as-is but can be improved in the future.

Comments

@milosfec
Copy link
Collaborator

Describe the bug
Real HW requires calling __HAL_RCC_CRC_CLK_ENABLE(); prior to using CRC32 calculation, but on the simulator it works even without enabling the clock.

To Reproduce

static inline uint32_t crc32(const uint32_t *buffer, uint32_t length) {
  CRC->CR = CRC_CR_RESET;
  while (length--) {
    const uint32_t word = *((uint32_t *)buffer++);
    CRC->DR = __RBIT(word);
  }
  return __RBIT(CRC->DR) ^ 0xFFFFFFFF;
}

Expected behavior
Mentioned function should return 0xFFFFFFFF unless __HAL_RCC_CRC_CLK_ENABLE(); is called prior to calling the function.

@milosfec milosfec added the bug Something isn't working label Sep 15, 2021
@vintagepc vintagepc added the spit-and-polish Works as-is but can be improved in the future. label Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working spit-and-polish Works as-is but can be improved in the future.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants