Example
487
SPNU503C – March 2018
Copyright © 2018, Texas Instruments Incorporated
Cyclic Redundancy Check (CRC) Controller Module
14.3.2 Example: Auto Mode Without Using Time Based Triggering
A small but highly secured memory area with 1kbytes is to be checked in the background of CPU. CRC is
to be performed every 1Kbytes. Therefore there is only one pre-recorded CRC value. For illustration
purpose, we map channel 1 CRC Value Register to DMA channel 1 and channel 1 PSA Signature
Register to DMA channel 2. Assume all transfers carried out by DMA are in 64 bit transfer size.
14.3.2.1 DMA Setup
•
Set up DMA channel 1 with the source address from which the pre-determined CRC value is stored.
Set up the destination address to the memory-mapped channel 1 CRC Value Register. Put the source
address at constant addressing mode and put the destination address at constant addressing mode.
Use
hardware
DMA request for channel 1.
•
Set up DMA channel 2 with the source address from which the memory area to be verified. Set up the
destination address to the memory-mapped channel 1 PSA Signature Register. Program the element
transfer count to 128 and the frame transfer count to 1. Put the source address at post increment
addressing mode and put the destination address at constant address mode. Generate a
software
DMA request on channel 2 after CRC has completed its setup. Enable autoinitiation for DMA channel
2.
14.3.2.2 CRC Setup
•
Program the pattern count to 128.
•
Program the sector count to 1.
•
Leaving the timeout count register with the reset value of zero means no timeout interrupt is generated.
•
Enable AUTO mode and all interrupts.
After AUTO mode is selected, the CRC Controller automatically generates a DMA request on channel 1.
At the same time the CPU generates a
software
DMA request on DMA channel 2. When the first
incoming data pattern arrives at the PSA Signature Register, the CRC Controller will compress it. After
some time, the DMA controller would update the CRC Value Register with a pre-determined value
matching the calculated signature for the first sector of 128 64 bit data patterns. After one sector of data
patterns are compressed, the CRC Controller generates a CRC fail interrupt if signature stored at the PSA
Sector Signature Register does not match the CRC Value Register. CRC Controller generates a DMA
request on DMA channel 1 again after one sector is compressed. After 1kbytes are transferred, the DMA
can generate an interrupt to CPU. Responding to the DMA interrupt CPU can restart the CRC routine by
generating a software DMA request onto channel 2 again.