Skip to main content
DPard.2
Visitor II
Nov 11, 2022 8:50 PM UTC
Question

WRITE_REG macro not working

I'm currently trying to use the CRC peripheral on an STM32G474, and when running HAL_CRC_Calculate(), the computed checksum is always zero. Doing some debugging into the HAL_CRC_Init() function, I've found that when the WRITE_REG macro is called, nothing happens.

Here's an example:

Before calling WRITE_REG, hcrc->Instance->POL = 0.

0693W00000WI9NhQAL.pngAfter executing this line, the value should be 79764919, but:

0693W00000WI9PEQA1.png hcrc->Instance->POL is clearly still 0.

This topic has been closed for replies.

1 reply

TDK
Nov 11, 2022 9:42 PM UTC

The CRC clock need enabled before you can use the peripheral.

__HAL_RCC_CRC_CLK_ENABLE();

"If you feel a post has answered your question, please click ""Accept as Solution""."