2016-06-26 01:40 PM
Hi all,
Here is another funny problem to crack. I use ltdc and I also want to use crc. There is no problem with ltdc until I call the functionHAL_CRC_Calculate(). See the video OK.avi and NOK.avi for illustration. Below is code for NOK case.uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength)
{
uint32_t index = 0; /* CRC input data buffer index */
uint32_t temp = 0; /* CRC output (read from hcrc->Instance->DR register) */
/* Process locked */
__HAL_LOCK(hcrc);
/* Change CRC peripheral state */
hcrc->State = HAL_CRC_STATE_BUSY;
/* Reset CRC Calculation Unit (hcrc->Instance->INIT is
* written in hcrc->Instance->DR) */
__HAL_CRC_DR_RESET(hcrc);
switch (hcrc->InputDataFormat)
{
case CRC_INPUTDATA_FORMAT_WORDS:
/* Enter 32-bit input data to the CRC calculator */
for(index = 0; index <
BufferLength
; index++)
{
hcrc->Instance->DR = pBuffer[index];
}
temp = hcrc->Instance->DR;
break;
(gdb) print hcrc->Instance
$38 = (CRC_TypeDef *) 0x40023000
(gdb) print *hcrc->Instance
$39 = {DR = 0xffffffff, IDR = 0x0, RESERVED0 = 0x0, RESERVED1 = 0x0, CR = 0x0, RESERVED2 = 0x0, INIT = 0xffffffff, POL = 0x4c11db7}
(gdb)
However, if I remove the line from hal library crc file:
hcrc->Instance->DR = pBuffer[index];
Then the problem disappears. I am usingSTM32F756IGK6. Regards, /Rygelxvi2016-06-27 07:42 AM
It appears you overload some of the buses - either AHB1 where the CRC unit sits together with the DMA2D which you probably use too, or FMC if you use external memory as a framebuffer and the source of CRC data calculation is an external memory too.
Try to do the CRC calculation during blanks/syncs, or insert delays between consecutive iterations of the loop. JW2016-06-27 12:01 PM
Hi Jan,
That makes perfect sense, thanks a lot !Regards,/Rygelxvi