Example
488
SPNU503C – March 2018
Copyright © 2018, Texas Instruments Incorporated
Cyclic Redundancy Check (CRC) Controller Module
14.3.3 Example: Semi-CPU Mode
If DMA controller is available in a system, the CRC module can also operate in semi-CPU mode. This
means that CPU can still make use of the DMA to perform data patterns transfer to CRC controller in the
background. The difference between semi-CPU mode and AUTO mode is that CRC controller does not
automatically perform the signature verification. CRC controllers generates a compression complete
interrupt to CPU when the one sector of data patterns are compressed. CPU needs to perform the
signature verification itself.
A memory area with 2Mbyte is to be verified with the help of the CPU. CRC operation is to be performed
every 1K byte. Since there are 2Mbyte (256k doublewords) of memory to be check and we want to
perform a CRC every 1Kbyte (128 doublewords) and therefore there should be 2048 pre-recorded CRC
values. In Semi-CPU mode, the CRC Value Register is not updated and contains indeterminate data.
14.3.3.1 DMA Setup
Set up DMA channel 1 with the source address from which the memory area to be verified are mapped.
Set up the destination address to the memory-mapped channel 1 PSA Signature Register. Put the starting
address at post increment addressing mode and put the destination address at constant address mode.
Use hardware DMA request to trigger an entire block transfer for channel 1. Disable autoinitiation for DMA
channel 1.
14.3.3.2 Timer Setup
The timer can be any general-purpose timer that is capable of generating a time-based DMA request.
Set up timer to generate DMA request associated with DMA channel 1. For example, an OS can set up
the timer to generate a DMA request every 10ms.
14.3.3.3 CRC Setup
•
Program the pattern count to 128.
•
Program the sector count to 2048.
•
For example, we want the entire 2Mbytes to be compressed within 5ms. We can program the block
complete timeout pre-load value to 15625 (5 ms / (1 HCLK period × 64)) if CRC is operating at 200
MHz.
•
Enable Semi-CPU mode and enable all interrupts.
The timer module first generates a DMA request on DMA channel 1 when it is enabled. When the first
incoming data pattern arrives at the PSA Signature Register, the CRC controller will compress it. After one
sector of data patterns are compressed, the CRC controller generate a compression complete interrupt.
Upon responding to the interrupt the CPU would read from the PSA Sector Signature Register. It is up to
the CPU on how to deal with the PSA value just read. It can compare it to a known signature value or it
can write it to another memory location to build a signature file or even transfer the signature out of the
device via SCI or SPI. This routine will continue until the entire 2Mbyte are consumed. The latency of the
interrupt response from CPU can cause overrun condition. If CPU does not read from PSA Sector
Signature Register before the PSA value is overridden with the signature of the next sector of memory, an
overrun interrupt will be generated by CRC controller.
14.3.4 Example: Full-CPU Mode
In a system without the availability of DMA controller, the CRC routine can be operated by CPU provided
the CPU has enough throughput. CPU needs to read from the memory area from which CRC is to be
performed.
A memory area with 2Mbyte is to be checked with the help of the CPU. CRC verification is to be
performed every 1K byte. In CPU mode, the CRC Value Register is not updated and contains
indeterminate data.