cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with CRC combined with LTDC

troy1818
Senior
Posted on June 26, 2016 at 22:40

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, /Rygelxvi
2 REPLIES 2
Posted on June 27, 2016 at 16:42

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.

JW
troy1818
Senior
Posted on June 27, 2016 at 21:01

Hi Jan,

That makes perfect sense, thanks a lot !

Regards,

/Rygelxvi