cancel
Showing results for 
Search instead for 
Did you mean: 

WRITE_REG macro not working

DPard.2
Associate

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.

1 REPLY 1
TDK
Guru

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".